Change Password

Input error
Input error
Input error
Submit

Change Nickname

Current Nickname:
Submit
v4.0

GraphSet | Schema | Property

GraphSet

GraphSet, or Ultipa GraphSet, is the graph structure composed of nodes and edges, as well as the collection of schemas and properties of nodes and edges, permissions other than nodes and edges, 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.

Please refer to chapter Basic Concepts for the naming conventions of GraphSet.

Temporarily unused GraphSets, that is, those don't need or have to avoid any UQL or RPC operations on schema, property and metadata, can be unmounted until it's 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.

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 can't 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>")

Schema

Schema represents a certain structural definition of data, restores the real world to graph more intuitively and completely, so that the graph data can be managed clearly and conveniently. In Ultipa Graph system, schema describes a type of entity (node) in real world, such as Natural Person, Bank Card, Account; or a kind of behavioral relation (edge), such as Follow, Transaction, Own.

A default node schema and a default edge schema (both non-deletable) are created automatically along with a GraphSet. Each GraphSet may contain multiple node schemas and edge schemas.

Schema Features:

  • A same name can be shared between a node schema and an edge schema, but not between node schemas, or edge schemas;
  • Please refer to chapter Basic Concepts for the naming conventions of schema;
  • Schema is indicated with the symble @ in UQL:
    • the form of @<value> is a filter condition, e.g. @account is interpreted as the nodes/edges of schema account
    • the form of @ alone is a call, e.g. @ or <alias>.@, which calls the schema of the metadata

Show Schema

Returned table name: _nodeSchema, _edgeSchema
Returned table header: name | description | properties | totalNodes or totalEdges (the name, description, list of properties, number of nodes or edges of the schema)

Syntax:

// To show all schemas in the current graphset (node schemas and edges schemas in separated tables)
show().schema()

// To show all node schemas in the current graphset
show().node_schema()

// To show all edge schemas in the current graphset
show().edge_schema()

// To show a certain node schema in the current graphset
show().node_schema(@<schema>)

// To show a certain edge schema in the current graphset
show().edge_schema(@<schema>)

Create Schema

Syntax:

// To create a node schema in the current graphset
create().node_schema("<name>", "<desc?>")

// To create an edge schema in the current graphset
create().edge_schema("<name>", "<desc?>")

// To create multiple node/edge schemas by using the two methods above
create()
  .node_schema("<name>", "<desc?>")
  .edge_schema("<name>", "<desc?>")
	...

Example: Using one UQL to create node schemas for entities "Bank Card" and "Bank Account"

create().node_schema("card", "Bank Card").node_schema("account", "Bank Account")

Example: Using one UQL to create edge schemas for relations "Own" and "Transaction"

create().edge_schema("own").edge_schema("transaction")

Example: Using one UQL to create node schema for entity "Bank Card" and edge schema for relation "Own"

create().node_schema("card", "Bank Card").edge_schema("own")

Alter Schema (Name, Description)

Syntax:

// To modify the name, description of a certain node schema in the current graphset
alter().node_schema(@<schema>)
  .set({name: "<new_name?>", description: "<new_desc?>"})

// To modify the name, description of a certain edge schema in the current graphset
alter().edge_schema(@<schema>)
  .set({name: "<new_name?>", description: "<new_desc?>"})

Drop Schema

Except for the default node schema and edge schema @default, which are not allowed to be deleted, all the other schemas in the current GraphSet can be deleted.

Syntax:

// To delete a certain node schema from the current graphset
drop().node_schema(@<schema>)

// To delete a certain edge schema from the current graphset
drop().edge_schema(@<schema>)
                   
// To delete multiple node/edge schemas by using the two methods above
drop()
  .node_schema(@<schema>)
  .edge_schema(@<schema>)

Property

Property is a component of schema that describes the data dimension of entities and relations in the graph. For example, node schema @card (Bank Card) has card number, balance, opening time and other node properties; edge schema @transaction (Transaction) has amount, transfer time and other edge properties.

Node properties _id, _uuid and edge properties _uuid, _from, _to, _from_uuid, _to_uuid are created automatically along with node schema and edge schema. These system properties are not deletable. Each schema may contain multiple properties.

Property features:

  • Supported data types of property are: int32, int64, uint32, uint64, float, double, string, datetime, timestamp;
  • and its corresponding arrays: []int32, []int64, []uint32, []uint64, []float, []double, []string, []datetime, []timestamp (under development);
  • A property name can be shared between different schemas, but not within a schema;
  • Please refer to chapter Basic Concepts for the naming conventions of property;
  • Property is usually combined with schema in the form of @<schema>.<property>, interpreted as “the value of property <property> of nodes/edges of schema <schema>"; independent property expression without schema <property> indicates the value of property <property> for nodes or edges of any schema, or empty value if the property doesn't exist.

The difference between datetime and timestamp is: The data formats of datetime include yyyy-mm-dd hh:mm:ss and yyyy-mm-dd hh:mm:ss.ssssss; the string will be converted and stored as an uint64 that equals the number of milliseconds from 1900-01-01 00:00:00 UTC onwards. The timestamp calls for a string in the format yyyy-mm-dd hh:mm:ss and stores the represented value as an uint32 that equals the number of seconds from 1970-01-01 00:00:00 UTC onwards.

