あり、あなたがこれを行う可能性がありますいくつかの方法がありますが、最初にあなたはそれが何をしたいん言う以来のは、既存のグレムリンを簡素化してみましょう:
g.V().has('user','id','338d219c-3457-4ad8-8172-37a7d897c0df').
out('manages').
hasLabel('client').
out('have').
hasLabel('site').
out('have').
has('job','status', 'In Progress')
注意をそのようなoutE().inV()
組み合わせは、本質的にちょうどout()
あること。実際には、outE().inV()
としてそれらを書くと、グレムリンは戦略が適用されたときにトラバーサルをただちにout()
に書き換えるという手間を掛けます。次の二つのトラバースのexplain()
を参照してください。
gremlin> g.V().outE().inV().outE().inV().explain()
==>Traversal Explanation
=============================================================================================================================================================
Original Traversal [GraphStep(vertex,[]), VertexStep(OUT,edge), EdgeVertexStep(IN), VertexStep(OUT,edge), EdgeVertexStep(IN)]
ConnectiveStrategy [D] [GraphStep(vertex,[]), VertexStep(OUT,edge), EdgeVertexStep(IN), VertexStep(OUT,edge), EdgeVertexStep(IN)]
MatchPredicateStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,edge), EdgeVertexStep(IN), VertexStep(OUT,edge), EdgeVertexStep(IN)]
FilterRankingStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,edge), EdgeVertexStep(IN), VertexStep(OUT,edge), EdgeVertexStep(IN)]
InlineFilterStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,edge), EdgeVertexStep(IN), VertexStep(OUT,edge), EdgeVertexStep(IN)]
IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
RangeByIsCountStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
RepeatUnrollStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
PathRetractionStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
LazyBarrierStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
ProfileStrategy [F] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
Final Traversal [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
gremlin> g.V().out().out().explain()
==>Traversal Explanation
=============================================================================================================================================================
Original Traversal [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
ConnectiveStrategy [D] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
MatchPredicateStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
FilterRankingStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
InlineFilterStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
RangeByIsCountStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
RepeatUnrollStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
PathRetractionStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), VertexStep(OUT,vertex)]
LazyBarrierStrategy [O] [GraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
ProfileStrategy [F] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
Final Traversal [TinkerGraphStep(vertex,[]), VertexStep(OUT,vertex), NoOpBarrierStep(2500), VertexStep(OUT,vertex), NoOpBarrierStep(2500)]
は最終ラインが同一であるかを参照してください? IncidentToAdjacentStrategy
はその変更を適用するため、最終的に両方のトラバーサルが同じものにコンパイルされます。あなたの元の質問への答えで
、あなたがクライアント、サイトとジョブは、その後select()
を使用持っている必要がある場合:
g.V().has('user','id','338d219c-3457-4ad8-8172-37a7d897c0df').
out('manages').
hasLabel('client').as('c').
out('have').
hasLabel('site').as('s').
out('have').
has('job','status', 'In Progress').as('j').
select('c','s','j')
私が何か間違ったことかもしれない、クエリが空に戻ってくるよう。 .out( '')を追加せずに実行すると動作します。 – user1932923
私はいくつかの詳細を追加しました。 'out()'がなぜあなたにとって問題になるのか不明です。あなたのコードを少し再確認したいかもしれません。私の更新された答えでわかるように、終了トラバースはどちらのアプローチでも同じように見えるはずです。 –