Cypher API

此文档主要介绍了TuGraph-Cypher的详细使用说明

1.Operators

1.1.Summary

Operators支持进度一览:

类别

支持

待支持

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

MATCH (p:person) RETURN DISTINCT p.born
  • ❏ 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: +

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支持进度一览:

类别

语法

备注

Reading clauses

MATCH

支持

OPTIONAL MATCH

支持

MANDATORY MATCH

待支持

Projecting clauses

RETURN … [AS]

支持

WITH … [AS]

支持

UNWIND … [AS]

支持

Reading sub-clauses

WHERE

支持

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

支持

SKIP

支持

LIMIT

支持

Writing clauses

CREATE

支持

DELETE

支持

DETACH DELETE

支持

SET

支持

REMOVE

支持

Reading/Writing clauses

MERGE

支持

CALL […YIELD]

支持

Set operations

UNION

待支持

UNION ALL

支持

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 (person {name: 'Laurence Fishburne'})-[]-(movie)
    RETURN movie.title
    
    • ✓ Match with labels

    MATCH (:person {name: 'Laurence Fishburne'})-[]-(movie:movie)
    RETURN movie.title
    
  • Relationship basics

    • ✓ Outgoing relationships

    MATCH (:person {name: 'Laurence Fishburne'})-[]->(movie)
    RETURN movie.title
    
    • ✓ Directed relationships and variable

    MATCH (:person {name: 'Laurence Fishburne'})-[r]->(movie)
    RETURN type(r)
    
    • ✓ Match on relationship type

    MATCH (matrix:movie {title: 'The Matrix'})<-[:acted_in]-(actor)
    RETURN actor.name
    
    • ✓ Match on multiple relationship types

    MATCH (matrix {title: 'The Matrix'})<-[:acted_in|:directed]-(person)
    RETURN person.name
    
    • ✓ Match on relationship type and use a variable

    MATCH (matrix {title: 'The Matrix'})<-[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 (laurence {name: 'Laurence Fishburne'})-[:acted_in]->(movie)<-[:directed]-(director)
    RETURN movie.title, director.name
    
    • ✓ Variable-length relationships

    MATCH (laurence {name: 'Laurence Fishburne'})-[:acted_in*1..3]-(movie:movie)
    RETURN movie.title
    
    • ✓ Relationship variable in variable-length relationships

    MATCH p = (laurence {name: 'Laurence Fishburne'})-[:acted_in*2]-(co_actor)
    RETURN 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 (matrix:movie {title: 'The Matrix'})-[*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 euid(r)="0_3937_0_0_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 euid(r) = "0_3937_0_0_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: 'Carrie-Anne Moss'}) RETURN n
  • ✓ Return relationships

MATCH (n {name: 'Carrie-Anne Moss'})-[r:acted_in]->(c)
RETURN r
  • ✓ Return property

MATCH (n {name: 'Carrie-Anne Moss'}) RETURN n.born
  • ❏ 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: 'Carrie-Anne Moss'})
RETURN a.born AS SomethingTotallyDifferent
  • ✓ Optional properties

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

MATCH (a {name: 'Carrie-Anne Moss'})
RETURN a.born > 1900, "I'm a literal", (a)-[]->()

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

  • ✓ Unique results

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

2.4.WHERE

  • Basic usage

    • ✓ Boolean operations

    MATCH (n)
    WHERE n.name = 'Laurence Fishburne' XOR (n.born > 1965 AND n.name = 'Carrie-Anne Moss')
    RETURN n.name, n.born
    
    • ✓ Filter on node label

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

    MATCH (n)
    WHERE n.born > 2000
    RETURN n.name, n.born
    
    • ✓ Filter on relationship property

    MATCH (n)-[k:acted_in]->(f)
    WHERE k.role = "Trinity"
    RETURN f.title
    
    • ❏ 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.born)
    RETURN n.name, n.born
    
  • String matching

    • ✓ Match the beginning of a string

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

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

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

    MATCH (n)
    WHERE NOT n.name ENDS WITH 's'
    RETURN n.name, n.born
    
  • 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='Laurence Fishburne' AND type(r) STARTS WITH 'ac'
    RETURN type(r), r.role
    
  • Lists

    • ✓ IN operator

    MATCH (a)
    WHERE a.name IN ['Laurence Fishburne', 'Tobias']
    RETURN a.name, a.born
    
  • 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.born
    
    • ✓ Composite range

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

