use of ai.grakn.graql.internal.pattern.property.SubProperty in project grakn by graknlabs.
the class GraqlTraversalTest method testAllTraversalsSimpleQuery.
@Test
public void testAllTraversalsSimpleQuery() {
IdProperty titanicId = IdProperty.of(ConceptId.of("Titanic"));
IdProperty movieId = IdProperty.of(ConceptId.of("movie"));
SubProperty subProperty = SubProperty.of(Patterns.varPattern(y, ImmutableSet.of(movieId)));
VarPattern pattern = Patterns.varPattern(x, ImmutableSet.of(titanicId, subProperty));
Set<GraqlTraversal> traversals = allGraqlTraversals(pattern).collect(toSet());
assertEquals(12, traversals.size());
Fragment xId = id(titanicId, x, ConceptId.of("Titanic"));
Fragment yId = id(movieId, y, ConceptId.of("movie"));
Fragment xSubY = outSub(subProperty, x, y);
Fragment ySubX = inSub(subProperty, y, x);
Set<GraqlTraversal> expected = ImmutableSet.of(traversal(xId, xSubY, yId), traversal(xId, ySubX, yId), traversal(xId, yId, xSubY), traversal(xId, yId, ySubX), traversal(xSubY, xId, yId), traversal(xSubY, yId, xId), traversal(ySubX, xId, yId), traversal(ySubX, yId, xId), traversal(yId, xId, xSubY), traversal(yId, xId, ySubX), traversal(yId, xSubY, xId), traversal(yId, ySubX, xId));
assertEquals(expected, traversals);
}
Aggregations