2012-06-26 3 views
2

나는 groupCount으로 조금 더렵혀졌고 결과 노드를 사용하여 더 많은 쿼리를 수행했습니다. 나는 Neo4j 콘솔에서 이것을 해왔다.Gremlin/Groovy groupCount 결과

gremlin> g = TinkerGraphFactory.createTinkerGraph() 
==> tinkergraph[vertices:6 edges:6] 

gremlin> g.V.getClass() 
==> class com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline 

gremlin> m = [:] 

gremlin> g.V.out.groupCount(m) 
==> v[2] 
==> v[4] 
==> v[3] 
==> v[3] 
==> v[5] 
==> v[3] 

gremlin> m 
==> v[2]=1 
==> v[4]=1 
==> v[3]=3 
==> v[5]=1 

gremlin> m.getClass() 
==> class java.util.LinkedHashMap 

gremlin> m = m.keySet() 
==> v[2] 
==> v[4] 
==> v[3] 
==> v[5] 

gremlin> m.getClass() 
==> class java.util.HashMap$KeySet 

gremlin> m.outE 
==> [StartPipe, OutEdgesPipe] 
==> [StartPipe, OutEdgesPipe] 
==> [StartPipe, OutEdgesPipe] 
==> [StartPipe, OutEdgesPipe] 

gremlin> m.outE.map 
==> [StartPipe, OutEdgesPipe, PropertyMapPipe] 
==> [StartPipe, OutEdgesPipe, PropertyMapPipe] 
==> [StartPipe, OutEdgesPipe, PropertyMapPipe] 
==> [StartPipe, OutEdgesPipe, PropertyMapPipe] 

가 어떻게이 GremlinGroovyPipeline 개체로 m 사용할 수 있습니다 예를 들어, TinkerGraph 데이터 세트를 사용하고 계십니까? 나는이에 대한 결과가 유사한 기대하고있다 :

gremlin> m.outE 
==> e[7][1-knows->2] 
==> e[8][1-knows->4] 
==> e[9][1-created->3] 
==> e[12][6-created->3] 
==> e[10][4-created->5] 
==> e[11][4-created->3] 

답변

2

나는 무작위로 질문에 전혀 관계가없는했다 포럼 게시물에 대한 답을 발견했다.

gremlin> m.keySet()_().getClass() 
==> class com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline 
+2

예, _()이다 :

gremlin> m.keySet()_().outE.map ==> {weight=1.0} ==> {weight=0.4} 

는 단순히 keySet() 메서드 호출 후 텍스트 _()을 추가, GremlinGrrovyPipeline 개체로 바로 다시 설정하는 것 같다 :

그럼에도 불구하고, 여기에 대한 답변입니다 "신원 파이프 (identity pipe)"라고 불리는 것으로, 일반 요소와 요소 컬렉션을 다시 파이프로 변환합니다. 일반적으로 컬렉션과 ID 파이프 사이에 점을 넣습니다. myVertexList ._(). outE입니다. – espeed