Amazon Neptune OpenPher HTTPS 终端节点 - Amazon Neptune
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Amazon Neptune OpenPher HTTPS 终端节点

OpenPher 在 HTTPS 终端节点上读写查询

OpenPher HTTPS 终端节点支持读取和更新查询,同时使用GETPOST方法。这些区域有:DELETEPUT不支持方法。

语法如下:

HTTPS://(the server):(the port number)/openCypher

以下是示例读取查询,使用POST还有一个使用GET

1. 使用POST

curl HTTPS://server:port/openCypher \ -d "query=MATCH (n1) RETURN n1;"

2. 使用GET(查询字符串是 URL 编码的):

curl -X GET \ "HTTPS://server:port/openCypher?query=MATCH%20(n1)%20RETURN%20n1"

以下是写入/更新查询示例,使用POST还有一个使用GET

1. 使用POST

curl HTTPS://server:port/openCypher \ -d "query=CREATE (n:Person { age: 25 })"

2. 使用GET(查询字符串是 URL 编码的):

curl -X GET \ "HTTPS://server:port/openCypher?query=CREATE%20(n%3APerson%20%7B%20age%3A%2025%20%7D)"

默认的 OpenPher JSON 结果格式

默认情况下,将返回以下 JSON 格式,或者通过将请求标头显式设置为Accept: application/json. 这种格式旨在使用大多数库的本地语言功能轻松解析为对象。

返回的 JSON 文档包含一个字段,results中包含查询返回值。下面的示例显示了常见值的 JSON 格式。

示例价值响应:

{ "results": [ { "count(a)": 121 } ] }

节点响应示例:

{ "results": [ { "a": { "~id": "22", "~entityType": "node", "~labels": [ "airport" ], "~properties": { "desc": "Seattle-Tacoma", "lon": -122.30899810791, "runways": 3, "type": "airport", "country": "US", "region": "US-WA", "lat": 47.4490013122559, "elev": 432, "city": "Seattle", "icao": "KSEA", "code": "SEA", "longest": 11901 } } } ] }

关系响应示例:

{ "results": [ { "r": { "~id": "7389", "~entityType": "relationship", "~start": "22", "~end": "151", "~type": "route", "~properties": { "dist": 956 } } } ] }

路径响应示例:

{ "results": [ { "p": [ { "~id": "22", "~entityType": "node", "~labels": [ "airport" ], "~properties": { "desc": "Seattle-Tacoma", "lon": -122.30899810791, "runways": 3, "type": "airport", "country": "US", "region": "US-WA", "lat": 47.4490013122559, "elev": 432, "city": "Seattle", "icao": "KSEA", "code": "SEA", "longest": 11901 } }, { "~id": "7389", "~entityType": "relationship", "~start": "22", "~end": "151", "~type": "route", "~properties": { "dist": 956 } }, { "~id": "151", "~entityType": "node", "~labels": [ "airport" ], "~properties": { "desc": "Ontario International Airport", "lon": -117.600997924805, "runways": 2, "type": "airport", "country": "US", "region": "US-CA", "lat": 34.0559997558594, "elev": 944, "city": "Ontario", "icao": "KONT", "code": "ONT", "longest": 12198 } } ] } ] }