groovy collection methodsを避けるために優れていると解釈ありません。それらはTraversal
の外に存在します。あなたのようなものだ。この例を考えてみましょう:あなたはexplain()
操作を行うと
gremlin> g.V().hasLabel("person").order().by('name',incr).explain()
==>Traversal Explanation
===============================================================================================================================
Original Traversal [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
ConnectiveStrategy [D] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
RepeatUnrollStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
InlineFilterStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
MatchPredicateStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
PathRetractionStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
FilterRankingStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
RangeByIsCountStrategy [O] [GraphStep(vertex,[]), HasStep([~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
ProfileStrategy [F] [TinkerGraphStep(vertex,[~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
Final Traversal [TinkerGraphStep(vertex,[~label.eq(person)]), OrderGlobalStep([[value(name), incr]])]
、あなたはTraversal
は、基礎となるグラフデータベースにどのように見えるかを確認することができます。この場合、データベースがorder()
で最適化できれば、それを利用してより効率的になる可能性があります。単にg.V().hasLabel("person")
を提出してgroovyのコレクションメソッドに切り替えただけでは、基礎となるデータベースは、あなたが「人」の頂点のリストを取得しようとしていて、あなたもそれらを注文しようとしていないことを知っています。 Groovyの使用sort
)。