use of fr.lirmm.graphik.graal.api.store.TripleStore in project graal by graphik-team.
the class ConjunctiveQuery2Test method wrongArityQuery2.
@Theory
public void wrongArityQuery2(Homomorphism<ConjunctiveQuery, AtomSet> h, AtomSet store) {
Assume.assumeFalse(store instanceof TripleStore);
try {
store.add(DlgpParser.parseAtom("<P>(a,b)."));
ConjunctiveQuery query = DlgpParser.parseQuery("? :- <P>(X,Y,Z).");
CloseableIterator<Substitution> subReader;
subReader = h.execute(query, store);
Assert.assertFalse(subReader.hasNext());
subReader.close();
} catch (Exception e) {
Assert.assertTrue(e.getMessage(), false);
}
}
use of fr.lirmm.graphik.graal.api.store.TripleStore in project graal by graphik-team.
the class StoreTest method match3.
@Theory
public void match3(AtomSet store) throws AtomSetException, IteratorException, ParseException, HomomorphismException {
Assume.assumeFalse(store instanceof TripleStore);
Atom a1 = DlgpParser.parseAtom("<P>(a,a,a).");
Atom a2 = DlgpParser.parseAtom("<P>(a,c,c).");
store.add(DlgpParser.parseAtom("<P>(b,a,a)."));
store.add(DlgpParser.parseAtom("<P>(a,a,a)."));
store.add(DlgpParser.parseAtom("<P>(a,c,b)."));
store.add(DlgpParser.parseAtom("<P>(a,c,c)."));
store.add(DlgpParser.parseAtom("<Q>(b,a,c)."));
store.add(DlgpParser.parseAtom("<Q>(a,b,b)."));
Atom q = DlgpParser.parseAtom("<P>(a,X,X).");
CloseableIterator<Atom> it = store.match(q);
int cpt = 0;
while (it.hasNext()) {
++cpt;
Atom a = it.next();
Assert.assertTrue(a.equals(a1) || a.equals(a2));
}
Assert.assertEquals(2, cpt);
}
use of fr.lirmm.graphik.graal.api.store.TripleStore in project graal by graphik-team.
the class NoTripleStoreTest method termsOrder.
@Theory
public void termsOrder(AtomSet store) throws AtomSetException, IteratorException, ParseException {
Assume.assumeFalse(store instanceof TripleStore);
Atom a1 = DlgpParser.parseAtom("<P>(a,b,c,d,e,f).");
Atom a2 = DlgpParser.parseAtom("<P>(f,e,d,c,b,a).");
store.add(a1);
store.add(a1);
store.add(a2);
CloseableIterator<Atom> it = store.iterator();
while (it.hasNext()) {
Atom a = it.next();
Assert.assertTrue(a.equals(a1) || a.equals(a2));
}
}
use of fr.lirmm.graphik.graal.api.store.TripleStore in project graal by graphik-team.
the class NoTripleStoreTest method arityTest.
@Theory
public void arityTest(AtomSet store) throws AtomSetException, IteratorException, ParseException {
Assume.assumeFalse(store instanceof TripleStore);
Atom toAdd = DlgpParser.parseAtom("<P>(a).");
Predicate toCheck = new Predicate("P", 2);
store.add(toAdd);
CloseableIterator<?> it = store.termsByPredicatePosition(toCheck, 1);
Assert.assertFalse(it.hasNext());
it = store.atomsByPredicate(toCheck);
Assert.assertFalse(it.hasNext());
it = store.match(DlgpParser.parseAtom("<p>(X,Y)."));
Assert.assertFalse(it.hasNext());
}
use of fr.lirmm.graphik.graal.api.store.TripleStore in project graal by graphik-team.
the class ConjunctiveQueryFixedBugTest method issue52Bis.
@Theory
public void issue52Bis(Homomorphism<ConjunctiveQuery, AtomSet> h, AtomSet store) {
Assume.assumeFalse(store instanceof TripleStore);
try {
store.addAll(DlgpParser.parseAtomSet("<P0>(a,b),<P1>(b,a),<P1>(d,b),<R>(b,c,c),<R>(b,d,d)."));
ConjunctiveQuery query = DlgpParser.parseQuery("?(X0,X1,X2,X3,X4,X5) :- <P0>(X0,X3), <R>(X3,X4,X5), <P1>(X4,X2), <P1>(X5,X1).");
Assert.assertTrue(h.exist(query, store));
} catch (Exception e) {
Assert.assertTrue(e.getMessage(), false);
}
}
Aggregations