use of fr.lirmm.graphik.graal.core.DefaultAtom 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.core.DefaultAtom 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.DefaultAtom in project graal by graphik-team.
the class OWLEquivalentClassExpressionVisitorImpl method objectMinCardinality0.
@Override
public InMemoryAtomSet objectMinCardinality0(OWLObjectMinCardinality arg) {
InMemoryAtomSet atomset = GraalUtils.createAtomSet();
atomset.add(new DefaultAtom(Predicate.TOP, glueVariable));
return atomset;
}
use of fr.lirmm.graphik.graal.core.DefaultAtom in project graal by graphik-team.
the class Atom2SubstitutionConverterTest method githubIssue2variant1.
@Test
public void githubIssue2variant1() throws ParseException {
// given
Predicate p = DefaultPredicateFactory.instance().create("p", 1);
Variable x = DefaultTermFactory.instance().createVariable("X");
Variable y = DefaultTermFactory.instance().createVariable("Y");
Atom queryAtom = new DefaultAtom(p, x);
List<Term> ansList = new LinkedList<>();
ansList.add(x);
ansList.add(y);
// when
Converter<Atom, Substitution> converter = new Atom2SubstitutionConverter(queryAtom, ansList);
Substitution s = null;
try {
s = converter.convert(DlgpParser.parseAtom("p(a)."));
} catch (ConversionException e) {
fail();
}
// then
Constant a = DefaultTermFactory.instance().createConstant("a");
assertEquals(a, s.createImageOf(x));
assertEquals(y, s.createImageOf(y));
}
use of fr.lirmm.graphik.graal.core.DefaultAtom in project graal by graphik-team.
the class Atom2SubstitutionConverterTest method basic.
@Test
public void basic() throws ParseException {
// given
Predicate p = DefaultPredicateFactory.instance().create("p", 1);
Variable x = DefaultTermFactory.instance().createVariable("X");
Atom queryAtom = new DefaultAtom(p, x);
List<Term> ansList = new LinkedList<>();
ansList.add(x);
// when
Converter<Atom, Substitution> converter = new Atom2SubstitutionConverter(queryAtom, ansList);
Substitution s = null;
try {
s = converter.convert(DlgpParser.parseAtom("p(a)."));
} catch (ConversionException e) {
fail();
}
// then
Constant a = DefaultTermFactory.instance().createConstant("a");
assertEquals(a, s.createImageOf(x));
}
Aggregations