Search in sources :

Example 21 with InsertQuery

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);
}
Also used : InsertQuery(ai.grakn.graql.InsertQuery) Test(org.junit.Test)

Example 22 with InsertQuery

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);
}
Also used : InsertQuery(ai.grakn.graql.InsertQuery) Test(org.junit.Test)

Example 23 with InsertQuery

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);
}
Also used : InsertQuery(ai.grakn.graql.InsertQuery) Test(org.junit.Test)

Example 24 with InsertQuery

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();
        }
    }
}
Also used : InsertQuery(ai.grakn.graql.InsertQuery) BatchExecutorClient(ai.grakn.client.BatchExecutorClient)

Example 25 with InsertQuery

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);
}
Also used : InsertQuery(ai.grakn.graql.InsertQuery) Test(org.junit.Test)

Aggregations

InsertQuery (ai.grakn.graql.InsertQuery)31 Test (org.junit.Test)29 Answer (ai.grakn.graql.admin.Answer)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 QueryBuilder (ai.grakn.graql.QueryBuilder)3 GraknTx (ai.grakn.GraknTx)2 ConceptId (ai.grakn.concept.ConceptId)2 Entity (ai.grakn.concept.Entity)2 Label (ai.grakn.concept.Label)2 Relationship (ai.grakn.concept.Relationship)2 SchemaConcept (ai.grakn.concept.SchemaConcept)2 DeleteQuery (ai.grakn.graql.DeleteQuery)2 Graql (ai.grakn.graql.Graql)2 Graql.label (ai.grakn.graql.Graql.label)2 Graql.var (ai.grakn.graql.Graql.var)2 Match (ai.grakn.graql.Match)2 VarPattern (ai.grakn.graql.VarPattern)2 Conjunction (ai.grakn.graql.admin.Conjunction)2 PatternAdmin (ai.grakn.graql.admin.PatternAdmin)2 MovieKB (ai.grakn.test.kbs.MovieKB)2