How to Create Only Edges Through OrientDb ETL -
i have csv file, having id1 , id2. id1 , id2 vertex of 2 different classes. want make edge between id1 , id2. can achieved etl?
can add edge configuration of transformers achieve this.
i assume, that
- the 2 classes
a
,b
a
hasid1
b
hasid2
- the class of edge
atob
a
,b
instances present in dbthe atob.csv like
aid,bid
a1,b1
a2,b2
a2,b3
then following etl config do
{ "source": { "file": { "path": "...\atob.csv" } }, "extractor": { "csv": { } }, "transformers": [ { "merge": { "joinfieldname": "bid", "lookup": "b.id2", "unresolvedlinkaction": "warning" } }, { "vertex": { "class": "b" } }, { "edge": { "class": "atob", "joinfieldname": "aid", "lookup": "a.id1", "direction": "in" } }, { "field": { "fieldnames": ["aid", "bid"], "operation": "remove" } } ], "loader": { "orientdb": { "dburl": "plocal:../databases/...", "dbtype": "graph", "uselightweightedges": false, "classes": [ { "name": "a", "extends": "v" }, { "name": "b", "extends": "v" }, { "name": "atob", "extends": "e" } ] } } }
the result be
- (a1) ➡ (b1)
- (a2) ➡ (b2)
- (a2) ➡ (b3)
Comments
Post a Comment