use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method whenQueryingForXSubY_ReturnOnlyTypes.
@Test
public void whenQueryingForXSubY_ReturnOnlyTypes() {
Match query = qb.match(x.sub(y));
assertThat(query, variable(x, everyItem(not(isInstance()))));
assertThat(query, variable(y, everyItem(not(isInstance()))));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testMatchKey.
@Test
public void testMatchKey() {
Match query = qb.match(x.key("name"));
assertThat(query, variable(x, contains(genre)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testSchemaQuery.
@Test
public void testSchemaQuery() {
Var type = var("type");
Match query = qb.match(type.plays("character-being-played"));
assertThat(query, variable(type, containsInAnyOrder(character, person)));
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method whenQueryingForSameRoleTwiceWhenItIsPlayedOnce_ReturnNoResults.
@Test
public void whenQueryingForSameRoleTwiceWhenItIsPlayedOnce_ReturnNoResults() {
Match query = qb.match(var().rel("actor", x).rel("actor", y));
assertThat(query, emptyIterable());
}
use of ai.grakn.graql.Match in project grakn by graknlabs.
the class MatchTest method testMatchAllDistinctPairsOfACertainType.
@Test
public void testMatchAllDistinctPairsOfACertainType() {
int numConcepts = (int) qb.match(x.isa("movie")).stream().count();
Match pairs = qb.match(x.isa("movie"), y.isa("movie"), x.neq(y));
assertThat(pairs, iterableWithSize(numConcepts * (numConcepts - 1)));
}
Aggregations