技术栈
目标
我想利用基于Rexster RESTful的API来查询和遍历我的图形数据库。我试图理解基于顶点查询语法过滤结果的_properties查询参数。
顶点查询的结果
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 }
边缘查询结果
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 }
问题
这些URI不返回我假设将被返回的内容,总是返回一个空集。
请求
_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)]]
响应
{ "version": "2.5.0", "results": [], "totalSize": 0, "queryTime": 22.641152 }
附加信息
如果只将=(等于运算符)切换到<> (不相等)运算符,下面的URI确实返回一组相邻顶点:
请求
_http://localhost:8182/graphs/privvy/vertices/25600768/both?_properties=[[name,<>,"John“]]_
响应
{ "version": "2.5.0", "results": [ { "name": "John Doe", "_id": 25600512, "_type": "vertex" } ], "totalSize": 1, "queryTime": 17.451008 }
有谁知道我哪里出错了吗?
参考资料
谢谢朋友们!
汤姆
发布于 2015-12-07 12:24:21
在您提供的链接中,请显式地注意本节:
https://github.com/tinkerpop/blueprints/wiki/Vertex-Query#query-use-cases
请注意,所有用例都涉及到“边缘”。您正在尝试对边缘相邻顶点上的属性值执行顶点查询。如果您希望查询以这种方式工作,则必须对数据进行反错处理,以便在边缘包含"name“属性。
请注意,在对下面的默认图形的curl请求中,当我针对“work”(和edge属性)构建顶点查询时,事情按预期进行:
$ 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}https://stackoverflow.com/questions/34091364
复制相似问题