Cypher API

This document mainly introduces the detailed usage instructions of TuGraph-Cypher.

Table of contents

1.Operators

1.1.Summary

Operators support progress overview:

category

supported

unsupported

General operators

DISTINCT, . for property access

[] for dynamic property access

Mathematical operators

+, -, *, /, %, ^

Comparison operators

=, <>, <, >, , >=, IS NULL, IS NOT NULL

String-specific comparison operators

STARTS WITH, ENDS WITH, CONTAINS, REGEXP

Boolean operators

AND, OR, XOR, NOT

String operators

+ for concatenation

List operators

+ for concatenation, IN to check existence of an element in a list, [] for accessing element(s)

1.2.General operators

  • ✓ Using the DISTINCT operator

    CREATE (a:Person {name: 'Anne', eyeColor: 'blue'}),
           (b:Person {name: 'Bill', eyeColor: 'brown'}),
           (c:Person {name: 'Carol', eyeColor: 'blue'})
    
    MATCH (p:Person ) RETURN DISTINCT p.eyeColor
    
  • ✓ Accessing properties of a nested literal map using the . operator

    WITH {person: {name: 'Anne', age: 25}} AS p
    RETURN p.person.name
    
  • ❏ Filtering on a dynamically-computed property key using the [] operator

    CREATE (a:Restaurant {name: 'Hungry Jo', rating_hygiene: 10, rating_food: 7}),
           (b:Restaurant {name: 'Buttercup Tea Rooms', rating_hygiene: 5, rating_food:6}),
           (c1:Category {name: 'hygiene'}), (c2:Category {name: 'food'})
    
    MATCH (restaurant:Restaurant), (category:Category)
    WHERE restaurant["rating_" + category.name] > 6
    RETURN DISTINCT restaurant.name
    

1.3.Mathematical operators

  • ✓ Using the exponentiation operator ^

    WITH 2 AS number, 3 AS exponent
    RETURN number ^ exponent AS result
    
  • ✓ Using the unary minus operator -

    WITH -3 AS a, 4 AS b
    RETURN b - a AS result
    

1.4.Comparison operators

  • ✓ Comparing two numbers

    WITH 4 AS one, 3 AS two
    RETURN one > two AS result
    

1.5.String-specific comparison operators

  • ✓ Using STARTS WITH to filter names

    WITH ['John', 'Mark', 'Jonathan', 'Bill'] AS somenames
    UNWIND somenames AS names
    WITH names AS candidate
    WHERE candidate STARTS WITH 'Jo'
    RETURN candidate
    
  • ✓ Using REGEXP to filter names

    WITH ['John', 'Mark', 'Jonathan', 'Bill'] AS somenames
    UNWIND somenames AS names
    WITH names AS candidate
    WHERE candidate REGEXP 'Jo.*n'
    RETURN candidate
    

1.6.Boolean operators

  • ✓ Using boolean operators to filter numbers

    WITH [2, 4, 7, 9, 12] AS numberlist
    UNWIND numberlist AS number
    WITH number
    WHERE number = 4 OR (number > 6 AND number < 10)
    RETURN number
    

1.7.String operators

String operators comprise:

  • ✓ concatenating strings: +

    More details on string-specific comparison operators can be found here

1.8.List operators

  • ✓ Concatenating two lists using +

    RETURN [1,2,3,4,5]+[6,7] AS myList
    
  • ✓ Using IN to check if a number is in a list

    WITH [2, 3, 4, 5] AS numberlist
    UNWIND numberlist AS number
    WITH number
    WHERE number IN [2, 3, 8]
    RETURN number
    
  • ✓ Accessing elements in a list using the [] operator

    WITH ['Anne', 'John', 'Bill', 'Diane', 'Eve'] AS names
    RETURN names[1..3] AS result
    

2.Clauses

2.1.Summary

Clauses support progress list:

Category

Syntax

Notes

Reading clauses

MATCH

Supported

OPTIONAL MATCH

Supported

MANDATORY MATCH

Pending

Projecting clauses

RETURN … [AS]

Supported

WITH … [AS]

Supported

UNWIND … [AS]

Supported

Reading sub-clauses

WHERE

Supported

ORDER BY [ASC[ENDING] / DESC[ENDING]]

Supported

SKIP

Supported

LIMIT

Supported

Writing clauses

CREATE

Supported

DELETE

Supported

DETACH DELETE

Supported

SET

Supported

REMOVE

Supported

Reading/Writing clauses

MERGE

Supported

CALL […YIELD]

Supported

Set operations

UNION

Pending

UNION ALL

Supported

2.2.MATCH

  • Basic node finding

    • ✓ Get all nodes

      MATCH (n)
      RETURN n
      
    • ✓ Get all nodes with a label

      MATCH (movie:Movie)
      RETURN movie.title
      
    • ✓ Related nodes

      MATCH (director {name: 'Oliver Stone'})-[]-(movie)
      RETURN movie.title
      
    • ✓ Match with labels

      MATCH (director {name: 'Oliver Stone'})-[]-(movie)
      RETURN movie.title
      
  • Relationship basics

    • ✓ Outgoing relationships

      MATCH (:Person {name: 'Oliver Stone'})-[]->(movie)
      RETURN movie.title
      
    • ✓ Directed relationships and variable

      MATCH (:Person {name: 'Oliver Stone'})-[r]->(movie)
      RETURN type(r)
      
    • ✓ Match on relationship type

      MATCH (wallstreet:Movie {title: 'Wall Street'})<-[:ACTED_IN]-(actor)
      RETURN actor.name
      
    • ✓ Match on multiple relationship types

      MATCH (wallstreet {title: 'Wall Street'})<-[:ACTED_IN|:DIRECTED]-(person)
      RETURN person.name
      
    • ✓ Match on relationship type and use a variable

      MATCH (wallstreet {title: 'Wall Street'})<-[r:ACTED_IN]-(actor)
      RETURN r.role
      
  • Relationships in depth

    • ❏ Relationship types with uncommon characters

      MATCH (n {name: 'Rob Reiner'})-[r:`TYPE WITH SPACE`]->()
      RETURN type(r)
      
    • ✓ Multiple relationships

      MATCH (charlie {name: 'Charlie Sheen'})-[:ACTED_IN]->(movie)<-[:DIRECTED]-(director)
      RETURN movie.title, director.name
      
    • ✓ Variable-length relationships

      MATCH (martin {name: 'Charlie Sheen'})-[:ACTED_IN*1..3]-(movie:Movie)
      RETURN movie.title
      
    • ✓ Relationship variable in variable-length relationships

      MATCH p = (actor {name: 'Charlie Sheen'})-[:ACTED_IN*2]-(co_actor)
      RETURN relationships(p)
      
    • ❏ Match with properties on a variable-length path

      MATCH p = (charlie:Person)-[* {blocked:false}]-(martin:Person)
      WHERE charlie.name = 'Charlie Sheen' AND martin.name = 'Martin Sheen'
      RETURN p
      
    • ✓ Zero-length paths

      MATCH (wallstreet:Movie {title: 'Wall Street'})-[*0..1]-(x)
      RETURN x
      
    • ✓ Named paths

      MATCH p = (michael {name: 'Michael Douglas'})-[]->() RETURN p
      
    • ✓ Matching on a bound relationship

      MATCH (a)-[r]-(b)
      WHERE id(r)= 0
      RETURN a,b
      
  • Shortest path

    • ✓ Single shortest path

      MATCH (martin:person {name: 'Carrie-Anne Moss'}), (laurence:person {name: 'Laurence Fishburne'})
      CALL algo.shortestPath(martin, laurence) YIELD nodeCount,totalCost,path RETURN nodeCount,totalCost,path
      
    • ✓ All shortest paths

      MATCH (martin:person {name: 'Carrie-Anne Moss'}), (laurence:person {name: 'Laurence Fishburne'}) WITH martin, laurence
      CALL algo.allShortestPaths(martin, laurence) YIELD nodeIds,relationshipIds,cost RETURN nodeIds,relationshipIds,cost
      
  • Get node or relationship by id

    • ✓ Node by id

      MATCH (n)
      WHERE id(n)= 0
      RETURN n
      
    • ☒ Relationship by id

      MATCH ()-[r]->()
      WHERE id(r) = 0
      RETURN r
      
    • ✓ Multiple nodes by id

      MATCH (n)
      WHERE id(n) IN [0, 3, 5]
      RETURN n
      

