Important | Queries for edge label connections


Pawan Shriwas
 

Hi All,

I need a solution for these two things, but I tried but was not able to find the solution.

1. I want to list the edgeLabel connection created in janusgraph 
       mgmt.addConnection(“belongsTo”, vertexLabel1, vertexLabel2);

       mgmt.addConnection("belongsTo", vertexLabel1, vertexLabel3);

       mgmt.addConnection("belongsTo", vertexLabel3, vertexLabel4);

       mgmt.addConnection("belongsTo", vertexLabel5, vertexLabel6);


    Can see only edge labels in printSchema but not how many time it used between Vertex labels. which is created after above steps.


2.  I want to update the direction of one connection of edgeLabel.


        current ->     mgmt.addConnection(“belongsTo”, vertexLabel1vertexLabel2);   //outdirection towards the vertexLabel2

       

       I want to update the direction of this created connection. like below 

       Expected Direction -->       mgmt.addConnection(“belongsTo”, vertexLabel2 ,vertexLabel1);     // I want only one kind of direction to exist between these 2 nodes types. If this option creates another connection then I want the previous direction to be removed.



Please review and let me know how I can achieve this.  Thanks in advance.



Thanks,

Pawan 

    

 

     




Boxuan Li
 
Edited

Hi Pawan,

Regarding your first question, try this in Java:

mgmt.getEdgeLabel("belongsTo").mappedConnections()

which should give you a list of Java objects that contain the outgoing and incoming labels for each connection.

In the Gremlin console, you could do this:

mgmt.getEdgeLabel("knows").mappedConnections()[0].incomingVertexLabel
mgmt.getEdgeLabel("knows").mappedConnections()[0].outgoingVertexLabel
which is a bit hacky but hopefully shall work. Feel free to create a feature request on GitHub and link to this thread.

Regarding your second question, IIRC there is no such API available.

Best regards,
Boxuan