Search code examples
orientdborientdb2.2

OrientDb - How to add a new edge between two existing vertices mapping with one common property?


Is there a way to add an edge between existing vertices which maps one common property between them ?

Example - Class1 has three properties - A,B,C and Class 2 has three properties - A,D,E where Class1.A has same values as that in Class2.A

How can I create an edge which maps all A values in Class1 to all A values in Class2 without reloading the data ?

Also, is there a way I can achieve this from the User Interface ? I can see an option to create an Edge there but it does not ask for the property value to map with.

Note: I am using orientdb-community-importers-2.2.27

Thanks!


Solution

  • Try this:

    create edge <edge name> from (select from class1 where A IN (select A from class2)) to (select from class2 where A IN (select A from class1))
    

    Hope it helps

    Regards