2.3.RETURN

  • ✓ Return nodes

    MATCH (n {name: 'B'}) RETURN n
    

    Note

    Return id of n.

  • ✓ Return relationships

    MATCH (n {name: 'A'})-[r:KNOWS]->(c)
    RETURN r
    

    Note

    Return EdgeUid of r.

  • ✓ Return property

    MATCH (n {name: 'A'}) RETURN n.name
    
  • ❏ Return all elements

    MATCH p = (a {name: 'A'})-[r]->(b)
    RETURN *
    
  • ❏ Variable with uncommon characters

    MATCH (`This isn\'t a common variable`)
    WHERE `This isn\'t a common variable`.name = 'A'
    RETURN `This isn\'t a common variable`.happy
    
  • ✓ Aliasing a field

    MATCH (a {name: 'A'})
    RETURN a.age AS SomethingTotallyDifferent
    
  • ✓ Optional properties

    MATCH (n)
    RETURN n.age
    
  • ❏ Other expressions

    MATCH (a {name: 'A'})
    RETURN a.age > 30, "I'm a literal", (a)-[]->()
    

    (a)-[]->() not supported.

  • ✓ Unique results

    MATCH (a {name: 'A'})-[]->(b)
    RETURN DISTINCT b
    

2.4.WHERE

  • Basic usage

    • ✓ Boolean operations

      MATCH (n)
      WHERE n.name = 'Peter' XOR (n.age < 30 AND n.name = 'Tobias') OR NOT (n.name =
      'Tobias' OR n.name = 'Peter')
      RETURN n.name, n.age
      
    • ✓ Filter on node label

      MATCH (n)
      WHERE n:Swedish
      RETURN n.name, n.age
      
    • ✓ Filter on node property

      MATCH (n)
      WHERE n.age < 30
      RETURN n.name, n.age
      
    • ✓ Filter on relationship property

      MATCH (n)-[k:KNOWS]->(f)
      WHERE k.since < 2000
      RETURN f.name, f.age, f.email
      
    • ❏ Filter on dynamically-computed property

      WITH 'AGE' AS propname
      MATCH (n)
      WHERE n[toLower(propname)]< 30
      RETURN n.name, n.age
      
    • ✓ Property existence checking

      MATCH (n)
      WHERE exists(n.belt)
      RETURN n.name, n.belt
      
  • String matching

    • ✓ Match the beginning of a string

      MATCH (n)
      WHERE n.name STARTS WITH 'Pet'
      RETURN n.name, n.age
      
    • ✓ Match the ending of a string

      MATCH (n)
      WHERE n.name ENDS WITH 'ter'
      RETURN n.name, n.age
      
    • ✓ Match anywhere within a string

      MATCH (n)
      WHERE n.name CONTAINS 'ete'
      RETURN n.name, n.age
      
    • ✓ String matching negation

      MATCH (n)
      WHERE NOT n.name ENDS WITH 's'
      RETURN n.name, n.age
      
  • Using path patterns in WHERE

    • ✓ Filter on patterns

      MATCH (tobias {name: 'Tobias'}), (others)
      WHERE others.name IN ['Andres', 'Peter'] AND (tobias)<-[]-(others)
      RETURN others.name, others.age
      
    • ✓ Filter on patterns using NOT

      MATCH (persons), (peter {name: 'Peter'})
      WHERE NOT (persons)-[]->(peter)
      RETURN persons.name, persons.age
      
    • ✓ Filter on patterns with properties

      MATCH (n)
      WHERE (n)-[:KNOWS]-({name: 'Tobias'})
      RETURN n.name, n.age
      
    • ✓ Filter on relationship type

      MATCH (n)-[r]->()
      WHERE n.name='Andres' AND type(r) STARTS WITH 'K'
      RETURN type(r), r.since
      
  • Lists

    • ✓ IN operator

      MATCH (a)
      WHERE a.name IN ['Peter', 'Tobias']
      RETURN a.name, a.age
      
  • Missing properties and values

    • ✓ Default to false if property is missing

      MATCH (n)
      WHERE n.belt = 'white'
      RETURN n.name, n.age, n.belt
      
    • ✓ Default to true if property is missing

      MATCH (n)
      WHERE n.belt = 'white' OR n.belt IS NULL RETURN n.name, n.age, n.belt
      ORDER BY n.name
      
    • ✓ Filter on null

      MATCH (person)
      WHERE person.name = 'Peter' AND person.belt IS NULL RETURN person.name, person.age,
      person.belt
      
  • Using ranges

    • ✓ Simple range

      MATCH (a)
      WHERE a.name >= 'Peter'
      RETURN a.name, a.age
      
    • ✓ Composite range

      MATCH (a)
      WHERE a.name > 'Andres' AND a.name < 'Tobias'
      RETURN a.name, a.age
      

