函数 pnodes() 可以将路径中所有点的 NODE 信息依次放入一个列表,并返回该列表。
Arguments:
- 路径 <path>
Returns:
- 点集合 <list>
示例图集:(以下示例将在本图基础上运行)
在空图集中依次运行以下各行代码以创建该图数据:create().node_schema("firm").node_schema("human").edge_schema("hold")
create().edge_property(@hold, "portion", double)
insert().into(@firm).nodes([{_id:"F001", _uuid:1}, {_id:"F002", _uuid:2}])
insert().into(@human).nodes([{_id:"H001", _uuid:3}, {_id:"H002", _uuid:4}])
insert().into(@hold).edges([{_uuid:1, _from_uuid:3, _to_uuid:1, portion:0.3}, {_uuid:2, _from_uuid:2, _to_uuid:1, portion:0.7}, {_uuid:3, _from_uuid:3, _to_uuid:2, portion:0.4}, {_uuid:4, _from_uuid:4, _to_uuid:2, portion:0.6}])
一般用法
示例:计算各个最终受益人对公司 F001 的持股路径,返回各条路径的点列表
n({_id == "F001"}).le()[:5].n({@human} as UBO) as p
return pnodes(p)
[{"id":"F001","uuid":"1","schema":"firm","values":{}},{"id":"H001","uuid":"3","schema":"human","values":{}}]
[{"id":"F001","uuid":"1","schema":"firm","values":{}},{"id":"F002","uuid":"2","schema":"firm","values":{}},{"id":"H001","uuid":"3","schema":"human","values":{}}]
[{"id":"F001","uuid":"1","schema":"firm","values":{}},{"id":"F002","uuid":"2","schema":"firm","values":{}},{"id":"H002","uuid":"4","schema":"human","values":{}}]