use of uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLEquivalentClassesAxiom arg) {
Collection<Object> objects = new LinkedList<Object>();
List<OWLClassExpression> classes = new LinkedList<OWLClassExpression>(arg.getClassExpressionsAsList());
Iterator<OWLClassExpression> it1, it2;
it1 = classes.iterator();
while (it1.hasNext()) {
OWLClassExpression classExpr = it1.next();
it1.remove();
it2 = classes.iterator();
while (it2.hasNext()) {
OWLClassExpression next = it2.next();
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(classExpr, next, emptyAnno).accept(this));
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(next, classExpr, emptyAnno).accept(this));
}
}
return objects;
}
use of uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl in project graal by graphik-team.
the class OWLAxiomParser method visit.
// /////////////////////////////////////////////////////////////////////////
// Assertion
// /////////////////////////////////////////////////////////////////////////
@Override
public Iterable<? extends Object> visit(OWLClassAssertionAxiom arg) {
Collection<Object> objects = GraalUtils.createCollection();
OWLClassExpression sub = new OWLObjectOneOfImpl(Collections.singleton(arg.getIndividual()));
OWLClassExpression sup = arg.getClassExpression();
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(sub, sup, emptyAnno).accept(this));
return objects;
}
use of uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLObjectPropertyDomainAxiom arg) {
OWLClassExpression subClass = new OWLObjectSomeValuesFromImpl(arg.getProperty(), DF.getOWLThing());
OWLClassExpression superClass = arg.getDomain();
return new OWLSubClassOfAxiomImpl(subClass, superClass, emptyAnno).accept(this);
}
use of uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLDisjointClassesAxiom arg) {
Collection<Object> objects = new LinkedList<Object>();
List<OWLClassExpression> classes = new LinkedList<OWLClassExpression>(arg.getClassExpressionsAsList());
Iterator<OWLClassExpression> it1, it2;
it1 = classes.iterator();
while (it1.hasNext()) {
OWLClassExpression classExpr = it1.next();
it1.remove();
it2 = classes.iterator();
while (it2.hasNext()) {
OWLClassExpression next = it2.next();
Set<OWLClassExpression> operands = new TreeSet<>();
operands.add(classExpr);
operands.add(next);
OWLClassExpression newExpr = new OWLObjectIntersectionOfImpl(operands);
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(newExpr, NOTHING, emptyAnno).accept(this));
}
}
return objects;
}
use of uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl in project graal by graphik-team.
the class OWLAxiomParser method visit.
// /////////////////////////////////////////////////////////////////////////
// ClassAxiom
// /////////////////////////////////////////////////////////////////////////
@Override
public Iterable<? extends Object> visit(OWLSubClassOfAxiom arg) {
Collection<Object> objects = new LinkedList<Object>();
freeVarGen.setIndex(3);
OWLClassExpression superClass = OWLAPIUtils.classExpressionDisjunctiveNormalForm(arg.getSuperClass());
OWLClassExpression subClass = OWLAPIUtils.classExpressionDisjunctiveNormalForm(arg.getSubClass());
if (OWLAPIUtils.isIntersection(superClass)) {
for (OWLClassExpression c : OWLAPIUtils.getObjectIntersectionOperands(superClass)) {
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, c, emptyAnno).accept(this));
}
} else if (superClass instanceof OWLObjectComplementOf) {
TreeSet<OWLClassExpression> operands = new TreeSet<>();
operands.add(subClass);
operands.add(((OWLObjectComplementOf) superClass).getOperand());
subClass = new OWLObjectIntersectionOfImpl(operands);
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, NOTHING, emptyAnno).accept(this));
} else if (superClass instanceof OWLObjectAllValuesFrom) {
OWLObjectAllValuesFrom allValuesFrom = (OWLObjectAllValuesFrom) superClass;
subClass = new OWLObjectSomeValuesFromImpl(allValuesFrom.getProperty().getInverseProperty(), subClass);
superClass = allValuesFrom.getFiller();
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, superClass, emptyAnno).accept(this));
} else if (superClass instanceof OWLObjectMaxCardinality && ((OWLObjectMaxCardinality) superClass).getCardinality() == 0) {
TreeSet<OWLClassExpression> operands = new TreeSet<>();
operands.add(subClass);
OWLObjectMaxCardinality maxCard = (OWLObjectMaxCardinality) superClass;
operands.add(new OWLObjectSomeValuesFromImpl(maxCard.getProperty(), maxCard.getFiller()));
subClass = new OWLObjectIntersectionOfImpl(operands);
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, NOTHING, emptyAnno).accept(this));
} else if (superClass instanceof OWLDataMaxCardinality && ((OWLDataMaxCardinality) superClass).getCardinality() == 0) {
TreeSet<OWLClassExpression> operands = new TreeSet<>();
operands.add(subClass);
OWLDataMaxCardinality maxCard = (OWLDataMaxCardinality) superClass;
operands.add(new OWLDataSomeValuesFromImpl(maxCard.getProperty(), maxCard.getFiller()));
subClass = new OWLObjectIntersectionOfImpl(operands);
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, NOTHING, emptyAnno).accept(this));
} else if (superClass instanceof OWLObjectExactCardinality && ((OWLObjectExactCardinality) superClass).getCardinality() <= 1) {
OWLObjectExactCardinality exactCard = (OWLObjectExactCardinality) superClass;
OWLObjectMaxCardinality maxCard = new OWLObjectMaxCardinalityImpl(exactCard.getProperty(), exactCard.getCardinality(), exactCard.getFiller());
OWLObjectMinCardinality minCard = new OWLObjectMinCardinalityImpl(exactCard.getProperty(), exactCard.getCardinality(), exactCard.getFiller());
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, maxCard, emptyAnno).accept(this));
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, minCard, emptyAnno).accept(this));
} else if (superClass instanceof OWLDataExactCardinality && ((OWLDataExactCardinality) superClass).getCardinality() <= 1) {
OWLDataExactCardinality exactCard = (OWLDataExactCardinality) superClass;
OWLDataMaxCardinality maxCard = new OWLDataMaxCardinalityImpl(exactCard.getProperty(), exactCard.getCardinality(), exactCard.getFiller());
OWLDataMinCardinality minCard = new OWLDataMinCardinalityImpl(exactCard.getProperty(), exactCard.getCardinality(), exactCard.getFiller());
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, maxCard, emptyAnno).accept(this));
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(subClass, minCard, emptyAnno).accept(this));
} else if (isSuperClass(superClass)) {
if (subClass instanceof OWLObjectUnionOf) {
for (OWLClassExpression c : OWLAPIUtils.getObjectUnionOperands(subClass)) {
CollectionUtils.addAll(objects, new OWLSubClassOfAxiomImpl(c, superClass, emptyAnno).accept(this));
}
} else if (isEquivClass(subClass)) {
CollectionUtils.addAll(objects, mainProcess(arg));
} else {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("[ " + subClass + "] is not supported as subClass. This axioms was skipped : " + arg);
}
}
} else {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("[ " + superClass + "] is not supported as superClass. This axioms was skipped : " + arg);
}
}
return objects;
}
Aggregations