繁体   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