2.5.SKIP

  • ✓ Skip first three records

    MATCH (n)
    RETURN n.name
    ORDER BY n.name
    SKIP 3
    
  • ✓ Return middle two records

    MATCH (n)
    RETURN n.name
    ORDER BY n.name
    SKIP 1
    LIMIT 2
    
  • ✓ Using an expression with SKIP to return a subset of the records

    MATCH (n)
    RETURN n.name
    ORDER BY n.name
    SKIP toInteger(3*rand())+ 1
    

2.6.LIMIT

  • ✓ Return a subset of the records

    MATCH (n)
    RETURN n.name
    LIMIT 3
    
  • ✓ Using an expression with LIMIT to return a subset of the records

    MATCH (n)
    RETURN n.name
    LIMIT toInteger(3 * rand())+ 1
    

2.7.CREATE

  • Create nodes

    Note

    TuGraph does not support creating empty nodes and does not support multiple labels.

    • ☒ Create single node

      CREATE (n)
      
    • ☒ Create multiple nodes

      CREATE (n), (m)
      
    • ✓ Create a node with a label

      CREATE (n:Person)
      
    • ☒ Create a node with multiple labels

      CREATE (n:Person:Swedish)
      
    • ✓ Create node and add labels and properties

      CREATE (n:Person {name: 'Andres', title: 'Developer'})
      
    • ✓ Return created node

      CREATE (a {name: 'Andres'})
      RETURN a
      
  • Create relationships

    • ✓ Create a relationship between two nodes

      MATCH (a:Person), (b:Person)
      WHERE a.name = 'Node A' AND b.name = 'Node B'
      CREATE (a)-[r:RELTYPE]->(b)
      
    • ✓ Create a relationship and set properties

      MATCH (a:Person), (b:Person)
      WHERE a.name = 'Node A' AND b.name = 'Node B'
      CREATE (a)-[r:RELTYPE {name: a.name + '<->' + b.name}]->(b)
      
    • ✓ Create a full path

      CREATE p = (andres {name:'Andres'})-[:WORKS_AT]->(neo)<-[:WORKS_AT]-(michael {name:'Michael'})
      RETURN p
      
  • Use parameters with CREATE

    • ❏ Create node with a parameter for the properties

      CREATE (n:Person $props)
      RETURN n
      
    • ☒ Create multiple nodes with a parameter for their properties

      UNWIND $props AS map
      CREATE (n)
      SET n = map
      

      cannot create vertex without label.

2.8.CALL[…YIELD]

  • ✓ Call a procedure using CALL

    CALL db.vertexLabels
    
  • ✓ View the signature for a procedure

    CALL dbms.procedures() YIELD name, signature
    WHERE name='dbms.listConfig'
    RETURN signature
    
  • ❏ Call a procedure using a quoted namespace and name

    CALL `db`.`vertexLabels`
    
  • ✓ Call a procedure with literal arguments

    CALL org.opencypher.procedure.example.addNodeToIndex('users', 0, 'name')
    
  • ❏ Call a procedure with parameter arguments

    CALL org.opencypher.procedure.example.addNodeToIndex($indexName,$node,$propKey)
    
  • ❏ Call a procedure with mixed literal and parameter arguments

    CALL org.opencypher.procedure.example.addNodeToIndex('users', $node, 'name')
    
  • ✓ Call a procedure with literal and default arguments

    CALL org.opencypher.procedure.example.addNodeToIndex('users', 0)
    
  • ✓ Call a procedure within a complex query using CALL…YIELD

    CALL db.vertexLabels() YIELD label
    RETURN count(label) AS numLabels
    
  • ✓ Call a procedure and filter its results

    CALL db.vertexLabels() YIELD label
    WHERE label CONTAINS 'User'
    RETURN count(label) AS numLabels
    
  • ❏ Call a procedure within a complex query and rename its outputs

    CALL db.propertyKeys() YIELD propertyKey AS prop
    MATCH (n)
    WHERE n[prop] IS NOT NULL RETURN prop, count(n) AS numNodes
    

2.9.UNION

  • ✓ Combine two queries and retain duplicates

    MATCH (n:Actor)
    RETURN n.name AS name
    UNION ALL MATCH (n:Movie)
    RETURN n.title AS name
    
  • ❏ Combine two queries and remove duplicates

    MATCH (n:Actor)
    RETURN n.name AS name
    UNION
    MATCH (n:Movie)
    RETURN n.title AS name
    

3.Functions

3.1.Whole List Of Functions

Category

Function

Notes

Predicate functions

exists()

all()

Not supported

any()

Not supported

single()

Not supported

none()

Not supported

Scalar functions

id()

euid()

properties()

head()

last()

toBoolean()

toFloat()

toInteger()

toString()

type()

startnode()

endnode()

size()

length()

substring()

concat()

label()

OpenCypher extension method

Aggregating functions

avg()

collect()

count()

max()

min()

percentileCont()

percentileDisc()

stDev()

stDevP()

variance()

varianceP()

sum()

List functions

keys()

labels()

Returns a result with only one label

nodes()

range()

subscript()

Not supported

Mathematical functions

abs()

ceil()

3.2.Predicate functions

  • exists()

    judge it whether a vertex or edge has the field .

    Scope: whole instance.

    Example input:

    MATCH (n)
    WHERE exists(n.belt)
    RETURN n.name, n.belt
    

    Example output:

    exists(name)

    true

3.3.Scalar functions

  • id()

    get the id of vertex.

    Scope: whole instance.

    Example input:

    MATCH (a)
    RETURN id(a)
    

    Example output:

    vid

    1

    2

  • properties()

    get a map containing all the properties of a node or relationship.

    Scope: whole instance.

    Example input:

    CREATE (p:Person {name: 'Stefan', city: 'Berlin'})
    RETURN properties(p)
    

    Example output:

    properties

    {name:Stefan,city:Berlin}

  • head()

    get the first element of a list.

    Scope: whole instance.

    Example input:

    MATCH (a)
    WHERE a.name = 'Eskil'
    RETURN a.array, head(a.array)
    

    Example output:

    a.array

    head(a.array)

    [“one”,”two”,”three”]

    “one”

  • last()

    get the last element of a list.

    Scope: whole instance.

    Example input:

    MATCH (a)
    WHERE a.name = 'Eskil'
    RETURN a.array, last(a.array)
    

    Example output:

    a.array

    last(a.array)

    [“one”,”two”,”three”]

    “three”

  • toFloat()

    Converts an integer or string value to a floating point number.

    Scope: whole instance.

    Example input:

    RETURN toFloat('11.5'), toFloat('not a number')
    

    Example output:

    float

    11.5

    null

  • toInteger()

    Converts a floating point or string value to an integer value.

    Scope: whole instance.

    Example input:

    RETURN toInteger('2.3') AS integer
    

    Example output:

    integer

    2

  • toString()

    Converts an integer, float, boolean value to a string.

    Scope: whole instance.

    Example input:

    RETURN toString(2.3)
    
  • type()

    get the string representation of the relationship type.

    Scope: whole instance.

    Example input:

    MATCH (n)-[r]->()
    WHERE n.name = 'Alice'
    RETURN type(r)
    

    Example output:

    type

    acted_in

    acted_in

3.4.Aggregating functions

  • avg()

    Returns the average of a set of numeric values.

    Scope: whole instance.

    Example input:

    MATCH (n:Person)
    RETURN avg(n.age)
    

    Example output:

    avg(n.born)

    1869.2661654135338

  • collect()

    Returns a list containing the values returned by an expression.

    Scope: whole instance.

    Example input:

    MATCH (n:Person)
    RETURN collect(n.age)
    

    Example output:

    collect(n.born)

    [1967,…]

  • count()

    Returns the number of values or records.

    Scope: whole instance.

    Example input:

    MATCH (n {name: 'A'})-[]->(x)
    RETURN labels(n), n.age, count(*)
    

    Example output:

    labels(n)

    n.age

    count(*)

    [“Person”]

    13

    3

  • max()

    Returns the maximum value in a set of values.

    Scope: whole instance.

    Example input:

    MATCH (n:Person)
    RETURN max(n.age)
    

    Example output:

    max(n.age)

    44

  • min()

    Returns the minimum value in a set of values.

    Scope: whole instance.

    Example input:

    MATCH (n:Person)
    RETURN min(n.age)
    

    Example output:

    min(n.age)

    13

  • percentileCont()

    Returns the percentile of a value over a group using linear interpolation.

    Scope: whole instance.

    Example input:

    MATCH (n:Person)
    RETURN percentileCont(n.age, 0.4)
    

    Example output:

    percentileCont(n.age, 0.4)

    29

  • percentileDisc()

    Returns the nearest value to the given percentile over a group using a rounding method.

    Scope: whole instance.

    Output: the percentile of the given value over a group.

    Example input:

    MATCH (n:Person)
    RETURN percentileDisc(n.age, 0.5)
    

    Example output:

    percentileDisc(n.age, 0.5)

    33

  • stDev()

    Returns the standard deviation for the given value over a group for a sample of a population.

    Scope: whole instance.

    Example input:

    MATCH (n)
    WHERE n.name IN ['A', 'B', 'C']
    RETURN stDev(n.age)
    

    Example output:

    stDev(n.age)

    15.716233645501712

  • stDevP()

    Returns the standard deviation for the given value over a group for an entire population.

    Scope: whole instance.

    Example input:

    MATCH (n)
    WHERE n.name IN ['A', 'B', 'C']
    RETURN stDevP(n.age)
    

    Example output:

    stDevP(n.age)

    12.832251036613439

  • variance()

    Returns the variance for the given value over a group for a sample of a population.

    Scope: whole instance.

    Example input:

    MATCH (n)
    WHERE n.name IN ['A', 'B', 'C']
    RETURN variance(n.age)
    

    Example output:

    variance(n.age)

    247

  • varianceP()

    Returns the variance for the given value over a group for an entire population.

    Scope: whole instance.

    Example input:

    MATCH (n)
    WHERE n.name IN ['A', 'B', 'C']
    RETURN varianceP(n.age)
    

    Example output:

    varianceP(n.age)

    164.66666666667

  • sum()

    Returns the sum of a set of numeric values.

    Scope: whole instance.

    Example input:

    MATCH (n:Person)
    RETURN sum(n.age)
    

    Example output:

    sum(n.age)

    90

3.5.List Funtions:

  • keys()

    get the field names of some vertex.

    Scope: whole instance.

    Example input:

    MATCH (a)
    WHERE a.name = 'Alice'
    RETURN keys(a)
    

    Example output:

    keys(a)

    [“name”,”age”,”eyes”]

  • labels()/label()

    Returns a list containing the string representations for all the property names of a node, relationship, or map.

    Scope: whole instance.

    Example input:

    MATCH (a)
    WHERE a.name = 'Alice'
    RETURN labels(a)
    

    Example output:

    labels

    [“Person”,”Developer”]

  • nodes()

    Get vertex ids of a path

    Scope: whole instance.

    Example input:

    MATCH p = (from {name: 'Bob'})-[*1..]->(to {name: 'Alice'})
    RETURN nodes(p)
    

    Example output:

    nodes(p)

    [0, 1, 10, 12]

3.6.Mathematical functions

  • abs()

    get the absolute value of some data.

    Scope: whole instance.

    Example input:

    MATCH (a:person {name: 'Laurence Fishburne'}),(e:person {name: 'Carrie-Anne Moss'})
    RETURN a.born, e.born, abs(a.born-e.born)
    

    Example output:

    a.born

    e.born

    abs(a.born - e.born)

    1961

    1967

    6

  • ceil()

    Returns the smallest floating point number that is greater than or equal to a number and equal to a mathematical integer.

    Scope: whole instance. Example input:

    RETURN ceil(0.1)
    

    Example output:

    ceil(0.1)

    1.0

  • floor()

    get the largest floating point number that is less than or equal to the given number and equal to a mathematical integer.

    Scope: whole instance.

    Example input:

    RETURN floor(0.9)
    

    Example output:

    floor(0.9)

    0.0

  • round()

    Returns the value of a number rounded to the nearest integer.

    Scope: whole instance.

    Example input:

    RETURN round(3.141592)
    

    Example output:

    round

    3

  • rand()

    Returns returns a random floating point number in the range from 0 (inclusive) to 1 exclusive).

    Scope: whole instance.

    Example input:

    RETURN rand()
    

    Example output:

    rand()

    0.9797131960534085

  • sign()

    Get the signum of the given number: 0 if the number is 0, -1 for any negative number, and 1 for any positive number.

    Scope: whole instance.

    Example input:

    RETURN sign(-17), sign(0.1)
    

    Example output:

    sign(-17)

    sign(0.1)

    -1

    1

4.Extensions To OpenCypher

  • Number of Labels

    • TuGraph: Each node/relationship must have one and only one label. So error occurs when there is no label, and the 1st label will be picked as the label if there are more than one label.

    • OpenCypher: One node/relationship may have 0 to many labels.

  • Schema.

    • TuGraph: TuGraph has strong schema

    • OpenCypher: schema-less

5.Procedures

