Skip to main content

Module property_graph

Module property_graph 

Source
Expand description

The table clauses of CREATE PROPERTY GRAPH: SQL/PGQ’s element tables (#295).

CREATE [OR REPLACE] PROPERTY GRAPH [IF NOT EXISTS] name
  [VERTEX TABLES ( vertex_table [, …] )]
  [EDGE TABLES ( edge_table [, …] )]

vertex_table := table [AS name] [KEY (column)] [labels]
edge_table   := table [AS name] [KEY (column)]
                SOURCE KEY (column) [REFERENCES vertex (column)]
                DESTINATION KEY (column) [REFERENCES vertex (column)]
                [labels]
labels       := properties                       -- the default label
              | DEFAULT LABEL [properties]
              | LABEL name [properties] [LABEL name [properties] …]
              | properties LABEL name [LABEL name …]   (DuckPGQ's order)
properties   := PROPERTIES (column [AS name], …)
              | PROPERTIES [ARE] ALL COLUMNS [EXCEPT (column, …)]
              | NO PROPERTIES

At least one of the two clauses is needed. Ursa’s relaxation stays: a graph may have no vertex tables, and then its nodes are its edges’ endpoints. A vertex KEY may be left out: the engine takes the table’s primary key, or the column the edges’ REFERENCES name, as DuckPGQ does. REFERENCES names a vertex table by its element name (its AS name, or else the table’s name). Still refused, with a clear error: multi-column keys, SOURCE vertex without KEY, and property expressions other than a column. NODE TABLES and RELATIONSHIP TABLES, SQL/PGQ’s synonyms, are accepted.

Structs§

EdgeTableDef
One entry of EDGE TABLES (…).
EndpointDef
KEY (key) [REFERENCES table (column)], after SOURCE or DESTINATION.
LabelDef
One label of an element table and its properties. name: None is the default label (written DEFAULT LABEL, or implied by a bare PROPERTIES clause), which is the element table’s name.
References
REFERENCES vertex (column): a vertex table’s element name or table name.
VertexTableDef
One entry of VERTEX TABLES (…).

Enums§

PropertiesDef
A label’s properties.