use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testMatchAll.
@Test
public void testMatchAll() {
Match query = qb.match(x);
// Make sure there a reasonable number of results
assertThat(query, iterableWithSize(greaterThan(10)));
// Make sure results never contain shards
assertThat(query, variable(x, everyItem(not(isShard()))));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method whenQueryingForRole_ResultContainsAllValidRoles.
@Test
public void whenQueryingForRole_ResultContainsAllValidRoles() {
// TODO: reasoner is not able to decompose and parse it correctly
Match query = qb.infer(false).match(var().rel(x, var().has("name", "Michael Corleone")));
assertThat(query, variable(x, containsInAnyOrder(role("role"), role("character-being-played"), role("@has-name-owner"))));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testRelatedToSelf.
@Test
public void testRelatedToSelf() {
Match query = qb.match(var().rel(x).rel(x).rel(x));
assertThat(query, emptyIterable());
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testPredicateQuery2.
@Test
public void testPredicateQuery2() {
Match query = qb.match(x.isa("movie").has("title", t), or(and(t.val(lte("Juno")), t.val(gte("Godfather")), t.val(neq("Heat"))), t.val("The Muppets")));
assertThat(query, variable(x, containsInAnyOrder(hocusPocus, godfather, theMuppets)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testIsResource.
@Test
public void testIsResource() {
Match query = qb.match(x.isa(Schema.MetaSchema.ATTRIBUTE.getLabel().getValue())).limit(10);
assertThat(query, iterableWithSize(10));
assertThat(query, variable(x, everyItem(hasType(resource))));
}
Aggregations