泰坦和卡桑德拉在持续图表时截断长串

时间:2015-12-02 10:33:05

标签: cassandra titan gremlin

创建图表时,例如:

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个字符。我使用的是标准配置here。我缺少一些额外的配置吗?

1 个答案:

答案 0 :(得分:0)

您看到的是,您获得VertexProperty.toString()的结果,而不是使用VertexProperty.value()获取值。以下是Gremlin控制台会议,以展示其中的差异:

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文档中有一些关于vertex properties值得一读的讨论。