use of ai.grakn.graql.InsertQuery in project grakn by graknlabs.
the class QueryParserTest method testInsertIsAbstractQuery.
@Test
public void testInsertIsAbstractQuery() {
InsertQuery expected = insert(label("concrete-type").sub("entity"), label("abstract-type").isAbstract().sub("entity"));
InsertQuery parsed = parse("insert concrete-type sub entity; abstract-type is-abstract sub entity;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.InsertQuery in project grakn by graknlabs.
the class QueryParserTest method testInsertQuery.
@Test
public void testInsertQuery() {
InsertQuery expected = insert(var().isa("movie").has("title", "The Title"));
InsertQuery parsed = parse("insert isa movie has title 'The Title';");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.InsertQuery in project grakn by graknlabs.
the class QueryParserTest method testInsertDataTypeQuery.
@Test
public void testInsertDataTypeQuery() {
InsertQuery expected = insert(label("my-type").sub("resource").datatype(AttributeType.DataType.LONG));
InsertQuery parsed = parse("insert my-type sub resource, datatype long;");
assertEquals(expected, parsed);
}
use of ai.grakn.graql.InsertQuery in project grakn by graknlabs.
the class BenchmarkIT method loadEntities.
private void loadEntities(String entityLabel, int N, GraknClient graknClient, Keyspace keyspace) {
try (BatchExecutorClient loader = BatchExecutorClient.newBuilder().taskClient(graknClient).build()) {
for (int i = 0; i < N; i++) {
InsertQuery entityInsert = Graql.insert(var().asUserDefined().isa(entityLabel));
loader.add(entityInsert, keyspace).subscribe();
}
}
}
use of ai.grakn.graql.InsertQuery in project grakn by graknlabs.
the class InsertQueryImplTest method insertQueriesWithDifferentVarsAreDifferent.
@Test
public void insertQueriesWithDifferentVarsAreDifferent() {
InsertQuery query1 = InsertQueryImpl.create(vars1, match1, Optional.empty());
InsertQuery query2 = InsertQueryImpl.create(vars2, match1, Optional.empty());
assertNotEquals(query1, query2);
}
Aggregations