问题
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:
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.
Hope it helps.
来源:https://stackoverflow.com/questions/37133409/orientdb-import-edges-only-using-etl-tool