简体   繁体   English

gremlin-server neo4j:如何设置ID,多标签

[英]gremlin-server neo4j : How to set id, multi label

I launched gremlin-server 3.3.4 with neo4j 3.3.4 using http channelizer, and it worked. 我使用http channelizer启动了带有neo4j 3.3.4的gremlin-server 3.3.4,并且可以正常工作。 neo4j-empty.properties configuration was below 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

but 1. http://localhost:8182/?gremlin=g.addV("test").property(id,"abc") return error 但是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"
}

and 2. I added vertex with multilabel http://localhost:8182/?gremlin=g.addV("test::test2") and query http://localhost:8182/?gremlin=gV().hasLabel("test") return empty node 和2。我添加了带有多http://localhost:8182/?gremlin=g.addV("test::test2")顶点,并查询了http://localhost:8182/?gremlin=gV().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": []
}
}
}

How can I make them work? 如何使它们工作? I found some things, but I couldn't find config option yet. 我找到了一些东西,但是我找不到配置选项。 please help http://tinkerpop.apache.org/docs/current/reference/#_elementidstrategy http://tinkerpop.apache.org/docs/current/reference/#_multi_label 请帮助http://tinkerpop.apache.org/docs/current/reference/#_elementidstrategy http://tinkerpop.apache.org/docs/current/reference/#_multi_label

Neo4j does not allow id assignment. Neo4j不允许ID分配。 If you want to assign your own identifier then it needs to be a property like: 如果要分配自己的标识符,则它必须是类似以下的属性:

g.addV("test").property("id","abc")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM