use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryToStringTest method testComplexQueryToString.
@Test
public void testComplexQueryToString() {
GetQuery query = qb.match(var("x").isa("movie"), var().rel("x").rel("y"), or(var("y").isa("person"), var("y").isa("genre").val(neq("crime"))), var("y").has("name", var("n"))).orderBy("n").limit(8).offset(4).get("x", "y");
assertEquivalent(query, query.toString());
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method whenParsingDateKeyword_ParseAsTheCorrectDataType.
@Test
public void whenParsingDateKeyword_ParseAsTheCorrectDataType() {
GetQuery expected = match(var("x").datatype(AttributeType.DataType.DATE)).get();
GetQuery parsed = parse("match $x datatype date; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testSchemaQuery.
@Test
public void testSchemaQuery() {
GetQuery expected = match(var("x").plays("actor")).orderBy("x").get();
GetQuery parsed = parse("match $x plays actor; order by $x asc; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testRegexResourceType.
@Test
public void testRegexResourceType() {
GetQuery expected = match(var("x").regex("(fe)?male")).get();
GetQuery parsed = parse("match $x regex /(fe)?male/; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testOrderQuery.
@Test
public void testOrderQuery() {
GetQuery expected = match(var("x").isa("movie").has("release-date", var("r"))).orderBy("r", desc).get();
GetQuery parsed = parse("match $x isa movie, has release-date $r; order by $r desc; get;");
assertEquals(expected, parsed);
}
Aggregations