
it.uniroma2.art.owlart.model.syntax.manchester.ObjectUnionOf Maven / Gradle / Ivy
package it.uniroma2.art.owlart.model.syntax.manchester;
import it.uniroma2.art.owlart.models.OWLModel;
import it.uniroma2.art.owlart.exceptions.ModelUpdateException;
import it.uniroma2.art.owlart.model.ARTBNode;
import it.uniroma2.art.owlart.model.ARTResource;
import java.util.ArrayList;
import java.util.ListIterator;
public class ObjectUnionOf {
private int numb;//numero degli oggetti che sono in or tra loro
ArrayList or;
public OWLModel model;
public ARTResource resource;
public ObjectUnionOf(OWLModel mod) {
numb=0;
or=new ArrayList();
model=mod;
}
public int getElements() {
return numb;
}
public void addElement(ObjectIntersectionOf toAdd) {
or.add(toAdd);
numb++;
}
public String toString() {
String res="conj----dim or:"+or.size();
return res;
}
public void createOntology() throws ModelUpdateException {
ARTBNode b=model.createBNode();
ArrayList res=new ArrayList();
ListIterator orIterator=or.listIterator();
while(orIterator.hasNext()) {
res.add(orIterator.next().computeIntersection());
}
if(or.size()==1) {
resource=or.get(0).resource;
return;
}
model.addUnionOf(b.getID(), res);
resource=b;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy