use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testLongComparatorQuery.
@Test
public void testLongComparatorQuery() throws ParseException {
GetQuery expected = match(var("x").isa("movie").has("tmdb-vote-count", lte(400))).get();
GetQuery parsed = parse("match $x isa movie, has tmdb-vote-count <= 400; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testPredicateQuery2.
@Test
public void testPredicateQuery2() {
GetQuery expected = match(var("x").isa("movie").has("title", var("t")), or(and(var("t").val(lte("Juno")), var("t").val(gte("Godfather")), var("t").val(neq("Heat"))), var("t").val("The Muppets"))).get();
GetQuery parsed = parse("match $x isa movie, has title $t;" + "{$t val <= 'Juno'; $t val >= 'Godfather'; $t val != 'Heat';} or $t val = 'The Muppets'; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method whenParsingDate_HandleBigYears.
@Test
public void whenParsingDate_HandleBigYears() {
GetQuery expected = match(var("x").has("release-date", LocalDate.of(12345, 12, 25).atStartOfDay())).get();
GetQuery parsed = parse("match $x has release-date +12345-12-25; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testModifierQuery.
@Test
public void testModifierQuery() {
GetQuery expected = match(var("y").isa("movie").has("title", var("n"))).orderBy("n").limit(4).offset(2).get();
GetQuery parsed = parse("match $y isa movie, has title $n; order by $n; limit 4; offset 2; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testQueryParserWithoutGraph.
@Test
public void testQueryParserWithoutGraph() {
String queryString = "match $x isa movie; get $x;";
GetQuery query = parse("match $x isa movie; get $x;");
assertEquals(queryString, query.toString());
}
Aggregations