Create Edges by ETL in same Class

69 Views Asked by At

1) Class Items with ItemId and Name ready in the database. 2) CSV-file: two columns,

ItemId1,ItemId2001

ItemId1,ItemId2345

ItemId1,ItemId2381

...

ItemId2,ItemId8393

ItemId2,ItemId8743

.. etc.

Question:

How to define a ETL json-file to create Edges between ItemId1 and all the ItemId's in col#2, and between ItemId2 and its col#2-peers.

1

There are 1 best solutions below

4
On

I tried to reproduce your problem.

I had this Items

enter image description here

and with this code I connected them

{
  "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"
    }
  }
}

and I got

enter image description here

Hope it helps.