Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of: uppercase, lowercase, numbers, and special characters.
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

Apply New License

License Detail

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

The MAC address of the server you want to deploy.

Please complete this required field.

Please complete this required field.

Cancel
Apply
ID
Product
Status
Cores
Applied Validity Period(days)
Effective Date
Excpired Date
Mac Address
Apply Comment
Review Comment
Close
Profile
  • Full Name:
  • Phone:
  • Company:
  • Company Email:
  • Country:
  • Language:
Change Password
Apply

You have no license application record.

Apply
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

Product Created On ID Amount (USD) Invoice
Product Created On ID Amount (USD) Invoice

No Invoice

v5.0
Search
    English
    v5.0

      Graph

      This page introduces statements for managing graphs in a database.

      Showing Graphs

      The SHOW GRAPH statement retrieves information about all graphs in the database.

      SHOW GRAPH
      

      The information about graphs is organized into tables _graph, _graph_shard_1, _graph_shard_2, and so on:

      • The _graph table contains all graphs in the database.
      • Each _graph_shard_<N> table contains the graphs that have data stored in the shard with id <N>.

      Each table includes fields that provide essential details about each graph:

      Field
      Description
      id The unique id of the graph.
      name The unique name assigned to the graph.
      total_nodes The total count of nodes in the graph. Only available in _graph.
      total_edges The total count of edges in the graph. Only available in _graph.
      description The description given to the graph.
      status The current state of the graph, which can be NORMAL, LOADING_SNAPSHOT, CREATING, DROPPING, or SCALING.
      shards The ids of shards where the graph data is distributed.
      partition_by The function that computes the hash value for the sharding key, which is essential for sharding the graph data.
      meta_version The version number utilized by meta servers to synchronize DDL (Data Definition Language) operations on the graph with shard servers.

      Creating Graphs

      The CREATE GRAPH statement creates new graphs in the database.

      <create graph statement> ::= 
        "CREATE GRAPH" <graph name> <graph structure> <graph sharding> <graph description>
      
      <graph structure> ::= 
        "{" [ <element schemas> ] "}"
      
      <element schemas> ::=
        <element schema> [ { "," <element schema> }... ]
        
      <element schema> ::=
        <node schema> | <edge schema>
          
      <node schema> ::=
        "NODE" [ "TYPE" ] <node schema name> "(" <property types> ")"
      
      <edge schema> ::=
        "EDGE" [ "TYPE" ] <edge schema name> "()-[" <property types> "]->()"
        
      <property types> ::= 
        "{" <property type> [ { "," <property type> }... ] "}"
      
      <property type> ::= 
        <property name> <property value type>
        
      <graph sharding> ::= 
        "PARTITION BY" <hash function> "SHARDS" <shard id list> 
          
      <graph description> ::=
        "COMMENTS" <description string>
      

      When creating a graph, you can specify four components:

      Component
      Description
      <graph name> The unique name of the graph. See naming conventions.
      <graph structure> A graph structure that defines the <node schema>s and <edge schema>s (collectively referred to as <element schema>s) of the graph. It can be omitted by using an empty {}.

      Each <element schema> includes:
      • <node schema name>/<edge schema name>: Name of the node schema or edge schema. See naming conventions.
      • One or more <property type>s, each <property type> contains:
      <graph sharding> The sharding strategy for the graph, including:
      • <hash function>: The function (Crc32, Crc64WE, Crc64XZ, or CityHash64) that computes the hash value for the sharding key (nodes' _id), which is essential for sharding the graph data. For more information, refer to Crc and CityHash.
      • <shard id list>: Non-empty list of ids of shards where the graph data will be stored.
      <graph description> Optional. Description of the graph.

      To create a graph g1 with the following specifications:

      • Node schemas: User and Club
      • Edge schemas: Follows and Joins
      • Sharding: Data distributed across shards 1, 2, and 3 using the Crc32 hash function

      CREATE GRAPH g1 { 
        NODE User ({name string, gender string}),
        NODE Club ({name string, since uint32}),
        EDGE Follows ()-[{createdOn datetime}]->(),
        EDGE Joins ()-[{memberNo uint64}]->()
      } PARTITION BY HASH(Crc32) SHARDS [1,2,3] COMMENT 'My first graph'
      

      To create a graph g2 with node and edge schemas only:

      CREATE GRAPH g2 { 
        NODE User (),
        NODE Club (),
        EDGE Joins ()-[{}]->()
      } PARTITION BY HASH(Crc32) SHARDS [1,2]
      

      To create a graph g3 with an empty structure, and distribute its data only to shard 1 using the CityHash64 hash function:

      CREATE GRAPH g3 {} PARTITION BY HASH(CityHash64) SHARDS [1]
      

      To create two graphs:

      CREATE GRAPH g1 { 
        NODE User ({name string, gender string}),
        NODE Club ({name string, since uint32}),
        EDGE Follows ({createdOn datetime}),
        EDGE Joins ({memberNo uint64})
      } PARTITION BY HASH(Crc32) SHARDS [1,2,3] COMMENT 'My first graph'
      CREATE GRAPH g2 {} PARTITION BY HASH(CityHash64) SHARDS [1]
      

      Dropping Graphs

      The DROP GRAPH statement drops graphs from the database.

      <drop graph statement> ::= 
        "DROP GRAPH" <graph name> 
      

      To drop the graph g1:

      DROP GRAPH g1
      

      To drop two graphs:

      DROP GRAPH g1
      DROP GRAPH g2
      

      Adding Schemas to Graph

      The ALTER GRAPH statement allows you to add node and edge schemas to a graph.

      <alter graph statement> ::= 
        "ALTER GRAPH" <graph name> <add element schemas>
      
      <add element schemas> ::=
        <add node schemas> | <add edge schemas>
      
      <add node schemas> ::=
        "ADD NODE" "{" <add node schema> [ { "," <add node schema> }... ] "}"
      
      <add node schema> ::=
        <node schema name> "(" <property types> ")"
      
      <add edge schemas> ::=
        "ADD EDGE" "{" <add edge schema> [ { "," <add edge schema> }... ] "}"
      
      <add edge schema> ::=
        <edge schema name> "(" <property types> ")"
      

      Details

      To add node schemas Book and Company to the graph g1:

      ALTER GRAPH g1 ADD NODE {Book ({title string, rating float}), Company ({name string})}
      

      To add an edge schema Rates to the graph g1:

      ALTER GRAPH g1 ADD EDGE {Rates ({value float})}
      

      Dropping Schemas from Graph

      The ALTER GRAPH statement allows you to drop node and edge schemas from a graph. Dropping a node or edge schema deletes the schema along with the nodes or edges belonging to it from the database. Note that the deletion of a node leads to the removal of all edges that are connected to it. The two default schemas cannot be dropped.

      The schema dropping operation runs as a job, you may run SHOW JOB afterward to verify its completion.

      <alter graph statement> ::= 
        "ALTER GRAPH" <graph name> <drop element schemas>
        
      <drop element schemas> ::=
        <drop node schemas> | <drop edge schemas>
      
      <drop node schemas> ::=
        "DROP NODE" <node schema name> [ { "," <node schema name> }... ]
      
      <drop edge schemas> ::=
        "DROP EDGE" <edge schema name> [ { "," <edge schema name> }... ]
      

      To drop a node schema User from the graph g1:

      ALTER GRAPH g1 DROP NODE User 
      

      To drop edge schemas Follows and Joins from the graph g1:

      ALTER GRAPH g1 DROP EDGE Follows, Joins 
      
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写