use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testOrQuery.
@Test
public void testOrQuery() {
GetQuery expected = match(var("x").isa("movie"), or(and(var("y").isa("genre").val("drama"), var().rel("x").rel("y")), var("x").val("The Muppets"))).get();
GetQuery parsed = parse("match $x isa movie; { $y isa genre val 'drama'; ($x, $y); } or $x val 'The Muppets'; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testMatchDataTypeQuery.
@Test
public void testMatchDataTypeQuery() {
GetQuery expected = match(var("x").datatype(AttributeType.DataType.DOUBLE)).get();
GetQuery parsed = parse("match $x datatype double; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method whenParsingDate_HandleTime.
@Test
public void whenParsingDate_HandleTime() {
GetQuery expected = match(var("x").has("release-date", LocalDateTime.of(1000, 11, 12, 13, 14, 15))).get();
GetQuery parsed = parse("match $x has release-date 1000-11-12T13:14:15; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testHasVariable.
@Test
public void testHasVariable() {
GetQuery expected = match(var().has("title", "Godfather").has("tmdb-vote-count", var("x"))).get();
GetQuery parsed = parse("match has title 'Godfather' has tmdb-vote-count $x; get;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.GetQuery in project grakn by graknlabs.
the class QueryParserTest method testRelationQuery.
@Test
public void testRelationQuery() {
GetQuery expected = match(var("brando").val("Marl B").isa("person"), var().rel("actor", "brando").rel("char").rel("production-with-cast", "prod")).get("char", "prod");
GetQuery parsed = parse("match\n" + "$brando val \"Marl B\" isa person;\n" + "(actor: $brando, $char, production-with-cast: $prod);\n" + "get $char, $prod;");
assertEquals(expected, parsed);
}
Aggregations