use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class GenealogyTest method testMotherInLaw.
@Test
public void testMotherInLaw() {
String queryString = "match (mother-in-law: $x);$x has gender $g; get;";
String queryString2 = "match (parent-in-law: $x, child-in-law: $y) isa in-laws;$x has gender $g;$g val 'female'; get $x, $g;";
GetQuery query = iqb.parse(queryString);
GetQuery query2 = iqb.parse(queryString2);
List<Answer> answers = query.execute();
List<Answer> answers2 = query2.execute();
assertEquals(answers.size(), 8);
assertCollectionsEqual(answers, answers2);
assertTrue(checkResource(answers, "g", "female"));
assertCollectionsEqual(answers, qb.<GetQuery>parse(queryString).execute());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class GenealogyTest method testMarriage_definedViaTypeAndRelationVariable.
@Test
public void testMarriage_definedViaTypeAndRelationVariable() {
String queryString = "match $x isa marriage; get;";
String queryString2 = "match $x($x1, $x2) isa marriage;get $x;";
GetQuery query = iqb.parse(queryString);
GetQuery query2 = iqb.parse(queryString2);
// requery
String qs = "match ($x, $y) isa marriage; ($y, $z) isa marriage; get;";
iqb.parse(qs).execute();
List<Answer> answers = query.execute();
assertEquals(answers.size(), 66);
List<Answer> answers2 = query2.execute();
assertCollectionsEqual(answers, answers2);
assertEquals(answers2.size(), 66);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class GenealogyTest method testMother.
@Test
public void testMother() {
String queryString = "match (mother: $x); get;";
GetQuery query = iqb.parse(queryString);
List<Answer> answers = query.execute();
assertEquals(answers.size(), 9);
assertCollectionsEqual(answers, qb.<GetQuery>parse(queryString).execute());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class GenealogyTest method testChild.
@Test
public void testChild() {
String queryString = "match (child: $x); get;";
GetQuery query = iqb.parse(queryString);
List<Answer> answers = query.execute();
assertEquals(answers.size(), 38);
assertCollectionsEqual(answers, qb.<GetQuery>parse(queryString).execute());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryToStringTest method testQueryToStringWithReservedKeywords.
@Test
public void testQueryToStringWithReservedKeywords() {
GetQuery query = qb.match(var("x").isa("isa")).get();
assertEquals("match $x isa \"isa\"; get $x;", query.toString());
}
Aggregations