TQL MANUAL
TQL Overview
The Trovares Query Language (TQL) is a query language designed to interact with the Trovares xGT platform. xGT provides property graph analytics capabilities designed to scale to very large systems.
TQL Data Types
TQL supports the following datatypes and is case-insensitive in nature
- BOOLEAN
- DATE
- FLOAT
- INT
- IPADDRESS
- TEXT
- TIME
- DATETIME
TQL Commands
TQL supports the following commands: CREATE, DROP, INGEST, EGEST, and MATCH. These commands can be grouped together based on their functions.
DDL (Data Definition Language)
COMMAND | DESCRIPTION |
---|---|
CREATE TABLE | Creates a new table and inserts it into the xGT catalog. |
CREATE GRAPH (General Graph) |
|
DROP TABLE | Deletes the table if it exists and all of its rows from the xGT catalog. |
DROP VERTEX | Deletes the vertex if it exists type and all of its instances from the xGT catalog. |
DROP EDGE | Deletes the edge type if it exists and all of its instances from the xGT catalog. |
DROP GRAPH | Deletes the General Graph if it exists and all of its vertices and edges from the xGT catalog. |
DML (Data Manipulation Language)
COMMAND | DESCRIPTION |
---|---|
INGEST |
|
EGEST |
|
Query Commands
COMMAND | DESCRIPTION |
---|---|
MATCH |
|
TQL Commands Syntax
CREATE TABLE
CREATE TABLE [table name] ( col type, ... )
Example:
CREATE TABLE SampleTable (col1 INT, col2 TEXT)
CREATE GRAPH (General Graph)
CREATE GRAPH [general graph name]
VERTICES ( [vertex type name I] (colName coltype,...,KEY(colName,...)), [vertex type name II] (...), ...)
EDGES ( [edge type name I] ( columnName coltype,..., SOURCE KEY (edge column1 = vertex type name.vertex key AND edge column2 = vertex type name.vertex type key), TARGET KEY (edge column3 = vertex type name.vertex type key )), [edge type name II] (...),...)
Example:
CREATE GRAPH SampleGeneralGraph
VERTICES (
Person(personID INT, DOB date, name text, KEY(personID, DOB)) )
EDGES (
Parent(parentID int, childID int, parentDOB date, childDOB date,
SOURCE KEY(parentID = Person.personID,
parentDOB = Person.DOB),
TARGET KEY(childID = Person.personID,
childDOB = Person.DOB)) );
DROP TABLE
DROP TABLE [tableName]
Example:
DROP TABLE SampleTable
DROP VERTEX
DROP VERTEX [vertex type name]
Example:
DROP VERTEX SampleVertex
DROP EDGE
DROP EDGE [edge type name]
Example:
DROP EDGE SampleEdge
DROP GRAPH
DROP GRAPH [graph name]
Example:
DROP GRAPH SampleGraph
INGEST
INGEST HEADERMODE(N) INTO [table name] FROM [UNIX path] | "[URL path]"
INGEST INTO [table name] FROM [UNIX path] | "[URL path]"
INGEST INTO [table name] FROM "[path]", "[path]", "[path]", ...
Example:
INGEST INTO SampleTable FROM ./directory/data.txt
INGEST INTO SampleTable FROM "http://www.foo.com/directory/data.txt"
INGEST HEADERMODE(N) INTO [vertex type name] FROM [UNIX path] | "[URL path]"
INGEST INTO [vertex type name] FROM [UNIX path] | "[URL path]"
INGEST INTO [vertex type name] FROM "[path]", "[path]", "[path]", ...
Example:
INGEST INTO SampleVertex FROM ./directory/data.txt
INGEST INTO SampleVertex FROM "http://www.foo.com/directory/data.txt"
INGEST HEADERMODE(N) INTO [edge type name] FROM [UNIX path] | "[URL path]"
INGEST INTO [edge type name] FROM [UNIX path] | "[URL path]"
INGEST INTO [edge type name] FROM "[path]", "[path]", "[path]", ...
Example:
INGEST INTO SampleEdge FROM ./directory/data.txt
INGEST INTO SampleEdge FROM "http://www.foo.com/directory/data.txt"
EGEST
EGEST FROM [table name] INTO [UNIX path]
EGEST WITH HEADERS FROM [table name] INTO [UNIX path]
Example:
EGEST FROM SampleTable INTO ./directory/data.txt
MATCH
MATCH [Cypher path query] INTO [table name]
Example:
MATCH (s:SampleVertex1)-[r:SampleEdge]->(d:SampleVertex2)
WHERE s.Col1 = 99
RETURN s.Col2, d.Col3
INTO ResultTable