use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testRobertDeNiroNotRelatedToSelfWhenMetaRoleIsSpecified.
@Test
public void testRobertDeNiroNotRelatedToSelfWhenMetaRoleIsSpecified() {
// This can go wrong because one role-player may use a shortcut edge and the other may not
Match query = qb.match(var().rel("role", x).rel("actor", y).isa("has-cast"), y.has("name", "Robert de Niro"));
assertThat(query, variable(x, containsInAnyOrder(heat, neilMcCauley)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testAllowedToReferToNonExistentRoleplayer.
@Test
public void testAllowedToReferToNonExistentRoleplayer() {
Match query = qb.match(var().rel("actor", var().id(ConceptId.of("999999999999999999"))));
assertThat(query, emptyIterable());
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testRegexQuery.
@Test
public void testRegexQuery() {
Match query = qb.match(x.isa("genre").has("name", regex("^f.*y$")));
assertThat(query, variable(x, containsInAnyOrder(family, fantasy)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testSubSelf.
@Test
public void testSubSelf() {
Match query = qb.match(label("movie").sub(x));
assertThat(query, variable(x, containsInAnyOrder(movie, production, entity, concept)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testQueryNoVariables.
@Test
public void testQueryNoVariables() {
Match query = qb.match(x.isa("movie"));
assertThat(query, allOf((Matcher) everyItem(not(hasKey(anything()))), iterableWithSize(movies.size())));
}
Aggregations