2

我在 bluemix 上创建了一个 IBM Graph 服务实例并创建了一些顶点。当我尝试发出 gremlin 查询以查找我创建的顶点之一时,我收到“内部错误”。

这是我正在使用的查询

创建顶点
curl -u username-password -H 'Content-Type: application/json' -d '{ "label":"movie","properties":{"Name": "Million Dollar Baby","Type" : "电影"} }' -X POST " http://../g/vertices "

回复 {"requestId":" 07f29cea
-25b3-4305-b74b-540466206872","status":{"message":"","code":200,"attributes":{}},"result":{"数据":[{ "id":8336 ,"label":"movie","type":"vertex","properties": {"Type":[{"id":"36a-6fk-1l1", "value":"Movie"} ],"Name":[{"id":"2s2-6fk-sl","value":"百万宝贝"}]}}],"meta":{}} }

查询顶点是否有Type属性'movie'
curl -u username-password -H 'Content-Type: application/json' -d '{"gremlin": "def g = graph.traversal(); gV(). has('Type','movie')"}' -X POST " http://../g/gremlin "

响应(错误)
{"code":"InternalError","message":""}

4

1 回答 1

4

IBM Graph 要求用户为他们要针对其发出查询的任何属性创建索引。在这种情况下,“类型”是一个属性,包含在 gremlin 查询中。

您需要使用 bluemix 中的 IBM Graph 服务提供的 /schema 端点创建索引。

服务入门指南 http://ibm-graph-docs.ng.bluemix.net/gettingstarted.html中提供了一个示例

于 2016-01-25T15:56:50.953 回答