【问题标题】:Unable to retrieve correct data from Titan using Gremlin无法使用 Gremlin 从 Titan 检索正确的数据
【发布时间】:2015-10-07 09:54:02
【问题描述】:

我正在从 java 连接到 Titan(使用 titan-all-0.4.4)

TitanGraph g = TitanFactory.open("/titan-all-0.4.4/conf/titan-cassandra.properties");

titan-cassandra.properties 是 Titan 自带的默认文件。

我正在尝试在 Graph g 中插入顶点,

Vertex a = g.addVertex(null);
a.setProperty("name", "a");
Vertex b = g.addVertex(null);
b.setProperty("name", "b");
Vertex c = g.addVertex(null);
c.setProperty("name", "c");
Vertex d = g.addVertex(null);
d.setProperty("name", "d");
g.commit();`

然后我通过 Gremlin 进行查询,

g = TitanFactory.open("/titan-all-0.4.4/conf/titan-cassandra.properties");
g.V.count()

g.V.count()(或一般任何其他函数,如g.V.map())有时会返回正确的值(或数据),有时会返回不正确的值。例如。上面程序中count值是4,但有时g.V.count()返回1,有时是4。我也做了g.V.map()验证,是符合count的。 (有时并非所有数据都被检索到,有时它可以正常工作)

我应该如何确认我尝试添加到图表中的数据是否实际添加并通过 gremlin 查询来确认?

【问题讨论】:

  • 听起来像是某种 cassandra 问题。
  • 您是刚开始使用 Titan 吗? 9 月发布 1.0 版。 titandb.io
  • 我是 Titan 的新手,我下载了 Github link 上的 Titian/All 0.4.4(向下滚动页面,有一个表格)。你认为 cassandra/Titan 有问题吗? (尽管插入顶点,有时 g.V.count() 也会显示零值)

标签: java titan


【解决方案1】:

所以我通过安装新的 Titan 0.5.2 解决了这个问题。现在数据已正确插入。 Titan 0.4.4 版本可能存在一些问题。

【讨论】:

  • 不错。为什么不至少 0.5.4? Titan 是一个开源项目。如果您刚刚开始,我建议您使用 1.0,因为它是可用的最新版本,并且最有可能获得支持和修复。
猜你喜欢
  • 2017-07-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-22
  • 2021-09-30
  • 2012-10-29
  • 2015-11-11
  • 1970-01-01
相关资源
最近更新 更多