Gremlin-Server添加具有多个属性的顶点(Titan 1.0.0)

mle*_*100 4 amazon-dynamodb gremlin titan tinkerpop3 gremlin-server

我正在创建一个Titan图(由Dynamodb支持); 我正在使用Titan 1.0.0并运行Gremlin-Server 3(在TinkerPop3上).

我正在尝试将一个顶点添加到我的图表中,并在一行中添加标签和多个属性.我能够添加一个带有标签和单个属性的顶点,并且我可以在创建顶点后为顶点添加多个属性,但似乎我无法一次完成所有操作.

为了测试我在gremlin shell中运行命令,但最终用例是通过REST api与它进行交互(已经正常工作).

作为一个说明,我在每次交易后回滚,所以我有一个清白的板岩.

以下是我发起会话的方式:

gremlin> graph = TitanFactory.open('conf/gremlin-server/dynamodb.properties')
==>standardtitangraph[com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager:[127.0.0.1]]
gremlin> g = graph.traversal()
==>graphtraversalsource[standardtitangraph[com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager:[127.0.0.1]], standard]
Run Code Online (Sandbox Code Playgroud)

我可以创建一个带有标签和单个属性的顶点,如下所示:

gremlin> graph.addVertex('date_of_birth').property('date_of_birth','1949-01-01')
==>vp[date_of_birth->1949-01-01]
gremlin> g.V().hasLabel('date_of_birth').has('date_of_birth','1949-01-01').valueMap()
==>[date_of_birth:[1949-01-01]]
Run Code Online (Sandbox Code Playgroud)

我也可以创建一个顶点,然后在我刚刚创建的顶点开始遍历遍历许多属性:

gremlin> v1 = graph.addVertex('date_of_birth')
==>v[409608296]
gremlin> g.V(v1).property('date_of_birth','1949-01-01').property('year_of_birth',1949).property('date_of_birth','1949-01-01').property('day_of_birth',1).property('age',67).property('month_of_birth',1)
==>v[409608296]
gremlin> g.V(v1).valueMap()
==>[day_of_birth:[1], date_of_birth:[1949-01-01], month_of_birth:[1], age:[67], year_of_birth:[1949]]
Run Code Online (Sandbox Code Playgroud)

这一切都很好,但我试图避免进行2次调用来实现这个结果,所以我想一次创建具有所有这些属性的顶点.从本质上讲,我希望能够执行以下操作,但失败超过1 .property():

gremlin> graph.addVertex('date_of_birth').property('date_of_birth','1949-01-01').property('year_of_birth',1949).property('date_of_birth','1949-01-01').property('day_of_birth',1).property('age',67).property('month_of_birth',1)
No signature of method: com.thinkaurelius.titan.graphdb.relations.SimpleTitanProperty.property() is applicable for argument types: (java.lang.String, java.lang.String) values: [date_of_birth, 1949-01-01]
Run Code Online (Sandbox Code Playgroud)

我也尝试使用.property()具有多个属性的1 (以及我能想到的所有其他语法变体),但它似乎只捕获第一个:

gremlin> graph.addVertex('date_of_birth').property('date_of_birth','1949-01-01','year_of_birth',1949,'date_of_birth','1949-01-01','day_of_birth',1,'age',67,'month_of_birth',1)
gremlin> g.V().hasLabel('date_of_birth').has('date_of_birth','1949-01-01').valueMap()
==>[date_of_birth:[1949-01-01]]
Run Code Online (Sandbox Code Playgroud)

我查看了所有可以从我找到的所有来源获得的文档,我找不到任何关于"一次性"的方法.有没有人以前做过这个或知道怎么做?

提前致谢!

Jas*_*rad 6

第3章 Titan文档入门中所述,GraphOfTheGodsFactory.java源代码显示了如何添加带有标签和多个属性的顶点.

saturn = graph.addVertex(T.label, "titan", "name", "saturn", "age", 10000);
Run Code Online (Sandbox Code Playgroud)

该方法addVertex(Object... keyValues)最终来自Apache TinkerPop定义的Graph接口.泰坦1.0.0使用TinkerPop有关3.0.1,你可以找到更多的文档addVertex的TinkerPop有关文档步骤(和许多其他步骤).