【问题标题】:set-up our own vertex id in titan using java API使用 java API 在 Titan 中设置我们自己的顶点 ID
【发布时间】:2014-04-07 10:39:23
【问题描述】:

我想像下面提到的那样将自己的id设置为顶点。

BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("storage.backend", "hbase");
configuration.setProperty("storage.hostname", "slave05");
configuration.setProperty("storage.port", "2181");
configuration.setProperty("storage.tablename", "REC_GRAPH1");
TitanGraph graph = TitanFactory.open(configuration);

Vertex vertex = graph.addVertex(200);
graph.commit();

但我不能......我想我缺少一些配置设置。

请帮帮我..

谢谢, 维韦克

【问题讨论】:

    标签: java bigdata titan


    【解决方案1】:

    Titan 分配它自己的标识符。你不能分配你自己的。这种行为是大多数图形数据库的典型行为(您会在几乎所有Blueprints 实现中发现这种情况)。如果您有一个您希望保留的自定义标识符,您应该创建一个适当的索引以快速查找该值并将其视为顶点上的属性。

    【讨论】:

    • 这意味着您是说我们可以将它作为该顶点的属性(类似于 id=2)?我们不能覆盖默认的 vertex-id ?
    • 您不能覆盖 id 并且“id”本身是一个保留的属性名称。只需将其重命名为其他名称并引用它(例如 _id、uid 等)
    猜你喜欢
    • 1970-01-01
    • 2017-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-28
    • 2016-05-04
    相关资源
    最近更新 更多