Skip to content

Commit

Permalink
doc: RGMapping YAML
Browse files Browse the repository at this point in the history
Signed-off-by: Sijie Shen <[email protected]>
  • Loading branch information
ds-ssj committed May 20, 2024
1 parent 30f4794 commit 4a439be
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/documentation/design/rgmapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ YAML
!!gart.pgql.GSchema
graph: ldbc
database: ldbc
method: append
enableRowStore: false
vertexMappings:
vertex_types:
Expand Down Expand Up @@ -94,6 +93,7 @@ YAML
name: T_DATA
The RGMapping rule can also be written in `YAML`_. It defines the graph schema for the graph named ``ldbc``. It specifies the mapping between the vertices, edges and their properties in the graph and the columns in the table.
The examples we give are equivalent conversion conditions to those described above for SQL/PGQ.

.. _SQL/PGQ: https://pgql-lang.org/
.. _YAML: https://yaml.org/
59 changes: 46 additions & 13 deletions docs/documentation/tutorials/rgmapping-config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,51 @@ The RGMapping rule can be written in `SQL/PGQ`_.
When defining the rules for converting a relational schema to a property graph model, several key components are typically addressed:

1. Graph Declaration: This initiates the creation of a new graph database object.
1. Graph Declaration

Example: ``CREATE PROPERTY GRAPH ldbc``
- This initiates the creation of a new graph database object.
Example: ``CREATE PROPERTY GRAPH ldbc``

2. Vertex Tables Definition:
2. Vertex Tables Definition

- Table Naming: Specifies which relational tables will be represented as vertex types in the graph.
- **Table Naming**: Specifies which relational tables will be represented as vertex types in the graph.
Example: ``"PERSON"``

- Key Definition: Determines the primary key column(s) of the table which will serve as the unique identifier (ID) for vertices.
- **Key Definition**: Determines the primary key column(s) of the table which will serve as the unique identifier (ID) for vertices.
Example: ``KEY ( "p_id" )``

- Label Assignment: Assigns a label to the vertex type, reflecting its role or category in the graph.
- **Label Assignment**: Assigns a label to the vertex type, reflecting its role or category in the graph.
Example: ``LABEL "person"``

- Properties Mapping: Maps columns from the relational table to properties on the vertex, maintaining data integrity.
- **Properties Mapping**: Maps columns from the relational table to properties on the vertex, maintaining data integrity.
Example: ``PROPERTIES ( p_id AS "p_id", name AS "p_name" )``

3. Edge Tables Definition:
3. Edge Tables Definition

- Table Naming: Identifies the relational table representing relationships between vertices.
- **Table Naming**: Identifies the relational table representing relationships between vertices.
Example: ``"TRANSFER"``
- Source and Destination Key Definition: Specifies the columns in the edge table that refer to the start (source) and end (destination) vertices of the edge, usually referencing the primary keys of the vertex tables.

- **Source and Destination Key Definition**: Specifies the columns in the edge table that refer to the start (source) and end (destination) vertices of the edge, usually referencing the primary keys of the vertex tables.
Example: ``SOURCE KEY ( "P_ID1" ) REFERENCES "PERSON" and DESTINATION KEY ( "P_ID2" ) REFERENCES "PERSON"``
- Label Assignment: Assign a label to the edge type, describing the nature of the relationship.

- **Label Assignment**: Assign a label to the edge type, describing the nature of the relationship.
Example: ``LABEL "transfer"``
- Properties Mapping: Maps additional columns to properties on the edge, capturing details about the relationship.

- **Properties Mapping**: Maps additional columns to properties on the edge, capturing details about the relationship.
Example: ``PROPERTIES ( t_data AS "t_date" )``

YAML
^^^^

The RGMapping rule can also be written in `YAML`_.
The examples we give are equivalent conversion conditions to those described above for SQL/PGQ.

.. code-block:: yaml
:linenos:
!!gart.pgql.GSchema
graph: ldbc
database: ldbc
method: append
enableRowStore: false
vertexMappings:
vertex_types:
Expand Down Expand Up @@ -100,7 +104,36 @@ The RGMapping rule can also be written in `YAML`_.
dataField:
name: T_DATA
1. Graph Declaration

- This initiates the creation of a new graph database object.
Example: ``graph: ldbc``

2. Vertex Tables Definition (``vertexMappings.vertex_types``)

- **Table Naming**: Specifies which relational tables will be represented as vertex types in the graph.
Example: ``dataSourceName``

- **Key Definition**: Determines the primary key column(s) of the table which will serve as the unique identifier (ID) for vertices.
Example: ``idFieldName``

- **Label Assignment**: Assigns a label to the vertex type, reflecting its role or category in the graph.
Example: ``type_name``

- **Properties Mapping**: Maps columns from the relational table to properties on the vertex, maintaining data integrity.
Example: ``mappings``

3. Edge Tables Definition (``edgeMappings.edge_types``)

- **Table Naming**: Identifies the relational table representing relationships between vertices.
Example: ``"TRANSFER"``

- **Source and Destination Key Definition**: Specifies the columns in the edge table that refer to the start (source) and end (destination) vertices of the edge, usually referencing the primary keys of the vertex tables.
Example: ``type_pair``, ``sourceVertexMappings``, ``destinationVertexMappings``
- **Label Assignment**: Assign a label to the edge type, describing the nature of the relationship.
Example: ``edge``
- **Properties Mapping**: Maps additional columns to properties on the edge, capturing details about the relationship.
Example: ``dataFieldMappings``

.. _SQL/PGQ: https://pgql-lang.org/
.. _YAML: https://yaml.org/

0 comments on commit 4a439be

Please sign in to comment.