Search in sources :

Example 1 with OWLPropertyExpression

use of org.semanticweb.owlapi.model.OWLPropertyExpression in project graal by graphik-team.

the class OWLAxiomParser method visit.

// /////////////////////////////////////////////////////////////////////////
// PropertyChain
// /////////////////////////////////////////////////////////////////////////
@Override
public Iterable<? extends Object> visit(OWLSubPropertyChainOfAxiom arg) {
    freeVarGen.setIndex(0);
    InMemoryAtomSet body = GraalUtils.createAtomSet();
    Term varX, varY, firstVarInChain;
    firstVarInChain = varX = freeVarGen.getFreshSymbol();
    for (OWLPropertyExpression pe : arg.getPropertyChain()) {
        varY = freeVarGen.getFreshSymbol();
        body.addAll(pe.accept(new OWLPropertyExpressionVisitorImpl(varX, varY)));
        varX = varY;
    }
    InMemoryAtomSet head = arg.getSuperProperty().accept(new OWLPropertyExpressionVisitorImpl(firstVarInChain, varX));
    return Collections.singleton(DefaultRuleFactory.instance().create(body, head));
}
Also used : OWLPropertyExpression(org.semanticweb.owlapi.model.OWLPropertyExpression) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet) Term(fr.lirmm.graphik.graal.api.core.Term)

Example 2 with OWLPropertyExpression

use of org.semanticweb.owlapi.model.OWLPropertyExpression in project graal by graphik-team.

the class OWLAxiomParser method disjointPropertiesAxiom.

private Iterable<? extends Object> disjointPropertiesAxiom(Iterable<? extends OWLPropertyExpression> properties) {
    Collection<Rule> rules = GraalUtils.<Rule>createCollection();
    InMemoryAtomSet a, a1, a2;
    Iterator<? extends OWLPropertyExpression> it1, it2;
    it1 = properties.iterator();
    while (it1.hasNext()) {
        OWLPropertyExpression propExpr = (OWLPropertyExpression) it1.next();
        a1 = propExpr.accept(propertyVisitorXY);
        it1.remove();
        it2 = properties.iterator();
        while (it2.hasNext()) {
            OWLPropertyExpression next = (OWLPropertyExpression) it2.next();
            a2 = next.accept(propertyVisitorXY);
            a = GraalUtils.createAtomSet();
            a.addAll(a1);
            a.addAll(a2);
            rules.add(new DefaultNegativeConstraint(a));
        }
    }
    return rules;
}
Also used : OWLPropertyExpression(org.semanticweb.owlapi.model.OWLPropertyExpression) DefaultNegativeConstraint(fr.lirmm.graphik.graal.core.DefaultNegativeConstraint) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet) Rule(fr.lirmm.graphik.graal.api.core.Rule) SWRLRule(org.semanticweb.owlapi.model.SWRLRule)

Example 3 with OWLPropertyExpression

use of org.semanticweb.owlapi.model.OWLPropertyExpression in project graal by graphik-team.

the class OWLAxiomParser method equivalentPropertiesAxiom.

private Iterable<? extends Object> equivalentPropertiesAxiom(Iterable<? extends OWLPropertyExpression> properties) {
    Collection<Rule> rules = GraalUtils.<Rule>createCollection();
    InMemoryAtomSet a1, a2;
    Iterator<? extends OWLPropertyExpression> it1, it2;
    it1 = properties.iterator();
    while (it1.hasNext()) {
        OWLPropertyExpression propExpr = (OWLPropertyExpression) it1.next();
        a1 = propExpr.accept(propertyVisitorXY);
        it1.remove();
        it2 = properties.iterator();
        while (it2.hasNext()) {
            OWLPropertyExpression next = (OWLPropertyExpression) it2.next();
            a2 = next.accept(propertyVisitorXY);
            rules.add(DefaultRuleFactory.instance().create(a1, a2));
            rules.add(DefaultRuleFactory.instance().create(a2, a1));
        }
    }
    return rules;
}
Also used : OWLPropertyExpression(org.semanticweb.owlapi.model.OWLPropertyExpression) InMemoryAtomSet(fr.lirmm.graphik.graal.api.core.InMemoryAtomSet) Rule(fr.lirmm.graphik.graal.api.core.Rule) SWRLRule(org.semanticweb.owlapi.model.SWRLRule)

Aggregations

InMemoryAtomSet (fr.lirmm.graphik.graal.api.core.InMemoryAtomSet)3 OWLPropertyExpression (org.semanticweb.owlapi.model.OWLPropertyExpression)3 Rule (fr.lirmm.graphik.graal.api.core.Rule)2 SWRLRule (org.semanticweb.owlapi.model.SWRLRule)2 Term (fr.lirmm.graphik.graal.api.core.Term)1 DefaultNegativeConstraint (fr.lirmm.graphik.graal.core.DefaultNegativeConstraint)1