use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method whenQueryingForSameRoleTwice_DoNotReturnDuplicateRolePlayers.
@Test
public void whenQueryingForSameRoleTwice_DoNotReturnDuplicateRolePlayers() {
Match query = qb.match(var().rel("cluster-of-production", x).rel("cluster-of-production", y));
query.forEach(result -> {
assertNotEquals(result.get(x), result.get(y));
});
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testNameQuery.
@Test
public void testNameQuery() {
Match query = qb.match(x.has("title", "Godfather"));
assertThat(query, variable(x, contains(godfather)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method whenQueryingForSuperRoleType_ReturnResults.
@Test
public void whenQueryingForSuperRoleType_ReturnResults() {
Match query = qb.match(var().rel("role", x).rel(y));
assertExists(query);
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method whenQueryingForSuperRelationType_ReturnResults.
@Test
public void whenQueryingForSuperRelationType_ReturnResults() {
Match query = qb.match(var().isa(Schema.MetaSchema.RELATIONSHIP.getLabel().getValue()).rel(x).rel(y));
assertExists(query);
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testAllGreaterThanResources.
@Test
public void testAllGreaterThanResources() {
Match query = qb.match(x.val(gt(y)));
assertThat(query, iterableWithSize(greaterThan(10)));
query.forEach(result -> {
Comparable cx = (Comparable) result.get(x).asAttribute().getValue();
Comparable cy = (Comparable) result.get(y).asAttribute().getValue();
assertThat(cx, greaterThan(cy));
});
}
Aggregations