use of com.vaticle.typeql.lang.query.TypeQLQuery in project grakn by graknlabs.
the class StatisticsTest method setupSchema.
private void setupSchema(CoreDatabaseManager databaseMgr) {
try (TypeDB.Session session = databaseMgr.session(database, Arguments.Session.Type.SCHEMA)) {
try (TypeDB.Transaction tx = session.transaction(Arguments.Transaction.Type.WRITE)) {
TypeQLQuery query = TypeQL.parseQuery("" + "define " + "person sub entity, owns age; " + "age sub attribute, value long; " + "");
tx.query().define(query.asDefine());
tx.commit();
}
}
}
use of com.vaticle.typeql.lang.query.TypeQLQuery in project typeql-lang-java by vaticle.
the class ParserTest method testParseList.
@Test
public void testParseList() {
final String insertString = "insert\n$x isa movie;";
final String getString = "match\n$y isa movie;";
List<TypeQLQuery> queries = TypeQL.parseQueries(insertString + getString).collect(toList());
assertEquals(list(insert(var("x").isa("movie")), match(var("y").isa("movie"))), queries);
}
use of com.vaticle.typeql.lang.query.TypeQLQuery in project typeql-lang-java by vaticle.
the class TypeQLQueryTest method assertValidToString.
private void assertValidToString(TypeQLQuery query) {
// No need to execute the insert query
TypeQLQuery parsedQuery = TypeQL.parseQuery(query.toString());
assertEquals(query.toString(), parsedQuery.toString());
}
use of com.vaticle.typeql.lang.query.TypeQLQuery in project typeql-lang-java by vaticle.
the class ParserTest method testParseListOneInsert.
@Test
public void testParseListOneInsert() {
final String insertString = "insert\n$x isa movie;";
List<TypeQLQuery> queries = TypeQL.parseQueries(insertString).collect(toList());
assertEquals(list(insert(var("x").isa("movie"))), queries);
}
use of com.vaticle.typeql.lang.query.TypeQLQuery in project typeql-lang-java by vaticle.
the class ParserTest method testParseListOneInsertWithPrefixComment.
@Test
public void testParseListOneInsertWithPrefixComment() {
final String insertString = "#hola\ninsert $x isa movie;";
List<TypeQLQuery> queries = TypeQL.parseQueries(insertString).collect(toList());
assertEquals(list(insert(var("x").isa("movie"))), queries);
}
Aggregations