Modifying graph data
GQL defines linear data-modifying statements to support inserting, updating, and deleting data. These statements allow users to efficiently manage and manipulate their datasets, ensuring that data can be dynamically adjusted to reflect changes.
Inserting graph data
GQL employs the INSERT
statement to create nodes, edges, or paths within the current graph. As we have learned about using graph patterns, these patterns can also be utilized for data insertion.
To insert graph data, use the following syntax:
INSERT <graph pattern list>
A graph pattern list can include nodes, edges, or paths. Let’s take a closer look at how to insert nodes, edges, and paths.
Inserting nodes
When inserting nodes, you define the node’s label and properties. Each node is represented in a graph pattern that specifies its label and then its properties.
For example, to insert two nodes into the QLGraph, use the following query:
GQL...