【问题标题】:IndexableGraphHelper in Titan?Titan中的IndexableGraphHelper?
【发布时间】:2014-06-06 21:59:11
【问题描述】:

我想知道在 Titan 中是否有 Blueprint 的 IndexableGraphHelper 或等效解决方法的实现。在 ETL 期间,我想确保我不会创建重复的顶点并且我的边已经正确连接。因此,我尝试在创建之前查看是否存在具有相同键/值的顶点,如下所示:

Iterable<Vertex> sampleVertices =graph.getVertices("MyKey", MyKevValue); 

if (!sampleVertices.iterator().hasNext())
{
    //create a new vertex here
}
else 
{
    for(Vertex v:sampleVertices)
    {
        sampleVertex=v;
        //System.out.println("sampleVertexID: " + sampleVertex.getId().toString());
        break;
    }
}

我是 Titan 新手,已经好几年没用过 Java了。任何帮助将不胜感激。

【问题讨论】:

    标签: java titan


    【解决方案1】:

    Titan 没有这样的“辅助”方法。您必须编写自己的getOrCreate 函数以确保唯一性。这是“批量加载”中相当常见的模式。您可以考虑在 ETL 过程中使用BatchGraph,因为它有助于稍微简化getOrCreate,并有助于提高负载性能。您还可能会发现这个关于批量加载到 Titan 的博文系列很有用:“Powers of Ten” - Part OnePart Two

    【讨论】:

      猜你喜欢
      • 2016-01-24
      • 1970-01-01
      • 2017-10-16
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 2014-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多