跳转到主要内容

文档 1.7 版本已不再积极维护,你当前浏览的是一份归档快照。 最新文档请参阅 最新版本。

Cypher API

9.1 Cypher

9.1.1 向 HugeGraphServer 发送 Cypher 语句(GET),同步执行

Method & Url
1GET /graphspaces/{graphspace}/graphs/{graph}/cypher?cypher={cypher}
Params

路径参数说明:

  • graphspace: 图空间名称
  • graph: 图名称

请求参数说明:

  • cypher: cypher 语句
使用示例
1GET
2http://localhost:8080/graphspaces/DEFAULT/graphs/hugecypher1/cypher?cypher=match(n:person) return n.name as name order by n.name limit 1
Response Status
1200
Response Body
 1{
 2    "requestId": "766b9f48-2f10-40d9-951a-3027d0748ab7",
 3    "status": {
 4        "message": "",
 5        "code": 200,
 6        "attributes": {
 7        }
 8    },
 9    "result": {
10        "data": [
11            {
12                "name": "hello"
13            }
14        ],
15        "meta": {
16        }
17    }
18}

9.1.2 向 HugeGraphServer 发送 Cypher 语句(POST),同步执行

Method & Url
1POST /graphspaces/{graphspace}/graphs/{graph}/cypher
Params

路径参数说明:

  • graphspace: 图空间名称
  • graph: 图名称
Body

{cypher}

  • cypher: cypher 语句

注意:

不是 JSON 格式,是纯文本的 Cypher 语句

使用示例
1POST
2http://localhost:8080/graphspaces/DEFAULT/graphs/hugecypher1/cypher
Request Body
1match(n:person) return n.name as name order by n.name limit 1
Response Status
1200
Response Body
 1{
 2    "requestId": "f096bee0-e249-498f-b5a3-ea684fc84f57",
 3    "status": {
 4        "message": "",
 5        "code": 200,
 6        "attributes": {
 7        }
 8    },
 9    "result": {
10        "data": [
11            {
12                "name": "hello"
13            }
14        ],
15        "meta": {
16        }
17    }
18}