Search in sources :

Example 1 with OWLSubClassOfAxiomImpl

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;
}
Also used : OWLSubClassOfAxiomImpl(uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl) OWLClassExpression(org.semanticweb.owlapi.model.OWLClassExpression) LinkedList(java.util.LinkedList)

Example 2 with OWLSubClassOfAxiomImpl

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;
}
Also used : OWLSubClassOfAxiomImpl(uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl) OWLObjectOneOfImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectOneOfImpl) OWLClassExpression(org.semanticweb.owlapi.model.OWLClassExpression)

Example 3 with OWLSubClassOfAxiomImpl

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);
}
Also used : OWLSubClassOfAxiomImpl(uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl) OWLObjectSomeValuesFromImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectSomeValuesFromImpl) OWLClassExpression(org.semanticweb.owlapi.model.OWLClassExpression)

Example 4 with OWLSubClassOfAxiomImpl

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;
}
Also used : TreeSet(java.util.TreeSet) OWLSubClassOfAxiomImpl(uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl) OWLClassExpression(org.semanticweb.owlapi.model.OWLClassExpression) OWLObjectIntersectionOfImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectIntersectionOfImpl) LinkedList(java.util.LinkedList)

Example 5 with OWLSubClassOfAxiomImpl

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;
}
Also used : OWLDataMinCardinalityImpl(uk.ac.manchester.cs.owl.owlapi.OWLDataMinCardinalityImpl) OWLObjectComplementOf(org.semanticweb.owlapi.model.OWLObjectComplementOf) OWLObjectSomeValuesFromImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectSomeValuesFromImpl) OWLObjectUnionOf(org.semanticweb.owlapi.model.OWLObjectUnionOf) OWLClassExpression(org.semanticweb.owlapi.model.OWLClassExpression) OWLDataExactCardinality(org.semanticweb.owlapi.model.OWLDataExactCardinality) OWLObjectIntersectionOfImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectIntersectionOfImpl) OWLObjectMinCardinalityImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectMinCardinalityImpl) OWLObjectAllValuesFrom(org.semanticweb.owlapi.model.OWLObjectAllValuesFrom) OWLObjectMaxCardinality(org.semanticweb.owlapi.model.OWLObjectMaxCardinality) OWLDataSomeValuesFromImpl(uk.ac.manchester.cs.owl.owlapi.OWLDataSomeValuesFromImpl) LinkedList(java.util.LinkedList) OWLObjectExactCardinality(org.semanticweb.owlapi.model.OWLObjectExactCardinality) OWLDataMaxCardinality(org.semanticweb.owlapi.model.OWLDataMaxCardinality) OWLSubClassOfAxiomImpl(uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl) TreeSet(java.util.TreeSet) OWLDataMaxCardinalityImpl(uk.ac.manchester.cs.owl.owlapi.OWLDataMaxCardinalityImpl) OWLObjectMinCardinality(org.semanticweb.owlapi.model.OWLObjectMinCardinality) OWLObjectMaxCardinalityImpl(uk.ac.manchester.cs.owl.owlapi.OWLObjectMaxCardinalityImpl) OWLDataMinCardinality(org.semanticweb.owlapi.model.OWLDataMinCardinality)

Aggregations

OWLClassExpression (org.semanticweb.owlapi.model.OWLClassExpression)7 OWLSubClassOfAxiomImpl (uk.ac.manchester.cs.owl.owlapi.OWLSubClassOfAxiomImpl)7 LinkedList (java.util.LinkedList)3 OWLObjectSomeValuesFromImpl (uk.ac.manchester.cs.owl.owlapi.OWLObjectSomeValuesFromImpl)3 TreeSet (java.util.TreeSet)2 OWLDataSomeValuesFromImpl (uk.ac.manchester.cs.owl.owlapi.OWLDataSomeValuesFromImpl)2 OWLObjectIntersectionOfImpl (uk.ac.manchester.cs.owl.owlapi.OWLObjectIntersectionOfImpl)2 OWLDataExactCardinality (org.semanticweb.owlapi.model.OWLDataExactCardinality)1 OWLDataMaxCardinality (org.semanticweb.owlapi.model.OWLDataMaxCardinality)1 OWLDataMinCardinality (org.semanticweb.owlapi.model.OWLDataMinCardinality)1 OWLObjectAllValuesFrom (org.semanticweb.owlapi.model.OWLObjectAllValuesFrom)1 OWLObjectComplementOf (org.semanticweb.owlapi.model.OWLObjectComplementOf)1 OWLObjectExactCardinality (org.semanticweb.owlapi.model.OWLObjectExactCardinality)1 OWLObjectMaxCardinality (org.semanticweb.owlapi.model.OWLObjectMaxCardinality)1 OWLObjectMinCardinality (org.semanticweb.owlapi.model.OWLObjectMinCardinality)1 OWLObjectUnionOf (org.semanticweb.owlapi.model.OWLObjectUnionOf)1 OWLDataMaxCardinalityImpl (uk.ac.manchester.cs.owl.owlapi.OWLDataMaxCardinalityImpl)1 OWLDataMinCardinalityImpl (uk.ac.manchester.cs.owl.owlapi.OWLDataMinCardinalityImpl)1 OWLObjectMaxCardinalityImpl (uk.ac.manchester.cs.owl.owlapi.OWLObjectMaxCardinalityImpl)1 OWLObjectMinCardinalityImpl (uk.ac.manchester.cs.owl.owlapi.OWLObjectMinCardinalityImpl)1