use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testRoleQuery.
@Test
public void testRoleQuery() {
Match query = qb.match(var().rel("actor", x).rel(y), y.has("title", "Apocalypse Now"));
assertThat(query, variable(x, containsInAnyOrder(marlonBrando, martinSheen)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testMatchRuleRightHandSide.
@Test
public void testMatchRuleRightHandSide() {
Match query = qb.match(x.when(qb.parser().parsePattern("$x id 'expect-when'")).then(qb.parser().parsePattern("$x id 'expect-then'")));
expectedException.expect(UnsupportedOperationException.class);
expectedException.expectMessage(MATCH_INVALID.getMessage("when"));
query.forEach(r -> {
});
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testGlobalPredicateQuery.
@Test
public void testGlobalPredicateQuery() {
Match query = qb.match(x.val(gt(500L)), x.val(lt(1000000L)));
assertThat(query, variable(x, contains(both(hasValue(1000L)).and(hasType(tmdbVoteCount)))));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testTypeLabelQuery.
@Test
public void testTypeLabelQuery() {
Match query = qb.match(or(x.label("character"), x.label("person")));
assertThat(query, variable(x, containsInAnyOrder(character, person)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testDatePredicateQuery.
@Test
public void testDatePredicateQuery() throws ParseException {
Match query = qb.match(x.has("release-date", gte(LocalDateTime.of(1984, 6, 23, 12, 34, 56))));
assertThat(query, variable(x, containsInAnyOrder(spy, theMuppets, chineseCoffee)));
}
Aggregations