Skip to content

Manage graph types

This topic introduces how to manage graph types in NebulaGraph Studio, including creating, deleting, modifying, and viewing graph types.

  1. On the Database page, click the name of the database that you created to view the database details.
  2. On the left-side navigation pane of the database details page, click Graph under Data.
  3. Follow the steps below to create, delete, modify, and view graph types.

Create a graph type

  1. In the top navigation bar, click the SCHEMA tab.
  2. In the left-side navigation pane, select the schema where you want to create the graph type and then click the plus icon next to Graph Type.
  3. Enter a name for the graph type in the Graph Type Name field.
  4. Drag the +Add circle to the canvas to create a node type. For each node type, specify the following information:
    • Node Type Name: The name of the node type, which must be unique among all node types and edge types within the graph type.
    • Color: The color of the node type.
    • Label: The label of the node type, which must be unqiue within the node type.
    • Properties: The properties of the node type. Each node type must have at least one property. For each property, specify the following information:
      • Prop Name: The name of the property, which must be unique within the node type.
      • Prop Type: The data type of the property.
      • Primary Key: Whether the property serves as the primary key of the node type. Each node type must have exactly one primary key, which may consist of one or more properties.
      • Is List: Whether the property value is a list.
      • Nullable: Whether the value of the property can be NULL.
      • Default Value: The default value of the property.
  5. Repeat step 5 to create more node types based on your requirements.
  6. Select two node types and draw a line to connect them to create an edge type. For each edge type, specify the following information:
    • Edge Type Name: The name of the edge type, which must be unique among all node types and edge types within the graph type.
    • Direction: The direction of the edge type.
    • Color: The color of the edge type.
    • Label: The label of the edge type, which must be unique within the edge type.
    • Multi Edge Key Mode: The multi-edge key mode of the edge type. Valid values are as follows:
      • None: The edge type has no multi-edge key. In this case, multiple edges between two nodes are not allowed.
      • Auto: The multi-edge key is automatically generated by the system.
      • Customize: You need to specify the properties that form the multi-edge key.
    • Properties: The properties of the edge type. For each property, specify the following information:
      • Prop Name: The name of the property, which must be unique within the edge type.
      • Prop Type: The data type of the property.
      • Multi Edge Key: Whether the property serves as the multi-edge key of the edge type. This field is displayed only when the field Multi Edge Key Mode is set to Customize. Each edge type may have one multi-edge key, which may consist of zero or more properties.
      • Is List: Whether the property value is a list.
      • Nullable: Whether the value of the property can be NULL.
      • Default Value: The default value of the property.
  7. Repeat step 7 to create more edge types based on your requirements.
  8. Click Preview to preview the GQL statement that is generated based on the graph type you designed.
  9. Click Create Graph Type to create the graph type.

Create a graph type

For more information about the GQL syntax for creating graph types, see CREATE GRAPH TYPE. (Initial password: Nebula.123)

Delete a graph type

  1. In the top navigation bar, click the SCHEMA tab.
  2. In the left-side navigation pane, select the schema where the graph type you want to delete is located and then click Graph Type.
  3. On the Graph Type List page that appears on the right, select the graph type you want to delete.
  4. Click more actions icon at the right of the graph type and select Delete.
  5. In the confirmation dialog box that appears, click Delete.

For more information about the GQL syntax for deleting graph types, see DROP GRAPH TYPE. (Initial password: Nebula.123)

Modify a graph type

  1. In the top navigation bar, click the SCHEMA tab.
  2. In the left-side navigation pane, select the schema where the graph type you want to modify is located and then click the graph type you want to modify under the Graph Type section.
  3. Click the Edit Graph Type button in the upper-right corner.
  4. On the canvas that appears, click the node type or edge type you want to modify and make the necessary changes.
  5. Click Preview to preview the GQL statement that is generated based on the changes you made.
  6. Click Commit Edit to apply the changes.

For more information about the GQL syntax for altering graph types, see ALTER GRAPH TYPE. (Initial password: Nebula.123)

View a graph type

  1. In the top navigation bar, click the SCHEMA tab.
  2. In the left-side navigation pane, select the schema where the graph type you want to view is located and then click Graph Type.
  3. On the Graph Type List page that appears on the right, select the graph type you want to view.

    • Click more actions icon at the right of the graph type and click View DDL to view the GQL statement that defines the graph type.
    • Alternatively, click the View button to view the graph type in detail:
      • On the Visual Builder tab, you can view the graph type you selected as a property graph. You can click a node type or edge type to view more detailed information.
      • On the Node Type tab, you can view all node types in the graph type. Besides, you can click the double-arrow icon to display all properties of all node types, or click the single-arrow icon to display all properties of a specific node type.
      • On the Edge Type tab, you can view all edge types in the graph type. Besides, you can click the double-arrow icon to display all properties of all edge types, or click the single-arrow icon to display all properties of a specific edge type.
      • On the Label tab, you can view all labels in the graph type by node type or edge type.