use of fr.lirmm.graphik.graal.core.DefaultNegativeConstraint in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLDifferentIndividualsAxiom arg) {
Collection<Object> c = GraalUtils.<Object>createCollection();
LinkedList<OWLIndividual> list = new LinkedList<OWLIndividual>(arg.getIndividualsAsList());
Iterator<OWLIndividual> it1, it2;
it1 = list.iterator();
while (it1.hasNext()) {
OWLIndividual individu1 = it1.next();
it1.remove();
Term t1 = GraalUtils.createTerm(individu1);
it2 = list.iterator();
while (it2.hasNext()) {
OWLIndividual individu2 = it2.next();
Term t2 = GraalUtils.createTerm(individu2);
Atom a = new DefaultAtom(equalityPredicate, t1, t2);
c.add(new DefaultNegativeConstraint(new LinkedListAtomSet(a)));
}
}
return c;
}
use of fr.lirmm.graphik.graal.core.DefaultNegativeConstraint in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLNegativeObjectPropertyAssertionAxiom arg) {
freeVarGen.setIndex(0);
Term a = GraalUtils.createTerm(arg.getSubject());
Term b = GraalUtils.createTerm(arg.getObject());
InMemoryAtomSet atomset = arg.getProperty().accept(new OWLPropertyExpressionVisitorImpl(a, b));
return Collections.singleton(new DefaultNegativeConstraint(atomset));
}
use of fr.lirmm.graphik.graal.core.DefaultNegativeConstraint 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;
}
use of fr.lirmm.graphik.graal.core.DefaultNegativeConstraint in project graal by graphik-team.
the class AbstractDlgpListener method endsConjunction.
@Override
public void endsConjunction(OBJECT_TYPE objectType) {
switch(objectType) {
case QUERY:
Set<Variable> bodyVars = this.atomSet.getVariables();
for (Term t : this.answerVars) {
if (t.isVariable() && !bodyVars.contains(t)) {
throw new ParseError("The variable [" + t + "] of the answer list does not appear in the query body.");
}
}
this.createQuery(DefaultConjunctiveQueryFactory.instance().create(this.label, this.atomSet, this.answerVars));
break;
case NEG_CONSTRAINT:
this.createNegConstraint(new DefaultNegativeConstraint(this.label, this.atomSet));
break;
case RULE:
if (this.atomSet2 == null) {
this.atomSet2 = this.atomSet;
this.atomSet = new LinkedListAtomSet();
} else {
this.createRule(DefaultRuleFactory.instance().create(this.label, this.atomSet, this.atomSet2));
}
break;
case FACT:
this.createAtomSet(this.atomSet);
break;
default:
break;
}
}
use of fr.lirmm.graphik.graal.core.DefaultNegativeConstraint in project graal by graphik-team.
the class OWLAxiomParser method visit.
@Override
public Iterable<? extends Object> visit(OWLNegativeDataPropertyAssertionAxiom arg) {
freeVarGen.setIndex(0);
Term a = GraalUtils.createTerm(arg.getSubject());
Term b = GraalUtils.createLiteral(arg.getObject());
InMemoryAtomSet atomset = arg.getProperty().accept(new OWLPropertyExpressionVisitorImpl(a, b));
return Collections.singleton(new DefaultNegativeConstraint(atomset));
}
Aggregations