我正在使用tinkerpop的gremlin服务器和neo4j db。 如何设置顶点属性基数来设置或列出?
java.lang.UnsupportedOperationException: Multiple properties on a vertex is not supported
at org.apache.tinkerpop.gremlin.structure.VertexProperty$Exceptions.multiPropertiesNotSupported(VertexProperty.java:99)
at org.apache.tinkerpop.gremlin.neo4j.structure.trait.NoMultiNoMetaNeo4jTrait.setVertexProperty(NoMultiNoMetaNeo4jTrait.java:101)
at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex.property(Neo4jVertex.java:85)
at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep.sideEffect(AddPropertyStep.java:121)
at org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectStep.processNextStart(SideEffectStep.java:39)
at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:192)
at org.apache.tinkerpop.gremlin.server.op.AbstractOpProcessor.handleIterator(AbstractOpProcessor.java:89)
at org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor.lambda$evalOpInternal$5(AbstractEvalOpProcessor.java:252)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:273)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
我在这里找到了neo4j图表配置,neo4j graph multi/meta properties 我尝试在neo4j.properties中设置以下属性。最后三个。
gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
gremlin.neo4j.directory=/var/lib/neo4j/data/databases/graph.db
gremlin.neo4j.conf.node_auto_indexing=true
gremlin.neo4j.conf.relationship_auto_indexing=true
gremlin.neo4j.conf.allow_store_upgrade=true
gremlin.neo4j.conf.multiProperties=true
gremlin.neo4j.conf.metaProperties=true
gremlin.tinkergraph.defaultVertexPropertyCardinality=list
因此,当我执行此类查询时会发生这种情况
g.V().addV('Stephen').property(set, '1','2')
答案 0 :(得分:1)
两件事......首先,gremlin.tinkergraph.defaultVertexPropertyCardinality=list
不是“neo4j”配置选项。其次,我认为你没有正确地呼叫property()
。它应该更像您提供的链接中的示例:
gremlin> g.addV().property('name','michael').property('name','michael hunger').property('name','mhunger')
==>v[0]
因此在你的情况下你会这样做:
gremlin> g.addV('person').property(set,'name','Stephen').property(set,'name','Stephen').property(set,'name','steve').iterate()
gremlin> g.V().properties('name')
==>vp[name->Stephen]
==>vp[name->steve]