use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchModifierTest method testOrPatternOrderByUnselected.
@Test
public void testOrPatternOrderByUnselected() {
Match match = qb.match(x.isa("movie"), var().rel(x).rel(y), or(y.isa("person"), y.isa("genre").val(neq("crime"))), y.has("name", n)).orderBy(n);
assertResultsOrderedByValue(match, n, true);
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchModifierTest method whenGettingAVarNotInQuery_Throw.
@Test
public void whenGettingAVarNotInQuery_Throw() {
Match match = qb.match(x.isa("movie"));
exception.expect(GraqlQueryException.class);
exception.expectMessage(VARIABLE_NOT_IN_QUERY.getMessage(y));
// noinspection ResultOfMethodCallIgnored
match.get(ImmutableSet.of(y));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchModifierTest method testOrPatternOrderByResource.
@Test
public void testOrPatternOrderByResource() {
Match match = qb.match(x.isa("movie").has("tmdb-vote-count", var("v")), var().rel(x).rel(y), or(y.isa("person").has("name", "Marlon Brando"), y.isa("genre").has("name", "crime"))).orderBy("v", desc);
assertThat(match, variable(x, contains(godfather, godfather, apocalypseNow)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchModifierTest method testOrPatternDistinct.
@Test
public void testOrPatternDistinct() {
Match match = qb.match(x.isa("movie").has("title", var("t")), var().rel(x).rel(y), or(y.isa("genre").has("name", "crime"), y.isa("person").has("name", "Marlon Brando"))).orderBy("t", desc);
assertThat(match, variable(x, contains(heat, godfather, godfather, apocalypseNow)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchModifierTest method testOffsetQuery.
@Test
public void testOffsetQuery() {
Match match = qb.match(x.isa("movie").has("name", n)).orderBy(n, desc).offset(4);
assertResultsOrderedByValue(match, n, false);
}
Aggregations