我用neo4j 3.3.4使用http通道器启动gremlin-server 3.3.4,并且它工作了。neo4j-empty.properties配置如下
gremlin.graph=org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph
gremlin.neo4j.directory=/tmp/neo4j
gremlin.neo4j.conf.dbms.auto_index.nodes.enabled=true
gremlin.neo4j.conf.dbms.auto_index.relationships.enabled=true但是1. http://localhost:8182/?gremlin=g.addV("test").property(id,"abc")返回错误
{
"message": "Vertex does not support user supplied identifiers",
"Exception-Class": "java.lang.UnsupportedOperationException",
"exceptions": [
"java.lang.UnsupportedOperationException"
],
"stackTrace": "java.lang.UnsupportedOperationException: Vertex does not support user supplied identifiers\n\tat org.apache.tinkerpop.gremlin.structure.Vertex$Exceptions.userSuppliedIdsNotSupported(Vertex.java:163)\n\tat org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.addVertex(Neo4jGraph.java:162)\n\tat org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep.processNextStart(AddVertexStartStep.java:91)\n\tat org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:143)\n\tat org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:192)\n\tat org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.fill(IteratorUtils.java:62)\n\tat org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.list(IteratorUtils.java:85)\n\tat org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.asList(IteratorUtils.java:382)\n\tat org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.lambda$channelRead$1(HttpGremlinEndpointHandler.java:247)\n\tat org.apache.tinkerpop.gremlin.util.function.FunctionUtils.lambda$wrapFunction$0(FunctionUtils.java:36)\n\tat org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:269)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\n"
}2.使用多标签http://localhost:8182/?gremlin=g.addV("test::test2")添加顶点,查询http://localhost:8182/?gremlin=g.V().hasLabel("test")返回空节点。
{
"requestId": "ec79c0f7-e4aa-485e-ace4-6e534e8252c5",
"status": {
"message": "",
"code": 200,
"attributes": {
"@type": "g:Map",
"@value": []
}
},
"result": {
"data": {
"@type": "g:List",
"@value": []
},
"meta": {
"@type": "g:Map",
"@value": []
}
}
}我怎样才能让它们发挥作用?我找到了一些东西,但还没有找到配置选项。请帮助elementidstrategy label
发布于 2018-11-15 11:56:15
Neo4j不允许分配id。如果您想分配自己的标识符,那么它需要是一个属性,如下所示:
g.addV("test").property("id","abc")https://stackoverflow.com/questions/53313458
复制相似问题