Re: How can Multiple Vertex-Centric Indexes Be Built for the Same Edge Label in JanusGraph


Jerry He <jerr...@...>
 

Hi, Jun

This is a good question. Let me try to answer it. 

As you see in the document, multiple vertex-centric indexes can be defined on the same edge type/label.  Under the hook, for each vertex-centric index, JanusGraph will create an 'artificial' edge label, and columns will be created/added to the vertex (the same way as you mentioned for the regular column:  label id + direction + sort key + adjacent vertex id + edge id).  For example, if you create an edge index call 'myindex' for the edge label 'friend', the artificial edge label will be called 'friend:myindex' (the name is actually long id).  Then artificial edges (index edges) with this label will be added to the vertex node. The sort keys are the properties defined in the index.  In such way, there is no conflict or problem with defining multiple such vertex-centric indexes.

Thanks,

Jerry

On Fri, Sep 20, 2019 at 1:46 AM Jun Li <jltz9...@...> wrote:

Hi: 

 

In the JanusGraph documentation, https://docs.janusgraph.org/basics/index-performance/, the section on "Vertex-Centric Indexes", there is the following paragraph:

 

"Multiple vertex-centric indexes can be built for the same edge label in order to support different constraint traversals. JanusGraph’s query optimizer attempts to pick the most efficient index for any given traversal."

 

Then I went to review the JanusGraph Data Model in the JanusGraph documentation, https://docs.janusgraph.org/advanced-topics/data-model/, there is a section of “Individual Edge Layout” along with a diagram to show the key/column/value layout.   One edge that is associated with a vertex can only be stored as a unique “edge” cell in a row that belongs to the vertex.  And in this cell, the column key is encoded as: label id + direction + sort key + adjacent vertex id + edge id, and the column value is encoded as: signature key + other (cell) properties.

 

My understanding is that for a unique edge, with only one column key, there can only be one single label id and the associated sort key to be supported.  Therefore, one edge can only be encoded with one edge label, and one vertex-centric index (represented by the sort key) belonging to this edge label. 

 

My question is: how can multiple vertex-centric indexes to be supported, given the current JanusGraph Data Model?

 

If I remember correctly, this multiple vertex-centric indexes support statement did not appear in the older version of JanusGraph documentation (say, before January 2019). And the JanusGraph data model has stayed the same without changes since the beginning of JanusGraph. 

 

Jun

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/e3ded08f-b5a0-4a53-bc78-dd66c696d39d%40googlegroups.com.

Join janusgraph-dev@lists.lfaidata.foundation to automatically receive all group messages.