2.5.SKIP

  • ✓ Skip first three records

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

MATCH (n:person)
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:person)
RETURN n.name
ORDER BY n.name
SKIP toInteger(3*rand())+ 1

2.6.LIMIT

  • ✓ Return a subset of the records

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

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

2.7.CREATE

  • Create nodes

Note TuGraph不支持创建空的nodes,不支持多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 {id:2001, name: 'Andres'})
  • ✓ Return created node

CREATE (n:person {id:2002, name: 'Andres'})
RETURN n
  • Create relationships

    • ✓ Create a relationship between two nodes

    MATCH (n:person), (m:movie)
    WHERE n.name = 'Jada Pinkett Smith' AND m.title = 'The Matrix'
    CREATE (n)-[r:write]->(m)
    
    • ✓ Create a relationship and set properties

    MATCH (n:person), (m:movie)
    WHERE n.name = 'Jada Pinkett Smith' AND m.title = 'The Matrix'
    CREATE (n)-[r:acted_in{role: 'Trinity'}]->(m)
    
    • ❏ Create a full path

    CREATE p = (andres:person {id: 2005, name:'Andres'})-[:acted_in {role: 'Trinity'}]->
    (m:movie {id: 2006})<-[:acted_in {role: 'Trinity'}]-(michael {id: 2006, 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
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:person)
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

种类

功能

备注

Predicate functions

exists()

all()

不支持

any()

不支持

single()

不支持

none()

不支持

Scalar functions

id()

euid()

properties()

head()

last()

toBoolean()

toFloat()

toInteger()

toString()

type()

startnode()

endnode()

size()

length()

substring()

concat()

label()

OpenCypher扩展方法

Aggregating functions

avg()

collect()

count()

max()

min()

percentileCont()

percentileDisc()

stDev()

stDevP()

variance()

varianceP()

sum()

List functions

keys()

labels()

返回结果有且只有一个label

nodes()

range()

subscript()

不支持

Mathematical functions

abs()

ceil()

floor()

rand()

round()

sign()

String functions

/

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.born)
RETURN n.name, n.born

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:

MATCH (n:person {name: 'Laurence Fishburne'})
RETURN n
  • head() get the first element of a list. Scope: whole instance. Example input:

WITH ['one','two','three'] AS coll RETURN coll, head(coll)

Example output:

coll

head(coll)

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

“one”

  • last() get the last element of a list. Scope: whole instance. Example input:

WITH ['one','two','three'] AS coll RETURN coll, last(coll)

Example output:

coll

last(coll)

[“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')

Example output:

float

11.5

  • 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 = 'Laurence Fishburne'
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.born)

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.born)

Example output:

collect(n.born)

[1967,…]

  • count() Returns the number of values or records. Scope: whole instance. Example input:

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

Example output:

labels(n)

n.born

count(*)

[“person”]

1961

3

  • max() Returns the maximum value in a set of values. Scope: whole instance. Example input:

MATCH (n:person)
RETURN max(n.born)

Example output:

max(n.born)

2003

  • min() Returns the minimum value in a set of values. Scope: whole instance. Example input:

MATCH (n:person)
RETURN min(n.born)

Example output:

min(n.born)

1000

  • percentileCont() Returns the percentile of a value over a group using linear interpolation. Scope: whole instance. Example input:

MATCH (n:person)
RETURN percentileCont(n.born, 0.4)

Example output:

percentileCont(n.born, 0.4)

1953

  • 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.born, 0.5)

Example output:

percentileDisc(n.age, 0.5)

1959

  • 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)
RETURN stDev(n.born)

Example output:

stDev(n.born)

279.53117993401725

  • stDevP() Returns the standard deviation for the given value over a group for an entire population. Scope: whole instance. Example input:

MATCH (n)
RETURN stDevP(n.born)

