简体   繁体   中英

Can vertices in DSE/DataStax graph be represented as key value

I have three questions on DSE graph:

  1. Can DSE graph vertices be represented as key,value entities. If yes what is the key and what will be the value?

  2. Is there a concept of primary key/index in DSE graph for vertex? If yes how to create that? Is vertex id the primary key/index?

  3. Can we have a composite value as primary key/index of vertex in DSE graph?

I am not an expert but I would try to help till some member of DataStax team picks it up:

1) You could do something like that:

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

Keep in mind that this won't return the unique id but it will return the rest of the properties.. You can get the vertex id with v.id() and it is a LinkedHashMap. For more here: how to query by vertex id in Datastax DSE 5.0 Graph in a concise way?

2) DSE Graph supports indexing on the property level of vertices which effectively acts as a primary index. For more information here: https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/createIndexes.html and https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/indexOverview.html

3) If I understand what you are asking, DSE Graph provides a way to have a custom primary vertex id that is composite by using composite partition keys: https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/createCustVertexId.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM