DSE / DataStax图中的顶点是否可以表示为键值

时间:2016-08-17 13:28:18

标签: graph datastax gremlin datastax-enterprise-graph

我在DSE图上有三个问题:

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

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

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

1 个答案:

答案 0 :(得分:-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