Example output:

stDevP(n.born)

279.3209270423399

  • variance() Returns the variance for the given value over a group for a sample of a population. Scope: whole instance. Example input:

MATCH (n)
RETURN variance(n.born)

Example output:

variance(n.age)

78137.68055530392

  • varianceP() Returns the variance for the given value over a group for an entire population. Scope: whole instance. Example input:

MATCH (n)
RETURN varianceP(n.born)

Example output:

varianceP(n.age)

78020.18028379219

  • sum() Returns the sum of a set of numeric values. Scope: whole instance. Example input:

MATCH (n:person)
RETURN sum(n.born)

Example output:

sum(n.born)

1243062

3.5.List Funtions:

  • keys() get the field names of some vertex. Scope: whole instance. Example input:

MATCH (a)
RETURN keys(a) LIMIT 1

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)
RETURN labels(a) LIMIT 1

Example output:

labels

[“Person”]

  • 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)

38

41

1

  • 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

TuGraph 查询语言与 OpenCypher 的不同点如下:

  • Label 数量

    • 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

4.附录1. 语法扩充及不同

TuGraph查询语言与OpenCypher的不同点如下:

  • Label数量

    • 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.附录2. 内置procedures列表

5.1.procedures样例

  • 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.subgraph()

    Scope: whole instance.

    Parameters:

    parameter

    parameter type

    description

    vids

    list

    list of vertex id

    Output:

    Get a json containing all the properties of nodes and relationships.

    Example input:

    CALL db.subgraph([3937,4126,4066,4010])
    

    Example output

    subgraph

    {“nodes”:[{“identity”:3937,”label”:”movie”,”properties”:{“duration”:136,”id”:1,”poster_image”:”http://image.tmdb.org/t/p/w185/gynBNzwyaHKtXqlEKKLioNkjKgN.jpg”,”rated”:”R”,”summary”:”Thomas A. Anderson is a man living two lives. By day he is an average computer programmer and by night a malevolent hacker known as Neo who finds himself targeted by the police when he is contacted by Morpheus a legendary computer hacker who reveals the shocking truth about our reality.”,”tagline”:”Welcome to the Real World.”,”title”:”The Matrix”}},{“identity”:4010,”label”:”user”,”properties”:{“id”:44,”login”:”Howard”}},{“identity”:4066,”label”:”user”,”properties”:{“id”:202,”login”:”Enoch”}},{“identity”:4126,”label”:”user”,”properties”:{“id”:464,”login”:”Wilburn”}}],”relationships”:[{“dst”:4126,”forward”:true,”identity”:0,”label”:”is_friend”,”label_id”:3,”src”:4010,”temporal_id”:0},{“dst”:4010,”forward”:true,”identity”:0,”label”:”is_friend”,”label_id”:3,”src”:4066,”temporal_id”:0},{“dst”:4066,”forward”:true,”identity”:0,”label”:”is_friend”,”label_id”:3,”src”:4126,”temporal_id”:0}]}

  • db.vertexLabels()

    Lists all available vertex 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 {edge labels}.

    Example input:

    CALL db.edgeLabels()
    

    Example output:

    relationshipType

    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, true],
    ['gender', BOOL, true])
    

    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 subgraphs 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 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.内置procedures完整列表

Name

Description

Signature

db.subgraph

列出点的子图

db.subgraph(vids::LIST) :: (subgraph::STRING)

db.vertexLabels

列出所有Vertex Label

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

db.edgeLabels

列出所有Edge Label

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

db.indexes

列出所有索引

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

db.listLabelIndexes

列出所有与某个Label相关的索引

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

db.warmup

预热数据

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

db.createVertexLabel

创建Vertex Label

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

db.createLabel

创建Vertex/Edge Label

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

db.getLabelSchema

列出label schema

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

db.getVertexSchema

列出点的 schema

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

db.getEdgeSchema

列出边的 schema

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

db.deleteLabel

删除Vertex/Edge Label

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

db.alterLabelDelFields

修改label删除属性

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

db.alterLabelAddFields

修改label添加field

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

db.alterLabelModFields

修改label field

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

db.createEdgeLabel

创建Edge Label

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

db.addIndex

创建索引

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

db.addEdgeIndex

创建索引

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

db.deleteIndex

删除索引

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

db.backup

备份数据

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

dbms.procedures

列出所有procedures

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

dbms.security.changePassword

更改当前用户的密码

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

dbms.security.changeUserPassword

更改指定用户的密码

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

dbms.security.createUser

创建用户

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

dbms.security.deleteUser

删除用户

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

dbms.security.listUsers

列出所有用户

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

dbms.security.showCurrentUser

列出当前用户信息

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

dbms.security.getUserPermissions

列出指定用户的权限

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

dbms.graph.createGraph

创建子图

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

dbms.graph.modGraph

修改子图属性

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

dbms.graph.deleteGraph

删除子图

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

dbms.graph.listGraphs

列出所有子图

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

dbms.graph.getGraphInfo

列出指定子图的信息

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

dbms.security.addAllowedHosts

添加ip到信任列表

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

dbms.security.deleteAllowedHosts

从信任列表删除ip

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

dbms.security.listAllowedHosts

列出信任列表中的主机ip

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

dbms.config.update

更新TuGraph配置

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

dbms.config.list

列出TuGraph配置

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

algo.shortestPath

查询两个点间的最短路径

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

algo.allShortestPaths

查询两个点间的所有最短路径

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

algo.native.extract

查询指定VertexId/EdgeUid(列表)指定field的值(列表)

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

db.flushDB

刷新db

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

dbms.security.listRoles

列出所有角色

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

dbms.security.createRole

创建角色

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

dbms.security.deleteRole

删除角色

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

dbms.security.getRoleInfo

获取角色详细信息

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

dbms.security.disableRole

禁用/启用角色

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

dbms.security.modRoleDesc

修改角色描述信息

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

dbms.security.rebuildRoleAccessLevel

删除角色权限并重建

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

dbms.security.modRoleAccessLevel

修改角色对指定图的访问权限

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

dbms.security.modRoleFieldAccessLevel

修改角色对指定属性的访问权限

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

dbms.security.getUserInfo

获取用户详细信息

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

dbms.security.disableUser

禁用/启用用户

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

dbms.security.setCurrentDesc

设置当前用户描述信息

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

dbms.security.setUserDesc

设置用户描述信息

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

dbms.security.getUserMemoryUsage

获取用户内存用量

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

dbms.security.setUserMemoryLimit

设置用户内存限制

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

dbms.security.deleteUserRoles

删除用户与角色的联系

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

dbms.security.rebuildUserRoles

清空用户角色的关系并重建

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

dbms.security.addUserRoles

新增用户与角色的联系

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

db.plugin.loadPlugin

装载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

删除plugin

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

db.plugin.listPlugin

列出已装载的plugin

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

db.plugin.getPluginInfo

获取plugin的详细信息

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

db.plugin.callPlugin

执行plugin

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

db.importor.dataImportor

导入点或边数据

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

db.importor.schemaImportor

导入点或边schema

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

db.addFullTextIndex

添加全文索引

db.addFullTextIndex(is_vertex::BOOLEAN, label_name::STRING, field_name::STRING) :: (::VOID)

db.deleteFullTextIndex

删除全文索引

db.deleteFullTextIndex(is_vertex::BOOLEAN, label_name::STRING, field_name::STRING) :: (::VOID)

db.rebuildFullTextIndex

重建全文索引

db.rebuildFullTextIndex(vertex_labels::STRING, edge_labels::STRING) :: (::VOID)

db.fullTextIndexes

查看全文索引

db.fullTextIndexes() :: (is_vertex::BOOLEAN, label::STRING, field::STRING)

dbms.meta.count

查看点边总数

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

dbms.meta.countDetail

查看点边总数详情

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

dbms.meta.refreshCount

重新统计点边数量,统计期间停写。

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

dbms.task.listTasks

查询正在执行的任务

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

dbms.task.terminateTask

中止任务

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

dbms.ha.clusterInfo

HA模式下查看集群状态

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

db.dropDB

清空数据库

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