use of fr.lirmm.graphik.graal.api.core.ConjunctiveQuery in project graal by graphik-team.
the class LiteralsTest method doubleType.
@Theory
public void doubleType(AtomSet store) throws Exception {
Atom a = DlgpParser.parseAtom("<AGE>(a,5.2E20).");
store.add(a);
ConjunctiveQuery q = new DefaultConjunctiveQuery(new LinkedListAtomSet(a), Collections.<Term>emptyList());
Assert.assertTrue(SmartHomomorphism.instance().execute(q, store).hasNext());
Atom b = store.iterator().next();
Assert.assertEquals(a, b);
}
use of fr.lirmm.graphik.graal.api.core.ConjunctiveQuery in project graal by graphik-team.
the class LiteralsTest method booleanType.
@Theory
public void booleanType(AtomSet store) throws Exception {
Atom a = DlgpParser.parseAtom("<IS_HUMAN>(a,true).");
store.add(a);
ConjunctiveQuery q = new DefaultConjunctiveQuery(new LinkedListAtomSet(a), Collections.<Term>emptyList());
Assert.assertTrue(SmartHomomorphism.instance().execute(q, store).hasNext());
Atom b = store.iterator().next();
Assert.assertEquals(a, b);
}
use of fr.lirmm.graphik.graal.api.core.ConjunctiveQuery in project graal by graphik-team.
the class LiteralsTest method stringType.
@Theory
public void stringType(AtomSet store) throws Exception {
Atom a = DlgpParser.parseAtom("<NAME>(a,\"john\").");
store.add(a);
ConjunctiveQuery q = new DefaultConjunctiveQuery(new LinkedListAtomSet(a), Collections.<Term>emptyList());
Assert.assertTrue(SmartHomomorphism.instance().execute(q, store).hasNext());
Atom b = store.iterator().next();
Assert.assertEquals(a, b);
}
use of fr.lirmm.graphik.graal.api.core.ConjunctiveQuery in project graal by graphik-team.
the class LiteralsTest method decimalType.
@Theory
public void decimalType(AtomSet store) throws Exception {
Atom a = DlgpParser.parseAtom("<AGE>(a,-5.1).");
store.add(a);
ConjunctiveQuery q = new DefaultConjunctiveQuery(new LinkedListAtomSet(a), Collections.<Term>emptyList());
Assert.assertTrue(SmartHomomorphism.instance().execute(q, store).hasNext());
Atom b = store.iterator().next();
Assert.assertEquals(a, b);
}
use of fr.lirmm.graphik.graal.api.core.ConjunctiveQuery in project graal by graphik-team.
the class ConjunctiveQuery2Test method tttFalseQueryTest.
/**
* Test a boolean query
*/
@Theory
public void tttFalseQueryTest(Homomorphism<ConjunctiveQuery, AtomSet> h, AtomSet store) {
try {
store.addAll(DlgpParser.parseAtomSet("<P>(a,b),<P>(b,c),<Q>(a,c),<Q>(d,c)."));
ConjunctiveQuery query = DlgpParser.parseQuery("?(X,Y) :- <Q>(a,f),<P>(X,Y).");
CloseableIterator<Substitution> subReader;
subReader = h.execute(query, store);
Assert.assertFalse(subReader.hasNext());
subReader.close();
} catch (Exception e) {
Assert.assertTrue(e.getMessage(), false);
}
}
Aggregations