GraphSet, or Ultipa GraphSet, is the graph structure composed of nodes and edges, as well as the collection of schema and property structure of nodes and edges, tasks, indexes and other information. GraphSet may be referred to as graph later.
During the initial launch of Ultipa instance, a GraphSet named default is created automatically (non-deletable). Every Ultipa instance may contain multiple GraphSets.
Temporarily unused GraphSets, that is, those do not need or have to avoid any UQL or RPC operations on schema, property and metadata, can be unmounted until it is required. Server memory can be appropriately saved through this method.
Unmounted GraphSet can only be modified, deleted and mounted. After re-mounting, the LTE and indexes of graph properties keep consistent with the previous.
Command of unmount, mount and trancate will be sent to the leader of the server cluster.
Naming Conventions
GraphSets are named by developers. A same name cannot be shared between GraphSets in an Ultipa instance.
- 2 ~ 64 characters
- Must start with letters
- Allow to use letters, underscore and numbers ( _ , A-Z, a-z, 0-9)
Show Graph
Returned table name: _graph
Returned table header: id
| name
| totalNodes
| totalEdges
| description
| status
(the ID, name, number of nodes, number of edges, description and status of the graph; status of graph can be mounted, unmounted and mounting; only mounted graph shows the real number of nodes and edges)
Syntax:
// To show all graphsets in the current Ultipa instance (via listGraph API)
show().graph()
// To show all graphsets in the current Ultipa instance
show().graph("")
// To show a certain graphset in the current Ultipa instance
show().graph("<name>")
Create Graph
Syntax:
// To create a graphset in the current Ultipa instance
create().graph("<name>", "<desc?>")
// To create multiple graphsets at one time by reusing the method above
create()
.graph("<name>", "<desc?>")
.graph("<name>", "<desc?>")
...
Alter Graph (Name, Description)
Syntax:
// To modify the name, description of a certain graphset in the current Ultipa instance
alter().graph("<name>")
.set({name: "<new_name?>", description: "<new_desc?>"})
Drop Graph
Except for the default GraphSet, which is not allowed to be deleted, all the other GraphSets in the current Ultipa instance can be deleted.
Syntax:
// To delete a certain graphset from the current Ultipa instance
drop().graph("<name>")
// To delete multiple graphsets from the current Ultipa instance
drop().graph("<name>").graph("<name>")...
Mount Graph
Syntax:
// To mount a certain graphset from the current Ultipa instance
mount().graph("<name>")
Unmount Graph
Except for the default GraphSet, which is not allowed to be unmounted, all the other Graphsets in the current Ultipa instance can be unmounted.
If the current GraphSet is unmounted
, user cannot perform any operations on the schema, property, metadata and so on within itself.
Syntax:
// To unmount a certain graphset from the current Ultipa instance
unmount().graph("<name>")
Truncate Graph
Truncate is the delete operation done against all or part of the nodes and edges in a certain GraphSet in the current Ultipa instance.
Syntax:
// To truncate all the nodes and edges in a certain graphset in the current Ultipa instance
truncate().graph("<graphset>")
// To truncate all the nodes of certain schema in a certain graphset in the current Ultipa instance
truncate().graph("<graphSet>").nodes(@<schema>)
// To truncate all the edges of certain schema in a certain graphset in the current Ultipa instance
truncate().graph("<graphSet>").edges(@<schema>)
// To truncate all the nodes in a certain graphset in the current Ultipa instance
truncate().graph("<graphset>").nodes("*")
// To truncate all the edges in a certain graphset in the current Ultipa instance
truncate().graph("<graphset>").edges("*")
Example: Erase all the data from GraphSet "test"
truncate().graph("test")
Example: Erase all edges from GraphSet "test"
truncate().graph("test").edges("*")
Compact Graph
Compact is to clear useless and redundant data in a certain GraphSet in the current Ultipa instance. Such as the old records retained after an update or delete operation, they are suggested to be cleared on a regular basis since they will reduce the query efficiency.
Syntax:
// To defragment a certain graphset in the current Ultipa instance
compact().graph("<graphset>")