这是一个非常简单的查询:
这的JSON输出为:
g.V('customerId').out().path()
这的JSON输出为:
{
"requestId":"96b26c1d-d032-2004-d36e-c700bd6db2a2",
"status":{
"message":"",
"code":200,
"attributes":{
"@type":"g:Map",
"@value":[
]
}
},
"result":{
"data":{
"@type":"g:List",
"@value":[
{
"@type":"g:Path",
"@value":{
"labels":{
"@type":"g:List",
"@value":[
{
"@type":"g:Set",
"@value":[
]
},
{
"@type":"g:Set",
"@value":[
]
}
]
},
"objects":{
"@type":"g:List",
"@value":[
{
"@type":"g:Vertex",
"@value":{
"id":"customerId",
"label":"customer"
}
},
{
"@type":"g:Vertex",
"@value":{
"id":"e:customerIdemail@email.com",
"label":"email"
}
}
]
}
}
}
]
},
"meta":{
"@type":"g:Map",
"@value":[
]
}
}
}
现在,客户节点还包含姓名和年龄属性。我想要了解的是如何(如果可能的话)简单地形成我的Gremlin查询,使其嵌套图中的顶点属性。请注意,当我只运行g.V("customerId")时,响应确实包含这些属性。
Vertex
),并且正如您在查询中看到的那样,我们将“分离”该顶点,以便您获得的只是id/label。我们将该形式的顶点称为“引用”顶点,在未来,TinkerPop将为所有遍历返回此类顶点(在某些图实现和TinkerPop序列化程序中已经起作用)。 - stephen mallettepath()
中意外地返回了它,那么这将是一个昂贵的序列化过程来返回该结果。 - stephen malletteT
被静态导入,那么它只是by(T.id)
或者简单地by(id)
。 - stephen mallette