이 주제에 관해서는 매우 기본적인 질문 일 수 있습니다. 그러나 Gremlin/DSE Graph를 처음 접했고 데이터를 추출하는 데 여러 가지 방법을 시도했습니다. 그래프에 삽입하고 있지만 어떻게 든 할 수 없습니다. 그것을 작동하게합니다.DSE 그래프에서 노드 속성을 인쇄 할 수 없습니다
여기에있는 내용은 다음과 같습니다. 1. allow_scans가 true로 설정된 그래프 2. 모든 정점의 NodeID에서 propertyKey 및 vertexes가 정의되고 구체화 된 인덱스가있는 스키마.
현재 관계가 없으며 데이터 요소가있는 정점 만 있습니다.
Result({u'id': {u'out_vertex': {u'community_id': 853347840, u'~label': u'vertex', u'member_id': 14}, u'~type': u'Name', u'local_id': u'00000000-0000-8012-0000-000000000000'}, u'value': u'amount', u'label': u'Name'})]
좋아 이제 노드가 삽입되어, 내가 원하는 :
나는 프로그램이 모든 정점을 만든 후 나는 다음과 같은 응답을 얻을로 성공적으로 작동하고 DSE 그래프 내 모든 노드를 삽입하는 프로그램을 작성 자신의 이름을 추출하고 인쇄 : 그래서 내가 한 :
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').values('Name');
위는 빈 결과 성공적으로 실패했습니다. 오류가없고 출력이없는 것처럼 Null 출력을 성공적으로 실행한다는 의미입니다. (gremlin-console의 null과 DataStax Studio의 'Success - No Results')
그럼 'has'가 하나 이상의 노드 만 반환한다는 것을 그래프가 알지 못하는 문서를 발견 했으므로 다음 번 반복에 사용했습니다. 문서와 튜토리얼에 따라 :
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').next().values('Name');
심지어이
에 실패3210org.apache.tinkerpop.gremlin.driver.exception.ResponseException
(Datastax studio에서는 더 자세한 정보를 표시하지 않습니다.) - 어떻게 디버깅 할 수 있습니까?
나는 심지어 내가 맵을 사용하는 람다 접근 건너 온 '이'정의되지로 응답
g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').map{it.get().value('Name')};
.
내가 노드의 값을 찾아 인쇄 속성을 잘못 뭐하는 거지 -
는 (이 경우에도 필요한 경우 확실하지 난 valueMap과 시도)?이름 및 기타 속성을 추출하는 데 도움이되는 지침이나 질문이 있으십니까? 다단계 쿼리조차도? 그러나 나는 이것이 그렇게 복잡해야한다고 생각하지 않는다.
UPDATE :
대답 당으로 내가 다음 역 추적 얻을 :
gremlin> :> g.V().hasLabel('FIELD').has('NodeID','2559b635f077e86c7370ab1c4c798a06').valueMap(true).next();
org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
Type ':help' or ':h' for help.
Display stack trace? [yN]y
org.apache.tinkerpop.gremlin.groovy.plugin.RemoteException
at org.apache.tinkerpop.gremlin.console.groovy.plugin.DriverRemoteAcceptor.submit(DriverRemoteAcceptor.java:170)
at org.apache.tinkerpop.gremlin.console.commands.SubmitCommand.execute(SubmitCommand.groovy:41)
at org.codehaus.groovy.tools.shell.Shell.execute(Shell.groovy:104)
at org.codehaus.groovy.tools.shell.Groovysh.super$2$execute(Groovysh.groovy)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.tools.shell.Groovysh.executeCommand(Groovysh.groovy:259)
at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:84)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122)
at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:95)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:124)
at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:59)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:83)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:152)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:401)
내가 다른 그래프에서 이와 유사한 작업을 할 수 있어요합니다. 그래프에 문제가 있습니까?내 그래프의 정점이 잘못 정의 된 2
UPDATE.
이 솔루션을 자세히 살펴볼 수있는 열쇠는 ~label
에 있습니다. 그것은 vertex
대신에 Field
이어야합니다. 데이터 삽입 팀을 정의하는 동안 따옴표없이 언급 레이블을 넣어야 할 때 레이블을 따옴표에 넣었습니다. 그래서 나는 노드를 가로 지르지 못했습니다.
답변 해 주셔서 감사합니다. 그래프에 문제가있는 것 같습니다. 제발 여기서 문제가 될 수있는 것을 찾아 내도록 도와주세요. ('NodeID', '2559b635f077e86c7370ab1c4c798a06')가 있습니다. 값 ('이름')은 유사한 노드가있는 다른 그래프에서 작동합니다. 이것으로 무엇이 잘못되었는지 확신 할 수 없습니다. – Nik
내 정점이 잘못된 방식으로 정의되었습니다. 귀하의 대답은 정확합니다. 감사 – Nik