5.1.procedures’ demos

  • dbms.procedures()

    Lists all available procedures.

    Scope: whole instance.

    Output: a list of {signature, name}.

    Example input:

    CALL dbms.procedures()
    

    Example output:

    signature

    name

    db.vertexLabels() :: (label::STRING)

    db.vertexLabels

    db.edgeLabels() :: (edgeLabels::STRING)

    db.edgeLabels

    db.indexes() :: (index::LIST)

    db.indexes

  • db.vertexLabels()

    Lists all available labels of vertex.

    Scope: whole instance.

    Output: a list of {name}.

    Example input:

    CALL db.vertexLabels()
    

    Example output:

    label

    genre

    keyword

    movie

  • db.edgeLabels()

    Lists all available labels of edges.

    Scope: whole instance.

    Output: a list of {edgeLabels}.

    Example input:

    CALL db.edgeLabels()
    

    Example output:

    edgeLabel

    acted_in

    directed

  • db.createVertexLabel(label_name, primary_field, field_spec…)

    Create a vertex label.

    Scope: whole instance.

    Parameters:

    parameter

    parameter type

    description

    label_name

    string

    name of vertex label

    primary_field

    string

    primary field of vertex label

    field_spec

    list

    specification of a field

    in which each field_spec is a list of string in the form of [field_name, field_type, true], where true is specified only for optional fields.

    Output: If successful, it returns a success message.

    Example input:

    CALL db.createVertexLabel('Person', 'id', 'id', 'int64', false, 'name', 'string', true)
    

    Example output:

    Added label [Person]
    
  • db.getLabelSchema(label_type, label_name)

    Get the schema definition of the label in a subgraph.

    Scope: subgraph, as specified in the graph parameter in REST or RPC request.

    Parameters:

    parameter

    parameter type

    description

    label_type

    string

    either ‘vertex’ or ‘edge’

    label_name

    string

    name of the label

    Output: a list of label specifications, in which each element is a list of the following fields:

    field_name

    field_type

    description

    name

    string

    name of the field

    type

    string

    type of the field

    optional

    boolean

    whether the field is optional

    Example input:

    CALL db.getLabelSchema('vertex', 'Person')
    

    Example output:

    name

    type

    optional

    id

    INT32

    false

    born

    INT32

    true

    name

    STRING

    true

    poster_image

    STRING

    true

  • db.createLabel(label_type, label_name, extra, field_spec…)

    Create a vertex or edge label.

    Parameters:

    parameter

    parameter type

    description

    label_type

    string

    either ‘vertex’ or ‘edge’

    label_name

    string

    name of the label

    extra

    string

    for edge, it means constraints; for vertex, it means primary property

    field_spec

    list

    specification of a field

    in which each field_spec is a list of string in the form of [field_name, field_type, 'optional']. for edge, extra should be a json array string, like this [["label1","label2"], ["label3","label4"]], if edge has no constraints, give an empty json array, like this [] Output:

    If successful, it returns a success message.

    Example input:

    CALL db.createLabel('vertex', 'new_label', 'id', ['id','int32',false], ['name','string', true]);
    CALL db.createLabel('edge', 'new_edge', '[["id1","id2"]]', ['id','int32',false], ['name', 'string', true]);
    

    Example output:

    Vertex label [new_label] successfully added.
    
  • db.deleteLabel(label_type, label_name)

    Delete a vertex or edge label.

    Parameters:

    parameter

    parameter type

    description

    label_type

    string

    either ‘vertex’ or ‘edge’

    label_name

    string

    name of the label

    Output:

    field_name

    field_type

    description

    affected

    integer

    number of vertexes/edges deleted

    Example input:

    CALL db.deleteLabel('vertex', 'person')
    

    Example output:

    affected

    1024

  • db.alterLabelDelFields(label_type, label_name, field_names)

    Delete specified fields from the label.

    Parameters:

    parameter

    parameter type

    description

    label_type

    string

    either ‘vertex’ or ‘edge’

    label_name

    string

    name of the label

    field_names

    list of strings

    names of the fields to delete

    Output:

    field_name

    field_type

    description

    affected

    integer

    number of vertexes/edges modified

    Example input:

    CALL db.alterLabelDelFields('vertex', 'Person', ['name', 'image'])
    

    Example output:

    affected

    1024

  • db.alterLabelAddFields(label_type, label_name, field_value_spec…)

    Adds specified fields to the label.

    Parameters:

    parameter

    parameter type

    description

    label_type

    string

    either ‘vertex’ or ‘edge’

    label_name

    string

    name of the label

    field_value_spec

    list

    specification of a field

    in which each field_value_spec is a list of string in the form of [field_name, field_type, field_value, 'optional'], where: field_value is the default value of the field.

    Output:

    field_name

    field_type

    description

    affected

    integer

    number of vertexes/edges modified

    Example input:

    CALL db.alterLabelAddFields(
    'vertex',
    'new_label',
    ['birth_date', DATE, '', true],
    ['img', BLOB, '', true])
    

    Example output:

    affected

    1024

  • db.alterLabelModFields(label_type, label_name, field_spec…)

    Modifies the specified fields in the label.

    Parameters:

    parameter

    parameter type

    description

    label_type

    string

    either ‘vertex’ or ‘edge’

    label_name

    string

    name of the label

    field_spec

    list

    specification of a field

    in which each field_spec is a list of string in the form of [field_name, field_type, 'optional'].The target field should exist.

    Output:

    field_name

    field_type

    description

    affected

    integer

    number of vertexes/edges modified

    Example input:

    CALL db.alterLabelModFields(
    'vertex',
    'new_label',
    ['birth_date', 'DATETIME', '1900-01-01 00:00:00'],
    ['gender', 'BOOL', false])
    

    Example output:

    affected

    1024

  • db.createEdgeLabel( label_name, field_spec…)

    Create an edge label.

    Parameters:

    parameter

    parameter type

    description

    label_name

    string

    name of the label

    edge_constraints

    string

    edge constraints

    field_spec

    list

    specification of a field

    in which each field_spec is a list of string in the form of [field_name, field_type, optional], where optional is specified as true, only for optional fields.

  • edge_constraints is a json array string, This parameter limits the combination of starting and ending vertex of the edge, for example: '[["vertex_label1","vertex_label2"],["vertex_label3","vertex_label4"]]', which limits the edge direction can only be from vertex_label1 to vertex_label2 or from vertex_label3 to vertex_label4. If you don’t want to have any constraints, give an empty array string, like this '[]'

    Output:

    If successful, it returns a success message.

    Example input:

    CALL db.createEdgeLabel('KNOWS', '[]', 'name', 'int32',true)
    

    Example output:

    Added type [KNOWS]
    
  • db.addIndex(label_name, field_name, unique)

    create an index on some field of one vertex label .

    Parameters:

    parameter

    parameter type

    description

    label_name

    string

    name of the label

    field_name

    string

    specification of a field

    unique

    boolean

    Specifies whether the index is unique

    Output:

    If successful, it returns a success message.

    Example input:

    CALL db.addIndex('Person', 'id', true)
    

    Example output:

    Added index [Perosn:id]
    
  • db.addEdgeIndex(label_name, field_name, unique, pair_unique)

    create an index on some field of one edge label .

    Parameters:

    parameter

    parameter type

    description

    label_name

    string

    name of the label

    field_name

    string

    specification of a field

    unique

    boolean

    Specifies whether the index is unique

  • | pair_unique | boolean | Specifies whether the index is pair_unique |

    Output:

    If successful, it returns a success message.

    Example input:

    CALL db.addEdgeIndex('BornIn', 'id', true, false)
    

    Example output:

    Added index [BornIn:id]
    
  • dbms.security.changePassword(current_password ,new_password)

    Change the current user’s password.

    Parameters:

    parameter

    parameter type

    description

    current_password

    string

    the current password

    new_password

    string

    new password

    Output:

    If successful, it returns a success message.

    Example input:

    CALL dbms.security.changePassword('73@TuGraph','admin')
    

    Example output:

    true
    
  • dbms.security.changeUserPassword(user_name, new_password)

    Change the current user’s password.

    Parameters:

    parameter

    parameter type

    description

    user_name

    string

    the user’s name

    new_password

    string

    new password

    Output:

    If successful, it returns a success message.

    Example input:

    CALL dbms.security.changeUserPassword('quest','73@TuGraph')
    

    Example output:

    true
    
  • dbms.security.createUser(user_name, password)

    create new user on this graph database.

    Parameters:

    parameter

    parameter type

    description

    user_name

    string

    the new user name

    password

    string

    the password of new user

    Output:

    If successful, it returns a success message.

    Example input:

    CALL dbms.security.createUser('quest',"admin")
    

    Example output:

    true
    
  • dbms.security.deleteUser(user_name)

    delete user on this graph database.

    Parameters:

    parameter

    parameter type

    description

    user_name

    string

    the user name to be deleted

    Output:

    If successful, it returns a success message.

    Example input:

    CALL dbms.security.deleteUser('quest')
    

    Example output:

    true
    
  • dbms.security.listUsers()

    get all user’s name of the graph database.

    Output:

    a list of user names, in which each element is a list of the following fields:

    parameter

    parameter type

    description

    user.name

    string

    the user name

    is.admin

    boolean

    the permission of this user

    Example input:

    CALL dbms.security.listUsers()
    

    Example output:

    user.name

    is.admin

    admin

    true

  • dbms.security.showCurrentUser()

    get current user’s name.

    Output:

    a list of user names, in which each element is a list of the following fields:

    parameter

    parameter type

    description

    user.user

    string

    the current user name

    Example input:

    CALL dbms.security.showCurrentUser()
    

    Example output:

    user.name

    admin

  • dbms.security.listAllowedHosts()

    get the list of ips to be allowed .

    Output:

    a list of ips which are allowed.

    Example input:

    CALL dbms.security.listAllowedHosts()
    

    Example output:

    host

    192.168.1.22

  • dbms.security.deleteAllowedHosts(hosts)

    delete some ips from the list of ips to be allowed .

    Output:

    the number of ip which been deleted.

    Example input:

    CALL dbms.security.deleteAllowedHosts('192.168.1.22','192.168.1.23')
    

    Example output:

    success

    2

  • dbms.security.addAllowedHosts(hosts)

    add some ips from the list of ips to be allowed .

    Output:

    the number of ip which been added.

    Example input:

    CALL dbms.security.addAllowedHosts('192.168.1.22','192.168.1.23')
    

    Example output:

    success

    2

  • dbms.graph.createGraph(graph_name, description, max_size_GB)

    create a new subgraph in this graph database .

    Parameters:

    parameter

    parameter type

    description

    graph_name

    string

    the name of new subgraph

    description

    string

    description of new subgraph

    max_size_GB

    integer

    Upper limit of subgraph capacity

    Output:

    if successful , it will return true.

    Example input:

    CALL dbms.graph.createGraph('graph1', 'description', 2045)
    

    Example output:

    success

    true

  • dbms.graph.deleteGraph(graph_name)

    delete a subgraph in this graph database .

    parameter

    parameter type

    description

    graph_name

    string

    the name of subgraph to been deleted

    Output:

    if successful , it will return true.

    Example input:

    CALL dbms.graph.deleteGraph('graph1')
    

    Example output:

    success

    true

  • dbms.graph.modGraph(graph_name, config)

    delete a subgraph in this graph database .

    Parameters:

    parameter

    parameter type

    description

    graph_name

    string

    the name of subgraph to been deleted

    config

    map

    the configuration to be modified

    Output:

    if successful , it will return true.

    Example input:

    CALL dbms.graph.modGraph('graph1',{description:'this graph', max_size_GB:20})
    

    Example output:

    success

    true

  • dbms.graph.listGraphs()

    get all subgraph in this graph database .

    Output:

    a list of {subgraph and configuration}.

    Example input:

    CALL dbms.graph.listGraphs()
    

    Example output:

    graph.name

    configuration

    default

    {“description”:””,”max_size_GB”:1024}

    graph1

    {“description”:”this graph”,”max_size_GB”:20}

  • dbms.graph.listUserGraphs(user_name)

    get subgraph list which specified user can read or write

    Output:

    a list of {subgraph and configuration}.

    Example input:

    CALL dbms.graph.listUserGraphs("test_user")
    

    Example output:

    graph.name

    configuration

    default

    {“description”:””,”max_size_GB”:1024}

    graph1

    {“description”:”this graph”,”max_size_GB”:20}

  • dbms.config.list()

    get some config of this graph database .

    Output:

    a list of {configuration}.

    Example input:

    CALL dbms.config.list()
    

    Example output:

    name

    value

    bind_host

    0.0.0.0

    durable

    true

  • dbms.config.update(updates)

    get some config of this graph database .

    Output:

    If successful, it returns a success message

    Example input:

    CALL dbms.config.update({
        enable_ip_check:false,
        durable:true,
        optimistic_txn:true,
        enable_audit_log:true})
    

    Example output:

    Update succeeded.
    
  • dbms.takeSnapshot()

    take the snapshot on this current graph database.

    Output:

    If successful, it returns the path of snapshot.

    Example input:

    CALL dbms.takeSnapshot()
    

    Example output:

    path

    log/db/snapshot/2020-07-20_17.20.03

  • dbms.listBackupFiles()

    get the path of backuped files.

    Output:

    If successful, it returns the path of snapshot.

    Example input:

    CALL dbms.listBackupFiles()
    

    Example output:

    path

    tugraph/db/binlog/binlog_0

  • algo.shortestPath(startNode, endNode, config)

    get one of the shortest paths between two vertexes.

    Parameters:

    parameter

    parameter type

    description

    startNode

    Node

    the source node of paths

    endNode

    Node

    the destination node paths

    config

    MAP

    the filter of shortest paths, the formate as {maxHops:3, relationshipQuery:’HAS_CHILD’}

    Output:

    If successful, it will returns one group result of the shortest path.

    Example input:

    MATCH (n1 {name:'Hugo Weaving'}),(n2 {title:'The Matrix'})
    CALL algo.shortestPath(n1,n2) YIELD nodeCount,totalCost RETURN nodeCount,totalCost
    

    Example output:

    nodeCount

    totalCost

    2

    1

  • algo.allShortestPaths(startNode, endNode, config))

    get the path of backuped files.

    Output:

    If successful, it returns the path of snapshot.

    Example input:

    MATCH (n1 {name:'Hugo Weaving'}),(n2 {title:'The Matrix'})
    CALL algo.allShortestPaths(n1,n2) YIELD nodeIds,cost RETURN nodeIds,cost
    

    Example output:

    nodeIds

    cost

    [2,665]

    1

  • algo.algo.native.extract(id, config))

    get the field values of a list of vertexes or edges.

    Parameters:

    parameter

    parameter type

    description

    id

    ANY

    the id of vertexes or edges , the id must be variable

    config

    MAP

    the configuration of this extraction of vertexes or edges

    in which each config is a map in the form of {isNode:true, filed:'HAS_CHILD'}, if isNode is specified true, the id is a vertex id, or it is an edge id.

    Output:

    If successful, it returns a list of the value of vertexes or edges specified field .

    Example input:

    with [2,3] as vids CALL algo.native.extract(vids,{isNode:true, field:'id'})
    YIELD value  RETURN value
    

    Example output:

    value

    [4,5]

