【问题标题】:gremlin outputs different from as seen on the internet, I think in bytesgremlin 输出与互联网上看到的不同,我认为以字节为单位
【发布时间】:2015-08-28 10:54:39
【问题描述】:

如何获取 gremlin 输出的正常索引以及 v

目前它输出类似这样的内容

gremlin> g.V
WARN  com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx  - Query requires iterating over all vertices [()]. For better performance, use indexes
gremlin> juno = g.addVertex(null);
==>v[128824]
gremlin> june = g.addVertex(null);
==>v[128828]
gremlin> jape = g.addVertex(null);
==>v[128832]

但是正如我在互联网上看到的那样,当在图中添加顶点时,它应该会输出类似这样的内容

gremlin> g.V
WARN  com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx  - Query requires iterating over all vertices [()]. For better performance, use indexes
gremlin> juno = g.addVertex(null);
==>v[1]
gremlin> june = g.addVertex(null);
==>v[2]
gremlin> jape = g.addVertex(null);
==>v[3]

当我尝试加载大约 10000 个顶点时会出现同样的问题。所有这些顶点都有 _id 字段,但加载后该字段消失了。也不是顶点已经用这个 id 加载了......同样是 _type 字段的情况,它在加载后也不存在。

我需要这些 id 和类型,因为它们也映射到其他表中的某些内容。

这是我的 rexter doghouse 关于 3 个加载顶点的视图

http://i.imgur.com/xly0jf8.png

对所有这些东西有点困惑。

提前致谢

【问题讨论】:

    标签: groovy titan gremlin


    【解决方案1】:

    当顶点被添加到 Titan 时,会分配一个 Element 标识符。该值取决于 Titan,您不应期望它以“1”或任何其他特定数字开头。如果您需要有类似的数字,您应该自己添加。

    关于 _id_type 字段,我假设您指的是在 Rexster 的 JSON 输出中找到的字段。请注意,这些是附加到输出的 Rexster 字段。 _id 始终存在,应直接映射到 Vertex.id()Edge.id(),具体取决于您返回的数据。 _type 只是指返回的 JSON 是代表“顶点”还是“边”。该数据不存储在 Titan 本身中。

    【讨论】:

    • 这是否意味着我们在 json 文件中为 id 赋予的任何值,titan 都不会使用它,并且这些 id(以及类型)仅限于 json 阅读器
    • 几乎所有蓝图实现都会忽略提交给它们的 ID - 所以 Titan 在这方面并没有太大的不同。如果您需要这样的东西,请创建您自己的 ID 属性键和索引。您不需要发送_type,因为您正在对/graph/vertices/graph/edges 资源进行POST(如果使用REST),在这种情况下“类型”是已知的,或者您正在调用@987654331 Gremlin 中的 @ 方法显式创建边缘。
    • _type 出现在结果中的唯一原因是当您返回顶点和边的混合结果并需要区分两者时会有所帮助。
    猜你喜欢
    • 1970-01-01
    • 2020-07-09
    • 1970-01-01
    • 2017-05-14
    • 2018-02-21
    • 2017-09-14
    • 2013-01-05
    • 1970-01-01
    • 2021-09-22
    相关资源
    最近更新 更多