0

我能够在 IBM Graph 中成功构建顶点,但是当我执行查询时,输出不显示顶点之间的边。我正在运行以下代码:

def v1 = graph.addVertex("name", "Darshit", label, "Inventorymanager","zip","95112"); 
def v2 = graph.addVertex("name", "Vikas", label, "Vendor","zip","95112"); 
def v3 = graph.addVertex("name", "Sidharth", label, "Vendor","zip","95112"); 
def v4 = graph.addVertex("name", "iPhone7", label, "Item","price",750,"quantity",10); 
def v5 = graph.addVertex("name", "chair", label, "Item","price",20,"quantity",15); 
def v6 = graph.addVertex("name", "laptop", label, "Item","price",800,"quantity",3);  
v1.addEdge("ordered_to", v2); 
v1.addEdge("ordered_to", v3); 
v2.addEdge("has", v4); 
v3.addEdge("has", v5); 
v2.addEdge("has", v6); 
v3.addEdge("has", v6);    
def g = graph.traversal(); 
g.V().has("name", "Darshit").out("ordered_to").has("name", "Vikas").path();
4

1 回答 1

0

将您的查询更改为

g.V().has("name", "Darshit").outE("ordered_to").inV().has("name", "Vikas").path();

这也会给你带来优势

于 2016-10-04T15:17:51.080 回答