use of ai.grakn.graql.QueryBuilder 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.QueryBuilder in project grakn by graknlabs.
the class QueryValidityTest method whenQueryingForRelationWithNonExistentRoles_Throws.
@Test
public void whenQueryingForRelationWithNonExistentRoles_Throws() throws GraqlQueryException {
QueryBuilder qb = testContext.tx().graql().infer(true);
String queryString = "match (rola: $x, rola: $y) isa relationship; get;";
expectedException.expect(GraqlQueryException.class);
qb.<GetQuery>parse(queryString).execute();
}
use of ai.grakn.graql.QueryBuilder 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.QueryBuilder in project grakn by graknlabs.
the class QueryValidityTest method whenQueryingForRelationWithNonRoleRoles_Throws.
@Test
public void whenQueryingForRelationWithNonRoleRoles_Throws() throws GraqlQueryException {
QueryBuilder qb = testContext.tx().graql().infer(true);
String queryString = "match (entity: $x, entity: $y) isa relationship; get;";
expectedException.expect(GraqlQueryException.class);
qb.<GetQuery>parse(queryString).execute();
}
use of ai.grakn.graql.QueryBuilder 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());
}
Aggregations