1
每個頂點和邊具有以下屬性:在TitanDB排序與的Gremlin
Request [req_id: long, submit_time:long, priority:int, status:char]
Test_B [tb_id: long, tb_name: string]
TestSuite [suite_id: long, Suite_Status: char]
Edge-A [sequence_num: int]
Edge-B [ sequence_num: int, suite_status: char]
頂點和邊之間的關係:
Request----EdgeA----Test-B
Request----EdgeB----TestSuite
TestSuite----EdgeC----Test-B
下面查詢被排序(SUBMIT_TIME從請求中)按升序排列,並顯示TestSuite詳細信息:
g.V().order().by("submit_time",incr).outE("Edge-B").
has("suite_status","Q").inV().valueMap()
下面是一個例子圖:
rj1=graph.addVertex(label,"request","req_id",1138,"status","S","priority",3,"submit_time",1330647978000)
rj2=graph.addVertex(label,"request","req_id",1133,"status","S","priority",2,"submit_time",1330662012000)
rj3=graph.addVertex(label,"request","req_id",1136,"status","S","priority",1,"submit_time",1330652298000)
rj4=graph.addVertex(label,"request","req_id",1135,"status","S","priority",1,"submit_time",1330666768000)
ts1=graph.addVertex(label,"test_suite","test_suite_id",8713)
ts2=graph.addVertex(label,"test_suite","test_suite_id",8718)
ts3=graph.addVertex(label,"test_suite","test_suite_id",8688)
ts4=graph.addVertex(label,"test_suite","test_suite_id",8729)
tb1=graph.addVertex(label,"test_b","tb_id",574)
tb2=graph.addVertex(label,"test_b","tb_id",573)
tb3=graph.addVertex(label,"test_b","tb_id",577)
e1=rj1.addEdge("edgeB",ts1,"sequence",1,"job_suite_status","Q")
e2=rj1.addEdge("edgeB",ts2,"sequence",2,"job_suite_status","Q")
e1=rj2.addEdge("edgeB",ts1,"sequence",1,"job_suite_status","Q")
e2=rj2.addEdge("edgeB",ts3,"sequence",2,"job_suite_status","Q")
e1=rj3.addEdge("edgeB",ts4,"sequence",1,"job_suite_status","Q")
e2=rj3.addEdge("edgeB",ts2,"sequence",2,"job_suite_status","Q")
e1=rj4.addEdge("edgeB",ts3,"sequence",1,"job_suite_status","Q")
e2=rj4.addEdge("edgeB",ts4,"sequence",2,"job_suite_status","Q")
e1=rj1.addEdge("edgeA",tb1,"sequence",1)
e2=rj1.addEdge("edgeA",tb2,"sequence",2)
e3=rj2.addEdge("edgeA",tb1,"sequence",1)
e4=rj2.addEdge("edgeA",tb1,"sequence",2)
e5=rj3.addEdge("edgeA",tb2,"sequence",1)
e6=rj3.addEdge("edgeA",tb3,"sequence",2)
e7=rj4.addEdge("edgeA",tb3,"sequence",2)
e8=rj4.addEdge("edgeA",tb1,"sequence",1)
這裏,RJ1,RJ2,RJ4連接至TB1(edgeA): 因此每個test_b(例如:tb_id = 574),排序請求(rj1,rj2,rj4)基於submit_time並採取test_suite_id和序列。
最後,我需要打印test_suite_id,順序及相應的REQ_ID。請幫我解決這個問題。謝謝。
你能否提供一些節點和預期結果的例子? –
@cattani我已經更新了樣本數據的問題..你可以幫我解決這個問題。 – User12345
遍歷似乎不適用於您的示例數據。 –