我创建了一个Titan图形(由Dynamodb支持);我使用Titan 1.0.0并运行Gremlin-Server 3(在TinkerPop3上)。Gremlin-Server添加具有多个属性的顶点(Titan 1.0.0)
我想添加一个顶点到我的图形中,在一行中有一个标签和多个属性。我可以添加带有标签和单个属性的顶点,并且在创建顶点后,我可以添加多个属性,但似乎我无法一次完成。
为了测试我在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]
我可以创建一个带标签的顶点和一个属性是这样的:
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]]
我还可以创建一个顶点然后追加许多属性,然后在我刚刚创建的顶点处开始遍历:
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]]
This是一切都很好,但我试图避免做出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]
我用1 .property()
具有多个属性(用自己能所有其他语法的变化也跟着尝试想),但似乎只赶上第一个:
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]]
我已经通过所有的文档看,我可以得到我的手从所有来源我能找到,我无法找到任何东西这个“全部一次”的方法。有没有人以前做过或知道如何做到这一点?
提前致谢!
啊!就是这样! T的一个东西是躲避我的东西。现在你指出了它,它正好在该文档的中间* palm => face *。感谢您的快速回答,为我节省了很多挫折! – mlee1100