Graql enables users to write queries against a Grakn knowledge base leveraging the inherent semantics of the data. Concepts can be retrieved by specifying the patterns of types and relationships that identify them. Graql is declarative and therefore it handles the optimisation of the knowledge base queries needed to retrieve information.
There are several types of queries, which are begun with the following keywords:
- get - for finding patterns in the knowledge base
- define - for defining schema concepts
- insert - for inserting data
- delete - for deleting schema concepts and data
- compute - for computing useful information about your knowledge base
The following list Graql’s reserved keywords:
Querying and query modifiers
aggregate, asc, ask by compute, contains delete, desc, distinct from id, in, insert label, limit match offset, order regex select to val
datatype boolean, double, long, string, date true, false
has, is-abstract, isa, key, plays, relates
count group max, mean, median, min std, sum
and concat do else, elseif for if, in noescp, not, null true, false
If you are already familiar with Graql, you may find our cheatsheet reference a helpful page to bookmark or print out!