0

Technology Stack:

  • Tinkerpop Stack 2.4 (Rexster HTTP REST Server)
  • Titan 0.5.4
  • DynamoDB (AWS)
  • NodeJS

Goal:

I would like to utilize the Rexster RESTful based API for querying and traversals of my graph database. I am trying to understand the _properties query parameter for filtering results based on Vertex Query syntax.

Result of Vertices Query:

http://localhost:8182/graphs/mygraph/vertices { "version": "2.5.0", "results": [ { "name": "Frank Stein", "_id": 25600768, "_type": "vertex" }, { "name": "John Doe", "_id": 25600512, "_type": "vertex" } ], "totalSize": 2, "queryTime": 219.86688 }

Result of Edge Query:

http://localhost:8182/graphs/mygraph/vertices

{ "version": "2.5.0", "results": [ { "_id": "f8q68-f8phc-4is5-f8pog", "_type": "edge", "_outV": 25600512, "_inV": 25600768, "_label": "friends" } ], "totalSize": 1, "queryTime": 164.384768 }

Problem:

These URI's do not return what I am assuming I would get returned, always return an empty set.:

Requests:

_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,"John Doe"]] _http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,John Doe]] _http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,(s,"John Doe")]] _http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,(s,John Doe)]]

Response:

{ "version": "2.5.0", "results": [], "totalSize": 0, "queryTime": 22.641152 }

Additional Information:

The following URI does return a resulting set of adjacent vertices if I just switch the = (equal operator) to the <> (not equal) operator:

Request:

_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,<>,"John Doe"]]

Response:

{ "version": "2.5.0", "results": [ { "name": "John Doe", "_id": 25600512, "_type": "vertex" } ], "totalSize": 1, "queryTime": 17.451008 }

Anyone have any clue where I may be going wrong?

References:

Thanks Friends!

Tom

4

1 回答 1

1

在您提供的链接中,明确注意此部分:

https://github.com/tinkerpop/blueprints/wiki/Vertex-Query#query-use-cases

请注意,所有用例都涉及“边缘”。您正在尝试对边的相邻顶点上的属性值进行顶点查询。如果您希望查询以这种方式工作,则必须对数据进行非规范化以在边缘包含“名称”属性。

请注意,在我针对下面默认图表的 curl 请求中,当我针对“权重”(和边缘属性)构建顶点查询时,事情会按预期工作:

$ curl -g "http://localhost:8182/graphs/tinkergraph/vertices/1/out?_properties=[[weight,=,(f,0.4)]]"
{"version":"2.5.0","results":[{"name":"lop","lang":"java","_id":"3","_type":"vertex"}],"totalSize":1,"queryTime":1.070072}
于 2015-12-07T12:24:21.137 回答