簡體   English   中英

泰坦和卡桑德拉在保留圖形時截斷長字符串

[英]Titan and Cassandra Truncating Long Strings When Persisting Graph

創建圖形時,例如:

TitanGraph graph =  TitanFactory.open("conf/titan-cassandra-es.properties");
Vertex v = graph.addVertex()
v.property("Value", "very very very very very very very very vey long string");
graph.tx().commit();

我發現titan在提交時將字符串截斷為僅20個字符。 我正在使用此處定義的標准配置。 我還缺少一些其他配置嗎?

您所看到的是,您正在獲取VertexProperty.toString()的結果,而不是通過VertexProperty.value()獲得該值。 這是Gremlin Console會話,以演示兩者的區別:

gremlin> graph = TitanFactory.build().set('storage.backend','cassandra').set('storage.cassandra.keyspace','fido').open()
==>standardtitangraph[cassandra:[127.0.0.1]]
gremlin> v = graph.addVertex() // create a vertex
==>v[4256]
gremlin> v.property('value', 'very very very very very very very very vey long string') // set a property
==>vp[value->very very very very ]
gremlin> v.property('value').getClass() // check the class on the property
==>class com.thinkaurelius.titan.graphdb.relations.StandardVertexProperty
gremlin> v.property('value').toString() // vertex property object as a string
==>vp[value->very very very very ]
gremlin> v.property('value').value().getClass() // check the class of the value of the vertex property
==>class java.lang.String
gremlin> v.property('value').value() // get the value of the vertex property (explicit syntax)
==>very very very very very very very very vey long string
gremlin> v.values('value').next().getClass() // check the class of the value of the vertex property
==>class java.lang.String
gremlin> v.values('value').next() // get the value of the vertex property (simpler syntax)
==>very very very very very very very very vey long string

在TinkerPop3文檔中,有一些關於頂點屬性的討論值得閱讀。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM