I have started trying to use the java api to automate some work. Is there a simple way to convert graql queries which I can run on the visualiser and shell into ones I can use with the java api.
For example the query:
match $x isa product
I see that I can write that as
match(var("x").isa("product"));
Is there no way to map the string format to the java format automatically?
I feel I am missing something simple.
Thanks,
Kieran.
You can use the QueryBuilder
https://grakn.ai/pages/documentation/developing-with-java/java-graql.html#query-parser
for (Concept x : qb.<MatchQuery>parse("match $x isa person;").get("x")) {
System.out.println(x);
}
if (qb.<AskQuery>parse("match has name 'Bob' isa person; ask;").execute())
{
System.out.println("There is someone called Bob!");
}
qb.parse("insert isa person, has firstname 'Alice';").execute();
qb.parse("match $x isa person; delete $x;").execute();