编写gremlin查询的最佳方法是通过groovy脚本还是tinkerpop步骤
编写gremlin查询的最佳方法是通过groovy脚本还是tinkerpop步骤 例如,使用label Employee根据顶点的加入日期对顶点集进行排序 哪种检索方式更好 是吗 在这里,我在groovy脚本中使用了编写gremlin查询的最佳方法是通过groovy脚本还是tinkerpop步骤,groovy,gremlin,tinkerpop,tinkerpop3,Groovy,Gremlin,Tinkerpop,Tinkerpop3,编写gremlin查询的最佳方法是通过groovy脚本还是tinkerpop步骤 例如,使用label Employee根据顶点的加入日期对顶点集进行排序 哪种检索方式更好 是吗 在这里,我在groovy脚本中使用了运算符,在第二个脚本中,我在tinkerpop中使用了纯顺序步骤 这两个查询都在gremlin控制台中工作,但哪一个查询最适合检索,以及gremlin控制台如何解释这两个查询?最好避免,因为底层图形数据库无法解释它们。它们存在于遍历之外。考虑这个例子和你的相似: gremlin>
运算符,在第二个脚本中,我在tinkerpop中使用了纯顺序步骤
这两个查询都在gremlin控制台中工作,但哪一个查询最适合检索,以及gremlin控制台如何解释这两个查询?最好避免,因为底层图形数据库无法解释它们。它们存在于遍历
之外。考虑这个例子和你的相似:
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]])]
当您执行explain()
操作时,您可以看到遍历如何查找底层图形数据库。在这种情况下,如果数据库能够在order()
上进行优化,它就可以利用这一点并变得更高效。如果您只是提交,g.V().hasLabel(“person”)
,然后切换到groovy收集方法,那么底层数据库只会知道您试图获取“person”顶点列表,而不知道您还打算对它们进行排序(这将在内存中使用groovysort
)
g.V().hasLabel('Employee').order().by('DateOfJoining',incr)
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]])]