Integer type int32 is used by default if only writes int. String type string supports a maximum of 65,535 bytes. Decimal type float has 4 bytes with a data precision of 6 significant digits; double has 8 bytes with a data precision of 15 significant digits. Choose the appropriate decimal type based on the practical usage and amount of the data, as well as the size of the disk.

Show Property

Returned table name: _nodeProperty and/or _edgeProperty
Returned table header: name | type | lte | schema | description (the name, data type, whether LTEed, schema and description of the property)

Syntax:

// To show properties of all schemas in the current graphset (node properties and edges properties in separated tables)
show().property()

// To show properties of all node schemas in the current graphset
show().node_property()

// To show properties of all edge schemas in the current graphset
show().edge_property()

// To show properties of a certain node schema in the current graphset
show().node_property(@<schema>)

// To show properties of a certain edge schema in the current graphset
show().edge_property(@<schema>)

Create Property

string is used by default if data type is ignored when creating property.

Syntax:

// To create a node property under a certain node schema in the current graphset
create().node_property(@<schema>, "<name>", <type?>, "<desc?>")

// To create a node property under all node schemas in the current graphset
create().node_property(@*, "<name>", <type?>, "<desc?>")

// To create an edge property under a certain edge schema in the current graphset
create().edge_property(@<schema>, "<name>", <type?>, "<desc?>")

// To create an edge property under all edge schemas in the current graphset
create().edge_property(@*, "<name>", <type?>, "<desc?>")

// To create multiple node/edge properties by using the four methods above
create()
  .node_property(@<schema>, "<name>", <type?>, "<desc?>")
  .node_property(@*, "<name>", <type?>, "<desc?>")
  .edge_property(@<schema>, "<name>", <type?>, "<desc?>")
  .edge_property(@*, "<name>", <type?>, "<desc?>")

Example: Using one UQL to create node properties "card balance" and "level" under @card and edge property "time" for all edge schemas

create().node_property(@card, "sum," double, "card balance")
  .node_property(@card, "level", int, "card level")
  .edge_property(@*, "time", datetime)

Example: Using one UQL to create edge properties "transaction number", "time" and "amount" under @transaction

create().edge_property(@transaction, "no", "", "transaction number")
  .edge_property(@transaction, "time", datetime)
  .edge_property(@transaction, "amount", double)

Example: Using one UQL to create node properties "card balance", "level" under @card and edge properties "transaction number", "time" and "amount" under @transaction

create().node_property(@card, "sum", double, "card balance")
  .node_property(@card, "level", int, "card level")
  .edge_property(@transaction, "no", "", "transaction number")
  .edge_property(@transaction, "time", datetime)
  .edge_property(@transaction, "amount", double)

Alter Property (Name, Description)

Syntax:

// To modify the name, description of a certain node property under a certain node schema in the current graphset
alter().node_property(@<schema>.<property>)
  .set({name: "<new_name?>", description: "<new_desc?>"})

// To modify the name, description of a certain node property (if has) under all node schemas in the current graphset
alter().node_property(@*.<property>)
  .set({name: "<new_name?>", description: "<new_desc?>"})

// To modify the name, description of a certain edge property under a certain edge schema in the current graphset
alter().edge_property(@<schema>.<property>)
  .set({name: "<new_name?>", description: "<new_desc?>"})

// To modify the name, description of a certain edge property (if has) under all edge schemas in the current graphset
alter().edge_property(@*.<property>)
  .set({name: "<new_name?>", description: "<new_desc?>"})

Example: Rename @card property "sum" as "balance"

alter().node_property(@card.sum)
  .set({name: "balance"})

Example: Rename property "time" as "createTime" for all edges

alter().edge_property(@*.time)
  .set({name: "createTime"})

Drop Property

User may delete properties that are no longer needed to save disk space. Deleting property operation can be executed in real time, and there won't be a considerable wait time. Once executed, the property is deleted immediately.

Except for system properties _id, _uuid, _from, _to, _from_uuid and _to_uuid which are not allowed to be deleted, all the other properties of schema can be deleted.

Syntax:

// To delete a certain node property under a certain node schema from the current graphset
drop().node_schema(@<schema>.<property>)

// To delete a certain node property (if has) under all node schemas from the current graphset
drop().node_schema(@*.<property>)

// To delete a certain edge property under a certain edge schema from the current graphset
drop().edge_schema(@<schema>.<property>)

// To delete a certain edge property (if has) under all edge schemas from the current graphset
drop().edge_schema(@*.<property>)

// To delete multiple node/edge properties by using the four methods above
drop()
  .node_schema(@<schema>.<property>)
  .node_schema(@*.<property>)
  .edge_schema(@<schema>.<property>)
  .edge_schema(@*.<property>)

Example: Delete node property "branch" under @card and edge property "time" for all edges

drop().node_property(@card.branch).edge_property(@*.time)

Example: Delete @default edge property "test"

drop().edge_property(@default.test)
Please complete the following information to download this book
*
公司名称不能为空
*
公司邮箱必须填写
*
你的名字必须填写
*
你的电话必须填写
*
你的电话必须填写