由ETL在同一个类中创建边

时间:2016-10-26 11:27:17

标签: orientdb orientdb2.2 orientdb-etl

1)在数据库中准备好ItemId和Name的类项目。 2)CSV文件:两列,

ItemId1,ItemId2001

ItemId1,ItemId2345

ItemId1,ItemId2381

...

ItemId2,ItemId8393

ItemId2,ItemId8743

.. 等

问题:

如何定义ETL json文件以在ItemId1和col#2中的所有ItemId之间以及ItemId2与其col#2-peers之间创建边缘。

1 个答案:

答案 0 :(得分:0)

我试图重现你的问题。

我有这个项目

enter image description here

并使用此代码将它们连接起来

{
  "source": { "file": { "path": "myPath/item.csv" } },
  "extractor": {"row": {}},
    "transformers": [{
        "csv": {
            "separator": ","
        }
    },
    {
    "command" : {
            "command" : "create edge from (select from Item where idItem= '${input.idItem1}') to (select from Item where idItem= '${input.idItem2}')",
            "output" : "edge"
        }
    }
  ],
  "loader": {
    "orientdb": {
       "dbURL": "plocal:myPath/myDb",
       "dbType": "graph"
    }
  }
}

我得到了

enter image description here

希望它有所帮助。

相关问题