Specify Vertex and Edge Table Keys

The property graph wizard in Graph Studio allows you to specify keys for the vertex and edge tables when creating a graph.

It is important to note the following key concepts:

  • All the vertex and edge tables of a graph must have vertex and edge keys defined respectively.
  • By default, the wizard generates the vertex and edge table keys using the primary key of the underlying database tables for the vertex and edge tables respectively.
  • By default, the edge source key and edge destination key for an edge table corresponds to a unique key (foreign key) of the source and destination tables respectively.
  • If there is no primary key defined in the source database tables, then you must specify the required vertex or edge key in order to proceed with the graph creation.
  • Similarly, you can specify the edge source key or edge destination key for an edge table, if they are not automatically generated.
Therefore, you can perform the following on the Define Graph step of the property graph wizard workflow:
  • Specify a vertex key for a vertex table.
  • Specify an edge key for an edge table.
  • Specify an edge source key for an edge table.
  • Specify an edge destination key for an edge table.

The following steps explain how to perform the preceding operations. The instructions assume that you are on the third step of the property graph wizard workflow.

  1. To specify a vertex key for a vertex table:
    1. Click the required vertex table in the Designer tab.

      The Source Table name along with the Vertex Key, Vertex Label and Vertex Properties are displayed in the bottom pane.

    2. Click the edit_key_icon Edit Vertex Key icon.

      The Edit Vertex Key slider opens as shown:

      Description of edit_vertex_key.png follows
      Description of the illustration edit_vertex_key.png

      Any existing primary key constraint is displayed in this key selection dialog.

    3. Select the required columns for the vertex key.

      Ensure you have selected at least one key column and the selected vertex key columns are unique.

    4. Click Save.

      The Vertex Key is saved.

    Alternatively, you can provide the vertex key directly in the Source tab using the KEY clause for the vertex tables.
  2. To specify an edge key for an edge table:
    1. Click the required edge table in the Designer tab.

      The Source Table name along with the Edge Key, Source vertex key, Destination vertex key, Edge Label and Edge Properties are displayed in the bottom pane.

    2. Click the edit_key_icon Edit Edge Key icon.

      The Edit Edge Key slider opens as shown:

      Description of edit_edge_key.png follows
      Description of the illustration edit_edge_key.png

      Any existing primary key constraint is displayed in this key selection dialog.

    3. Select the required columns for the edge key.

      Ensure you have selected at least one key column and the selected edge key columns are unique.

    4. Click Save.

      The Edge Key is saved.

    Alternatively, you can provide the edge key directly in the Source tab using the KEY clause for the edge tables.
  3. To specify an edge source key or an edge destination key for an edge table:
    1. Click the edge table in the Designer tab.

      The Source Table name along with the Edge Key, Source key, Destination key, Edge Label and Edge Properties are displayed in the bottom pane.

    2. Click the edit_key_icon Edit Edge Source Key icon or the Edit Edge Destination Key icon as required.Description of edit_source_destination_vertex_key.png follows
      Description of the illustration edit_source_destination_vertex_key.png

      This opens the corresponding Edit Edge Source Key or the Edit Edge Destination Key slider. Any existing key value is shown highlighted.

    3. Select the required columns for the edge source key or the edge destination key.

      Ensure you have selected at least one key column and the selected key columns are unique.

    4. Click Save.
    Alternatively, you can provide the SOURCE KEY and the DESTINATION KEY directly in the Source tab for the edge tables.