use of ai.grakn.graql.DeleteQuery in project grakn by graknlabs.
the class QueryParserTest method whenParsingDeleteQueryWithNoArguments_ResultIsSameAsJavaGraql.
@Test
public void whenParsingDeleteQueryWithNoArguments_ResultIsSameAsJavaGraql() {
DeleteQuery expected = match(var("x").isa("movie").has("title", "The Title"), var("y").isa("movie")).delete();
DeleteQuery parsed = parse("match $x isa movie has title 'The Title'; $y isa movie; delete;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.DeleteQuery in project grakn by graknlabs.
the class DeleteQueryImplTest method deleteQueriesWithTheSameMatchAndVarsAreEqual.
@Test
public void deleteQueriesWithTheSameMatchAndVarsAreEqual() {
DeleteQuery query1 = DeleteQueryImpl.of(vars1, match1);
DeleteQuery query2 = DeleteQueryImpl.of(vars1, match1);
assertEquals(query1, query2);
assertEquals(query1.hashCode(), query2.hashCode());
}
use of ai.grakn.graql.DeleteQuery in project grakn by graknlabs.
the class DeleteQueryImplTest method deleteQueriesWithDifferentMatchesAreDifferent.
@Test
public void deleteQueriesWithDifferentMatchesAreDifferent() {
DeleteQuery query1 = DeleteQueryImpl.of(vars1, match1);
DeleteQuery query2 = DeleteQueryImpl.of(vars1, match2);
assertNotEquals(query1, query2);
}
use of ai.grakn.graql.DeleteQuery in project grakn by graknlabs.
the class QueryBuilderTest method whenBuildingDeleteQueryWithGraphLast_ItExecutes.
@Test
public void whenBuildingDeleteQueryWithGraphLast_ItExecutes() {
// Insert some data to delete
movieKB.tx().graql().insert(var().has("title", "123").isa("movie")).execute();
assertExists(movieKB.tx(), var().has("title", "123"));
DeleteQuery query = match(x.has("title", "123")).delete(x).withTx(movieKB.tx());
query.execute();
assertNotExists(movieKB.tx(), var().has("title", "123"));
}
use of ai.grakn.graql.DeleteQuery in project grakn by graknlabs.
the class QueryParserTest method whenParsingDeleteQuery_ResultIsSameAsJavaGraql.
@Test
public void whenParsingDeleteQuery_ResultIsSameAsJavaGraql() {
Var x = var("x");
Var y = var("y");
DeleteQuery expected = match(x.isa("movie").has("title", "The Title"), y.isa("movie")).delete(x, y);
DeleteQuery parsed = parse("match $x isa movie has title 'The Title'; $y isa movie; delete $x, $y;");
assertEquals(expected, parsed);
}
Aggregations