5.2.Whole List Of Procedures

Name

Description

Signature

db.vertexLabels

list all vertex labels

db.vertexLabels() :: (label::STRING)

db.edgeLabels

list all edge labels

db.edgeLabels() :: (edgeLabels::STRING)

db.indexes

list all indexes

db.indexes() :: (label::STRING,field::STRING,label_type:STRING,unique::BOOLEAN,pair_unique::BOOLEAN)

db.listLabelIndexes

list indexes by label

db.listLabelIndexes(label_name:STRING,label_type:STRING) :: (label::STRING,field::STRING,unique::BOOLEAN,pair_unique::BOOLEAN)

db.warmup

warm up the DB

db.warmup() :: (time_used::STRING)

db.createVertexLabel

create a vertex label

db.createVertexLabel(label_name::STRING,field_specs::LIST) :: (::VOID)

db.createLabel

create a vertex/edge label

db.createLabel(label_type::STRING,label_name::STRING,extra::STRING,field_specs::LIST) :: ()

db.getLabelSchema

get the schema of label

db.getLabelSchema(label_type::STRING,label_name::STRING) :: (name::STRING,type::STRING,optional::BOOLEAN)

db.getVertexSchema

get the schema of vertex label

db.getVertexSchema(label::STRING) :: (schema::MAP)

