Gremlin 图形未保存
首先,我按照以下步骤在JanusGraph中创建一个图Gremlin 图形未保存,gremlin,tinkerpop,janusgraph,gremlin-server,Gremlin,Tinkerpop,Janusgraph,Gremlin Server,首先,我按照以下步骤在JanusGraph中创建一个图 将以下内容添加到conf/janusgraph cassandra configurationgraph.properties 将gremlin-server-configuration.yaml中的“ConfigurationManagementGraph:conf/janusgraph cql configurationgraph.properties”更改为“ConfigurationManagementGraph:conf/j
- 将以下内容添加到
conf/janusgraph cassandra configurationgraph.properties
- 将gremlin-server-configuration.yaml中的“ConfigurationManagementGraph:conf/janusgraph cql configurationgraph.properties”更改为“ConfigurationManagementGraph:conf/janusgraph cassandra configurationgraph.properties”
- 将conf/gremlin-server/gremlin-server.yaml更改为conf/gremlin-server/gremlin-server.yaml.orig
- 将conf/gremlin-server/gremlin-server-configuration.yaml更改为conf/gremlin-server/gremlin-server.yaml
- 运行bin/janusgraph.sh启动
- run bin/gremlin.sh
- 跑
- 打开conf/gremlin server/gremlin-server.yaml,并将以下行添加到图形中:
- 将“scripts/empty sample.groovy”添加到“org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin:”
- 打开script/empty-sample.groovy,将最后一行更改为以下内容:
- 我可以看到它返回一个顶点
=>v[4120]
知道为什么会这样吗?多谢各位 我认为这是因为在添加顶点后,未能使用
g.tx().commit()
关闭事务
请注意,Gremlin Server确实为您管理会话和调用commit()
,但方法是:
:remote connect tinkerpop.server conf/remote.yaml session
您已显式打开一个不管理会话的连接。如果要管理会话并在每次请求时自动提交,则需要执行以下操作:
:remote connect tinkerpop.server conf/remote.yaml session-managed
谢谢!这正是我的问题所在。
gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
graph.graphname=KG
KG: conf/KG.properties
globals << [g : KG.traversal()]
:remote connect tinkerpop.server conf/remote.yaml session
:remote console
graph=ConfiguredGraphFactory.open("KG");
g=graph.traversal();
g.addV('user').property('name', 'Robert')
g.V()
:remote connect tinkerpop.server conf/remote.yaml session
:remote connect tinkerpop.server conf/remote.yaml session-managed