OrientDB import edges only using ETL tool

 ̄綄美尐妖づ 提交于 2019-12-10 11:29:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!