【问题标题】:Can vertices in DSE/DataStax graph be represented as key valueDSE/DataStax 图中的顶点可以表示为键值吗
【发布时间】:2023-04-06 21:07:02
【问题描述】:

我有关于 DSE 图的三个问题:

  1. DSE 图形顶点能否表示为键值实体。如果是,关键是什么,价值是什么?

  2. 在 DSE 图中是否有顶点的主键/索引的概念?如果是,如何创建?顶点 id 是主键/索引吗?

  3. 我们可以有一个复合值作为 DSE 图中顶点的主键/索引吗?

【问题讨论】:

    标签: graph datastax gremlin datastax-enterprise-graph


    【解决方案1】:

    我不是专家,但我会尽力提供帮助,直到 DataStax 团队的某些成员发现:

    1) 你可以这样做:

    Vertex v = ...
    Iterator<VertexProperty<VertexProperty>> iter = v.properties();
    while (iter.hasNext()){
       VertexProperty prop = iter.next();
       System.out.println(prop.label()+" "+ prop.value());
    }
    

    请记住,这不会返回唯一 id,但会返回其余属性。您可以使用 v.id() 获取顶点 id,它是一个 LinkedHashMap。更多信息:how to query by vertex id in Datastax DSE 5.0 Graph in a concise way?

    2) DSE Graph 支持对顶点的属性级别进行索引,它有效地充当主索引。如需更多信息,请点击此处: https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/createIndexes.htmlhttps://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/indexOverview.html

    3) 如果我理解您的要求,DSE Graph 提供了一种使用复合分区键来获得复合的自定义主顶点 id 的方法:https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/createCustVertexId.html

    【讨论】:

    • 我认为 DSE 不支持主索引。
    • 你是什么意思?它确实支持对 id 和特定顶点标签上的任何属性进行索引.. 基本上都充当主索引
    • 是的,它支持索引但不支持唯一索引
    • 正如我所说,您可以在主索引中使用自定义 id (3) 来实现除 id 之外的属性的唯一性。我认为这是一个将在未来某个时候可用的功能用于 Datastax DSE 图表
    猜你喜欢
    • 2015-03-10
    • 2020-08-19
    • 2017-05-21
    • 2017-05-05
    • 2017-01-26
    • 2018-04-03
    • 2017-05-29
    • 2017-01-29
    • 2017-10-24
    相关资源
    最近更新 更多