2014-11-26 4 views
0

gremlin 셸과 비교하여 rexster가 사용자 정의 Gremlin 쿼리를 처리하는 방식이 불일치하는 원인을 확인하려고합니다.사용자 정의 gremlin 단계는 gremlin에서 작동하지만 렉스 스터에서는 작동하지 않습니다.

내가 사용하고 있습니다 :

  • rexster - 서버 2.6.0;
  • gremlin-groovy-2.5.0;
  • orientdb-community-1.7.9;

간단한 계층 구조 트리를 나타내는 그래프의 방향을 지정하기 위해로드했습니다. 각 노드에는 부모를 가리키는 'parent'라는 가장자리가 있습니다. 그것은 DAG입니다.

나는 정의는 다음과 같이 (그 init-scripts를 통해 rexster에로드) 그렘린의 user-defined step :

Gremlin.defineStep('children', 
     [Vertex, Pipe], 
     {int depth -> _().out('parent').loop(1) 
     {it.loops < depth} 
     {it.object != null} 
    }) 

이러한 명령과 함께 rexster 개집에서 명령 줄 놈아 도구를 사용하여, 내가 얻을 다음 그것은 완벽하게 작동, 그것을, 나는 gremlin.sh을 불 경우

gremlin> g.V('type', 'LSNetwork') 
==>v[#9:6312] 
gremlin> g.V('type', 'LSNetwork').out('parent').out('parent').name 
==>Leaf 0 
==>Leaf 1 
==>Leaf 2 
==>Leaf 3 
gremlin> g.V('type', 'LSNetwork').children(2) 
==>javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.tinkerpop.gremlin.groovy.GremlinGroovyPipeline.children() is applicable for argument types: (java.lang.Integer) values: [2] 

그러나, 내 그래프에 연결하는 단계를 정의 및 실행 : 오류 (전체 오류 메시지를보고 오른쪽으로 스크롤)

,
gremlin> Gremlin.defineStep('children', [Vertex, Pipe], {int depth -> _().out('parent').loop(1){it.loops < depth}{it.object != null}}) 
==>null 
gremlin> sg=new OrientGraph('remote:localhost/scratch')                    
==>orientgraph[remote:localhost/scratch] 
gremlin> sg.V('type','LSNetwork').children(3).name 
==>Spine 0 
==>Spine 1 
==>Leaf 0 
==>Leaf 1 
==>Leaf 2 
==>Leaf 3 

(주의 : 이름은 정확하고 내가 예상 한 것입니다.)

왜 내 gremlin 스크립트는 gremlin 콘솔에서 작동하지만 전구/rexster를 통해 작동하지 않습니까?

미리 감사 드리며 도움이 될만한 자료, 통찰력 또는 적절한 문서에 대한 조언을 보내 주시면 감사하겠습니다. 문서에 정의 된 codeveloper 단계의 버전을 사용하는 경우

답변

0

나는이에 문제가 아니에요 :

$ curl "http://localhost:8182/graphs/tinkergraph/tp/gremlin?script=g.v(1).codeveloper.name" 
{"success":true,"results":["josh","peter"],"version":"2.5.0","queryTime":39.294181} 

뿐만 아니라 개 집에서 작동하는 것 같다. Rexster가 대본을 찾지 못했다고 생각합니다. <init-scripts> 설정에 대한 경로가 올바르게 설정되어 있습니까? 는 init 스크립트가 제대로 지정 및로드 된 경우이 로그 항목이 표시되어야합니다 다음 ScriptEngine 즉처럼 (당신이 그것을에 대한 요청을 할 때까지 일어나지 않을 것이다 시작할 때까지

[INFO] EngineHolder - ScriptEngine initializing with a custom script 

당신은 그것을 볼 수 없습니다 내 curl 명령 사용).

+0

이것은 주로 문제의 원인 일 수 있습니다. 그러나 init.groovy 스크립트를 성공적으로로드 할 수 없었습니다. 기본 구성 문제가 의심됩니다. 대화를 옮겼습니다 (https://groups.google.com/forum/#!topic/gremlin-users/M6AtxpXicvk). – phonybone