Tinkerpop Stack Rexster REST API _properties
Tinkerpop Stack Rexster REST API _properties
技术栈:
- Tinkerpop Stack 2.4(Rexster HTTP REST 服务器)
- 泰坦 0.5.4
- DynamoDB (AWS)
- NodeJS
目标:
我想利用基于 API 的 Rexster RESTful 来查询和遍历我的图形数据库。我正在尝试了解用于根据顶点查询语法过滤结果的 _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 不会 return 我假设我会得到 returned,总是 return 一个空集。:
请求数:
_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 会 return 一组相邻顶点的结果:
请求:
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,<>,"John Doe"]]
回应:
{
"version": "2.5.0",
"results": [
{
"name": "John Doe",
"_id": 25600512,
"_type": "vertex"
}
],
"totalSize": 1,
"queryTime": 17.451008
}
有人知道我可能哪里出错了吗?
参考文献:
- https://github.com/tinkerpop/rexster/wiki/Basic-REST-API
- https://github.com/tinkerpop/rexster/wiki/Property-Data-Types(未显示字符串用于数据类型顶点查询的示例。)
- https://github.com/tinkerpop/blueprints/wiki/Vertex-Query
谢谢朋友!
汤姆
在您提供的 link 中,明确注明此部分:
https://github.com/tinkerpop/blueprints/wiki/Vertex-Query#query-use-cases
请注意,涉及的所有用例 "edges"。您正在尝试对边的相邻顶点上的 属性 值进行顶点查询。如果您希望查询以这种方式工作,则必须对数据进行非规范化以在边缘包含 "name" 属性。
请注意,在我针对下面的默认图形的卷曲请求中,当我针对 "weight"(和边 属性)构建顶点查询时,一切都按预期工作:
$ 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}
技术栈:
- Tinkerpop Stack 2.4(Rexster HTTP REST 服务器)
- 泰坦 0.5.4
- DynamoDB (AWS)
- NodeJS
目标:
我想利用基于 API 的 Rexster RESTful 来查询和遍历我的图形数据库。我正在尝试了解用于根据顶点查询语法过滤结果的 _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 不会 return 我假设我会得到 returned,总是 return 一个空集。:
请求数:
_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 会 return 一组相邻顶点的结果:
请求:
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,<>,"John Doe"]]
回应:
{
"version": "2.5.0",
"results": [
{
"name": "John Doe",
"_id": 25600512,
"_type": "vertex"
}
],
"totalSize": 1,
"queryTime": 17.451008
}
有人知道我可能哪里出错了吗?
参考文献:
- https://github.com/tinkerpop/rexster/wiki/Basic-REST-API
- https://github.com/tinkerpop/rexster/wiki/Property-Data-Types(未显示字符串用于数据类型顶点查询的示例。)
- https://github.com/tinkerpop/blueprints/wiki/Vertex-Query
谢谢朋友!
汤姆
在您提供的 link 中,明确注明此部分:
https://github.com/tinkerpop/blueprints/wiki/Vertex-Query#query-use-cases
请注意,涉及的所有用例 "edges"。您正在尝试对边的相邻顶点上的 属性 值进行顶点查询。如果您希望查询以这种方式工作,则必须对数据进行非规范化以在边缘包含 "name" 属性。
请注意,在我针对下面的默认图形的卷曲请求中,当我针对 "weight"(和边 属性)构建顶点查询时,一切都按预期工作:
$ 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}