db.getEdgeSchema

get the schema of edge label

db.getEdgeSchema(label::STRING) :: (schema::MAP)

db.deleteLabel

delete vertex/edge label

db.deleteLabel(label_type::STRING,label_name::STRING) :: (::VOID)

db.alterLabelDelFields

delete some fields of a label on a subgraph

db.alterLabelDelFields(label_type::STRING,label_name::STRING,del_fields::LIST) :: (record_affected::INTEGER)

db.alterLabelAddFields

add some fields of a label on a subgraph

db.alterLabelAddFields(label_type::STRING,label_name::STRING,add_field_spec_values::LIST) :: (record_affected::INTEGER)

db.alterLabelModFields

modify some fields of a label on a subgraph

db.alterLabelModFields(label_type::STRING,label_name::STRING,mod_field_specs::LIST) :: (record_affected::INTEGER)

db.createEdgeLabel

create a edge label

db.createEdgeLabel(type_name::STRING,field_specs::LIST) :: (::VOID)

db.addIndex

add an index

db.addIndex(label_name::STRING,field_name::STRING,unique::BOOLEAN) :: (::VOID)

db.addEdgeIndex

add an index

db.addEdgeIndex(label_name::STRING,field_name::STRING,unique::BOOLEAN,pair_unique::BOOLEAN) :: (::VOID)

db.addVertexCompositeIndex

add composite index

db.addVertexCompositeIndex(label_name::STRING,field_names::LIST,unique::BOOLEAN) :: (::VOID)

db.deleteIndex

delete an index

db.deleteIndex(label_name::STRING,field_name::STRING) :: (::VOID)

db.backup

backup the db

db.backup(destination::STRING) :: ()

dbms.procedures

list all procedures

dbms.procedures() :: (name::STRING,signature::STRING)

dbms.security.changePassword

change current user password

dbms.security.changePassword(current_password::STRING,new_password::STRING) :: (::VOID)

dbms.security.changeUserPassword

change user password

dbms.security.changeUserPassword(user_name::STRING,new_password::STRING) :: (::VOID)

dbms.security.createUser

create an account

dbms.security.createUser(user_name::STRING,password::STRING) :: (::VOID)

dbms.security.deleteUser

delete an account

dbms.security.deleteUser(user_name::STRING) :: (::VOID)

dbms.security.listUsers

list all accounts

dbms.security.listUsers() :: (user_name::STRING,user_info::MAP)

dbms.security.showCurrentUser

get current user name

dbms.security.showCurrentUser() :: (current_user::STRING)

dbms.security.getUserPermissions

get the permissions of a specified user

dbms.security.getUserPermissions(user_name::STRING) :: (user_info::MAP)

dbms.graph.createGraph

create a subgraph

dbms.graph.createGraph(graph_name::STRING, description::STRING, max_size_GB::INTEGER) :: (::VOID)

dbms.graph.modGraph

modify the config of a subgraph

dbms.graph.modGraph(graph_name::STRING,config::MAP) :: (::VOID)

dbms.graph.deleteGraph

delete a subgraph

