use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryValidityTest method whenQueryingForIllegalResource_emptyResultReturned.
@Test
public void whenQueryingForIllegalResource_emptyResultReturned() {
QueryBuilder qb = testContext.tx().graql().infer(true);
String queryString = "match $x has name $n; $x isa binary; get;";
assertThat(qb.<GetQuery>parse(queryString).execute(), empty());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryValidityTest method whenQueryingForInexistentResourceId_emptyResultReturned.
@Test
public void whenQueryingForInexistentResourceId_emptyResultReturned() {
QueryBuilder qb = testContext.tx().graql().infer(true);
String queryString = "match $x has name $y; $x id 'V123'; get;";
String queryString2 = "match $x has name $y; $y id 'V123'; get;";
String queryString3 = "match $x has name $y via $r; $r id 'V123'; get;";
assertThat(qb.<GetQuery>parse(queryString).execute(), empty());
assertThat(qb.<GetQuery>parse(queryString2).execute(), empty());
assertThat(qb.<GetQuery>parse(queryString3).execute(), empty());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryValidityTest method whenQueryingForInexistentEntityTypeId_emptyResultReturned.
@Test
public void whenQueryingForInexistentEntityTypeId_emptyResultReturned() {
QueryBuilder qb = testContext.tx().graql().infer(true);
String queryString = "match $x isa $type; $type id 'V123'; get;";
assertThat(qb.<GetQuery>parse(queryString).execute(), empty());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryValidityTest method whenQueryingForInexistentRelationTypeLabelViaVariable_emptyResultReturned.
@Test
public void whenQueryingForInexistentRelationTypeLabelViaVariable_emptyResultReturned() {
QueryBuilder qb = testContext.tx().graql().infer(true);
String queryString = "match ($x, $y) isa $type; $type label jakas-relacja; get;";
assertThat(qb.<GetQuery>parse(queryString).execute(), empty());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class GenealogyTest method testGrandParentship.
@Test
public void testGrandParentship() {
String queryString = "match " + "(grandchild: $x); (granddaughter: $x);$x has gender $g; get;";
GetQuery query = iqb.parse(queryString);
List<Answer> answers = query.execute();
assertEquals(answers.size(), 18);
assertTrue(checkResource(answers, "g", "female"));
assertCollectionsEqual(answers, qb.<GetQuery>parse(queryString).execute());
}
Aggregations