OrientDB import edges only using ETL tool

350 Views Asked by At

I already used the OETL to insert all my Vertex to the graph.

Now I have a file that outlines the edges at the following way:

node_1,rel_type,node_2
11000001,relation_A,10208879
11000001,relation_A,10198662
11000001,relation_B,10159927
11000001,relation_C,10165779

How can I import it using the OrientDB OETL tool?

I tried the following:

"transformers": [
    { "csv": {} },
    { "command" : {
            "command" : "create edge ${rel_type} from (select flatten(@rid) from V where node_id= ${node_1}) to (select flatten(@rid) from V where node_id = ${node_2})",
            "output" : "edge"
        }
    }
  ],

But this failed to work since it can't parse the values from the csv.

1

There are 1 best solutions below

0
On

You must use the $input variable.

"transformers": [{
        "csv": {
            "separator": ","
        }
    },
    {
    "command" : {
            "command" : "create edge ${input.rel_type} from (select from V where node_id= ${input.node_1}) to (select from V where node_id = ${input.node_2})",
            "output" : "edge"
        }
    }
  ],

It works for me.

enter image description here

Hope it helps.