use of fr.lirmm.graphik.graal.api.core.InMemoryAtomSet in project graal by graphik-team.
the class OWLAxiomParser method functionalPropertyAxiom.
// /////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS
// /////////////////////////////////////////////////////////////////////////
private Iterable<? extends Object> functionalPropertyAxiom(OWLPropertyExpression property) {
InMemoryAtomSet body = property.accept(propertyVisitorXY);
body.addAll(property.accept(propertyVisitorXZ));
InMemoryAtomSet head = GraalUtils.createAtomSet(new DefaultAtom(equalityPredicate, glueVarY, glueVarZ));
return Collections.<Rule>singleton(DefaultRuleFactory.instance().create(body, head));
}
use of fr.lirmm.graphik.graal.api.core.InMemoryAtomSet 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));
}
use of fr.lirmm.graphik.graal.api.core.InMemoryAtomSet in project graal by graphik-team.
the class OWLAxiomParser method visit.
// /////////////////////////////////////////////////////////////////////////
// DataPropertyAxiom
// /////////////////////////////////////////////////////////////////////////
@Override
public Iterable<? extends Object> visit(OWLSubDataPropertyOfAxiom arg) {
InMemoryAtomSet a1, a2;
a1 = arg.getSubProperty().accept(propertyVisitorXY);
a2 = arg.getSuperProperty().accept(propertyVisitorXY);
return Collections.singleton(DefaultRuleFactory.instance().create(a1, a2));
}
use of fr.lirmm.graphik.graal.api.core.InMemoryAtomSet in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLDataPropertyRangeAxiom arg) {
InMemoryAtomSet body = arg.getProperty().accept(propertyVisitorYX);
InMemoryAtomSet head = null;
try {
head = arg.getRange().accept(dataRangeVisitorX);
} catch (UnsupportedConstructor e) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("[ " + e.getConstructor() + "] is not supported here. This axioms was skipped : " + arg);
}
return Collections.emptyList();
}
return Collections.singleton(DefaultRuleFactory.instance().create(body, head));
}
use of fr.lirmm.graphik.graal.api.core.InMemoryAtomSet in project graal by graphik-team.
the class OWLAxiomParser method visit.
// /////////////////////////////////////////////////////////////////////////
// HasKey
// /////////////////////////////////////////////////////////////////////////
@Override
public Iterable<? extends Object> visit(OWLHasKeyAxiom arg) {
// =(Y, Z) :- C(Y), C(Z), p1(Y, X1), p1(Z, X1), ..., pn(Y, Xn), pn(Z,
// Xn).
Collection<Rule> rules = GraalUtils.<Rule>createCollection();
freeVarGen.setIndex(2);
InMemoryAtomSet head = GraalUtils.createAtomSet(DefaultAtomFactory.instance().create(equalityPredicate, glueVarX, glueVarY));
OWLClassExpression classExpression = OWLAPIUtils.classExpressionDisjunctiveNormalForm(arg.getClassExpression());
for (Pair<OWLClassExpression, OWLClassExpression> pair : MathUtils.selfCartesianProduct(OWLAPIUtils.getObjectUnionOperands(classExpression))) {
InMemoryAtomSet body = pair.getLeft().accept(classVisitorX);
body.addAll(pair.getRight().accept(classVisitorY));
for (OWLObjectPropertyExpression pe : arg.getObjectPropertyExpressions()) {
Term var = freeVarGen.getFreshSymbol();
body.addAll(pe.accept(new OWLPropertyExpressionVisitorImpl(glueVarX, var)));
body.addAll(pe.accept(new OWLPropertyExpressionVisitorImpl(glueVarY, var)));
}
for (OWLDataPropertyExpression pe : arg.getDataPropertyExpressions()) {
Term var = freeVarGen.getFreshSymbol();
body.add(DefaultAtomFactory.instance().create(GraalUtils.createPredicate(pe), glueVarX, var));
body.add(DefaultAtomFactory.instance().create(GraalUtils.createPredicate(pe), glueVarY, var));
}
rules.add(DefaultRuleFactory.instance().create(body, head));
}
return rules;
}
Aggregations