2.7. The Trovares Query Language (TQL)¶
At this point you have loaded data into the system and defined vertex and edge frames with their associated schemas in order to represent your data as a graph. This document discusses how to phrase and ask interesting queries on graph data stored in the xGT system.
The Trovares Query Language (TQL) uses a subset of the Cypher language to express queries. The supported subset of Cypher enables powerful and expressive queries, while taking advantage of xGT’s strongly typed graph elements in order to achieve very high performance and scalability.
A TQL query consists of a combination of the following components, all of which are optional:
structure (description of the “shape” of the pattern).
constraints on the graph elements.
unwind the elements in a list.
call a procedure.
modifications to the graph elements’ properties.
additions to the graph topology itself.
deletions from the graph topology itself.
query part separator (required if it contains multiple parts).
description of the final results set.
solution modifiers (including ordering & limiting results).
union subquery separator (required if query contains multiple union subqueries).
results table to store the query results in.
TQL’s Cypher subset has specific syntax for each component of a query:
MATCH "structure"
WHERE "constraints on graph elements"
OPTIONAL MATCH "structure"
UNWIND "list"
CALL "procedure" [YIELD]
SET "property modifications"
MERGE "additions of vertices"
CREATE "additions of vertices and edges"
DETACH DELETE "deletions of vertices"
DELETE "deletions of edges"
WITH "query part separator"
RETURN "description of the results set"
"solution modifiers"
UNION/UNION ALL "union subquery separator"
INTO "results table name"
Note that if there are no constraints supplied, the WHERE
keyword should not be present in the query.
We describe each of these components in detail in later sections.