use of fr.lirmm.graphik.graal.api.core.Substitution in project graal by graphik-team.
the class SubstitutionTest method aggregateTest1.
@Theory
public void aggregateTest1(Substitution s1, Substitution s2) {
s1.put(Y, A);
s1.put(Z, A);
s2.put(X, Y);
s2.put(Y, Z);
Substitution aggregation = s1.aggregate(s2);
Assert.assertNotNull(aggregation);
Assert.assertEquals(A, aggregation.createImageOf(X));
Assert.assertEquals(A, aggregation.createImageOf(Y));
Assert.assertEquals(A, aggregation.createImageOf(Z));
}
use of fr.lirmm.graphik.graal.api.core.Substitution in project graal by graphik-team.
the class SubstitutionTest method aggregateImpossibleTest1.
@Theory
public void aggregateImpossibleTest1(Substitution s1, Substitution s2) {
s1.put(X, A);
s2.put(X, B);
Substitution aggregation = s1.aggregate(s2);
Assert.assertNull(aggregation);
}
use of fr.lirmm.graphik.graal.api.core.Substitution in project graal by graphik-team.
the class SubstitutionTest method aggregateImpossibleTest2.
@Theory
public void aggregateImpossibleTest2(Substitution s1, Substitution s2) {
s1.put(X, Z);
s1.put(Y, Z);
s2.put(X, A);
s2.put(Y, B);
Substitution aggregation = s1.aggregate(s2);
Assert.assertNull(aggregation);
}
use of fr.lirmm.graphik.graal.api.core.Substitution in project graal by graphik-team.
the class SubstitutionTest method compositionTest1.
@Theory
public void compositionTest1(Substitution s1, Substitution s2) {
s1.put(X, Y);
s1.put(S, T);
s2.put(Y, Z);
s2.put(U, V);
Substitution comp = s2.compose(s1);
System.out.println(comp);
Assert.assertEquals(Z, comp.createImageOf(X));
Assert.assertEquals(Z, comp.createImageOf(Y));
Assert.assertEquals(Z, comp.createImageOf(Z));
Assert.assertEquals(T, comp.createImageOf(S));
Assert.assertEquals(V, comp.createImageOf(U));
}
use of fr.lirmm.graphik.graal.api.core.Substitution in project graal by graphik-team.
the class AbstractHomomorphism method exist.
// /////////////////////////////////////////////////////////////////////////
// PUBLIC METHODS
// /////////////////////////////////////////////////////////////////////////
@Override
public boolean exist(T1 q, T2 a) throws HomomorphismException {
CloseableIterator<Substitution> results = this.execute(q, a);
boolean val;
try {
val = results.hasNext();
} catch (IteratorException e) {
throw new HomomorphismException(e);
}
results.close();
return val;
}
Aggregations