dbms.graph.deleteGraph(graph_name::STRING) :: (::VOID)

dbms.graph.listGraphs

list all subgraphs

dbms.graph.listGraphs() :: (graph_name::STRING,configuration::MAP)

dbms.graph.getGraphInfo

get the information of a specified graph

dbms.graph.getGraphInfo(graph_name::STRING)::(graph_name::STRING,configuration::MAP)

dbms.security.addAllowedHosts

add to the trust list

dbms.security.addAllowedHosts(hosts::LIST) :: (num_new::INTEGER)

dbms.security.deleteAllowedHosts

remove from the trust list

dbms.security.deleteAllowedHosts(hosts::LIST) :: (record_affected::INTEGER)

dbms.security.listAllowedHosts

list the trust list

dbms.security.listAllowedHosts() :: (host::STRING)

dbms.config.update

update the configuration

dbms.config.update(updates::MAP) :: (message::STRING)

dbms.config.list

list the configuration

dbms.config.list() :: (name::STRING,value::ANY)

algo.shortestPath

get a shortest path between two vertexes

algo.shortestPath(startNode::NODE,endNode::NODE,config::MAP) :: (nodeCount::INTEGER,totalCost::FLOAT)

algo.allShortestPaths

get all the shortest paths between two vertexes

algo.allShortestPaths(startNode::NODE,endNode::NODE,config::MAP) :: (nodeIds::LIST,relationshipIds::LIST,cost::LIST)

algo.native.extract

get the field values of a list of vertexes or edges specified id

algo.native.extract(id::ANY,config::MAP) :: (value::ANY)

db.flushDB

flush the db

db.flushDB() :: (::VOID)

dbms.security.listRoles

list all roles

dbms.security.listRoles() :: (role_name::STRING,role_info::MAP)

dbms.security.createRole

create a role

dbms.security.createRole(role_name::STRING,desc::STRING) :: (::VOID)

dbms.security.deleteRole

delete a role

dbms.security.deleteRole(role_name::STRING) :: (::VOID)

dbms.security.getRoleInfo

get the role information

dbms.security.getRoleInfo(role::STRING) :: (role_info::MAP)

dbms.security.disableRole

enable/disable the role

dbms.security.disableRole(role::STRING,disable::BOOLEAN) :: (::VOID)

dbms.security.modRoleDesc

modify the description of a role

dbms.security.modRoleDesc(role::STRING,description::STRING) :: (::VOID)

dbms.security.rebuildRoleAccessLevel

rebuild the user subgraph access rights

dbms.security.rebuildRoleAccessLevel(role::STRING,access_level::MAP) :: (::VOID)

dbms.security.modRoleAccessLevel

modify the user subgraph access rights

dbms.security.modRoleAccessLevel(role::STRING,access_level::MAP) :: (::VOID)

dbms.security.modRoleFieldAccessLevel

modify the user property access rights

dbms.security.modRoleFieldAccessLevel(role::STRING,graph::STRING,label::STRING,field::STRING,label_type::STRING,field_access_level::STRING) :: (::VOID)

dbms.security.getUserInfo

get the user information

dbms.security.getUserInfo(user::STRING) :: (user_info::MAP)

dbms.security.getUserMemoryUsage

get the memory usage for a user

dbms.security.getUserMemoryUsage(user::STRING) :: (memory_usage::INTEGER)

dbms.security.disableUser

enable/disable the user

dbms.security.disableUser(user::STRING,disable::BOOLEAN) :: (::VOID)

dbms.security.setCurrentDesc

set the current user description

dbms.security.setCurrentDesc(description::STRING) :: (::VOID)

dbms.security.setUserDesc

set user description

dbms.security.setUserDesc(user::STRING,description::STRING) :: (::VOID)

dbms.security.setUserMemoryLimit

set user memory limit

dbms.security.setUserMemoryLimit(user::STRING,memorylimit::INTEGER) :: (::VOID)

dbms.security.deleteUserRoles

delete roles from the user

dbms.security.deleteUserRoles(user::STRING,roles::LIST) :: (::VOID)

dbms.security.rebuildUserRoles

rebuild the relationship between the user and the role

dbms.security.rebuildUserRoles(user::STRING,roles::LIST) :: (::VOID)

dbms.security.addUserRoles

add the user roles

dbms.security.addUserRoles(user::STRING,roles::LIST) :: (::VOID)

db.plugin.loadPlugin

load a plugin

db.plugin.loadPlugin(plugin_type::STRING,plugin_name::STRING,plugin_content::STRING or MAP,code_type::STRING,plugin_description::STRING,read_only::BOOLEAN, version::STRING) :: (::VOID)

db.plugin.deletePlugin

unload a plugin

db.plugin.deletePlugin(plugin_type::STRING,plugin_name::STRING) :: (::VOID)

db.plugin.listPlugin

list all plugins

db.plugin.listPlugin(plugin_type::STRING,plugin_version::STRING) :: (plugin_description::LIST)

db.plugin.getPluginInfo

get the information of a specified plugin

db.plugin.getPluginInfo(plugin_type::STRING,plugin_name::STRING,show_code::BOOLEAN)::(plugin_description::MAP)

db.plugin.callPlugin

execute the plugins

db.plugin.callPlugin(plugin_type::STRING,plugin_name::STRING,param::STRING,timeout::DOUBLE,in_process::BOOLEAN) :: (success::BOOLEAN,result::STRING)

db.importor.dataImportor

import vertex/edge data

db.importor.dataImportor(description::STRING,content::STRING,continue_on_error::BOOLEAN,thread_nums::INTEGER,delimiter::STRING) :: (::VOID)

db.importor.schemaImportor

import vertex/edge schema

db.importor.schemaImportor(description::STRING) :: (::VOID)

dbms.meta.count

get the total number of vertex and edge

db.dbms.meta.count() :: (type::STRING, number::INTEGER)

dbms.meta.countDetail

get the number of vertex and edge for each label

db.dbms.meta.countDetail() :: (is_vertex::BOOLEAN, label::STRING, count::INTEGER)

dbms.meta.refreshCount

recount the number of vertex and edge, stop writing during the count

db.dbms.meta.refreshCount() :: (::VOID)

dbms.task.listTasks

list running tasks

dbms.task.listTasks()::(tasks::LIST)

dbms.task.terminateTask

terminate task

dbms.task.terminateTask(task_id::STRING)::(::VOID)

dbms.ha.clusterInfo

get cluster info in HA mode

dbms.ha.clusterInfo() :: (cluster_info::LIST, is_master::BOOLEAN)

db.dropDB

empty the db

db.dropDB() :: (::VOID)