2016-07-27 12 views
3

私はTitanグラフを作成しています(Dynamodbの支援を受けています)。私はTitan 1.0.0を使用していて、Gremlin-Server 3(TinkerPop3上)を実行しています。Gremlin-Server複数のプロパティを持つ頂点を追加する(Titan 1.0.0)

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

私はgremlinシェルでコマンドを実行していますが、最終ユースケースはREST API(既に正常に動作しています)を介して対話しています。

私はこれらのトランザクションの後にロールバックしていますので、私は清潔なスレートを持っています。

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> 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> 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回の呼び出しを避けようとしていますので、これらのプロパティのすべてを一度に作成したいと思います。基本的に、私は次のような何かを行うことができるようにしたいが、それは以上1 .property()で失敗します。私も、私ができる他のすべての構文のバリエーションと一緒に(複数のプロパティを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] 

)を考えるが、最初のものだけをキャッチするようだ:

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]] 

私は私が見つけることができるすべてのソースからの私の手を得ることができる文書のすべてを見てきたと私は何かを見つけることができませんこの「一度に」の方法。誰もこれを前にやったか、やり方を知っていますか?

ありがとうございます!

答えて

5

タイタン文書のChapter 3 Getting Startedに記載されているように、GraphOfTheGodsFactory.javaソースコードは、ラベルと複数のプロパティを持つ頂点を追加する方法を示しています。

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

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

+0

ああ!それだった!私を逃したことの1つはTオブジェクトです。そして今、あなたが指摘したように、それはその文書* palm => face *の真ん中でうっとりしています。迅速な答えをありがとう、私に多くの欲求不満を保存! – mlee1100

関連する問題