4

Titan グラフを作成しています (Dynamodb を使用)。Titan 1.0.0 を使用し、Gremlin-Server 3 (TinkerPop3 上) を実行しています。

1 行にラベルと複数のプロパティを含む頂点をグラフに追加しようとしています。ラベルと単一のプロパティを持つ頂点を追加することはできます。また、頂点を作成した後に複数のプロパティを頂点に追加することもできますが、すべてを一度に行うことはできないようです。

テストのために、gremlin シェルでコマンドを実行していますが、最終的なユース ケースは 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]]

これで問題ありませんが、この結果を得るために 2 つの呼び出しを行わないようにしているので、これらすべてのプロパティを一度に使用して頂点を作成したいと思います。基本的に、次のようなことができるようにしたいのですが、複数で失敗します.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]]

見つけられるすべての情報源から手に入れることができるすべてのドキュメントに目を通しましたが、この「一度に」方法については何も見つかりません。誰かがこれを以前に行ったことがありますか、またはそれを行う方法を知っていますか?

前もって感謝します!

4

1 に答える 1

6

Titan ドキュメントのChapter 3 Getting Startedで説明されているように、GraphOfTheGodsFactory.javaソース コードは、ラベルと複数のプロパティを持つ頂点を追加する方法を示しています。

saturn = graph.addVertex(T.label, "titan", "name", "saturn", "age", 10000);

このメソッドaddVertex(Object... keyValues)は、最終的に Apache TinkerPop によって定義された Graph インターフェイスから来ています。Titan 1.0.0 は TinkerPop 3.0.1 を使用しており、TinkerPop docs でこのステップ (およびその他の多くのステップ)に関する詳細なドキュメントを見つけることができます。addVertex

于 2016-07-28T00:10:57.087 に答える