Manage graph types¶
This topic introduces how to manage graph types in NebulaGraph Cloud, including creating, deleting, modifying, and viewing graph types.
Create a graph type¶
- On the Database page, click the name of the database that you created to view the database details.
- On the left-side navigation pane of the database details page, click Graph under Data.
- In the upper-left corner of the Graph page, click the plus icon next to Graph Type.
- Enter a name for the graph type in the Graph Type Name field.
- 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 unique 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.
- Repeat step 5 to create more node types based on your requirements.
- 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.
- Repeat step 7 to create more edge types based on your requirements.
- Click Preview to preview the GQL statement that is generated based on the graph type you designed.
- Click Create Graph Type to create the 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¶
- On the Database page, click the name of the database that you created to view the database details.
- On the left-side navigation pane of the database details page, click Graph under Data.
- In the upper-left corner of the Graph page, click Graph Type.
- On the Graph Type List page that appears on the right, select the graph type you want to delete.
- Click
at the right of the graph type and select Delete.
- 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¶
- On the Database page, click the name of the database that you created to view the database details.
- On the left-side navigation pane of the database details page, click Graph under Data.
- In the upper-left corner of the Graph page, click the graph type you want to modify under the Graph Type section.
- Click the Edit Graph Type button in the upper-right corner.
- On the canvas that appears, click the node type or edge type you want to modify and make the necessary changes.
- Click Preview to preview the GQL statement that is generated based on the changes you made.
- 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¶
- On the Database page, click the name of the database that you created to view the database details.
- On the left-side navigation pane of the database details page, click Graph under Data.
- In the upper-left corner of the Graph page, click Graph Type.
-
On the Graph Type List page that appears on the right, select the graph type you want to view.
- Click
at the right of the graph type and click View DDL to view the GQL statement that defines the graph type.
- Alternatively, click the name of the graph type to enter the detail page:
- 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 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 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.
- Click