#URGENT #ETL #LINK #LIGHTWEIGHT_EDGES #BIDIRECTIONAL_REFERENCE

94 views
Skip to first unread message

Anmol Deep

unread,
Jul 28, 2015, 7:06:14 AM7/28/15
to OrientDB
This is very urgent , a lot of dependency on this , help appreciated .

Lets say RDBMS has two tables A and B

A has a foreign key , a primary key in B .
B has no reference of A  , i.e .no foreign key that is a primary key in A .

My orientDB database has a schema-Full data-model which maintains bi-directional lightweight edges / LINKS , here

A will have out_ReferenceOfB and B will have in_ReferenceOfA.

Now I do ETL using exported .csv files and try to populate data .

I use ETL to read .json config file for table A and .csv file for table A , and use the following json object to create lightweight edges :

"link": {
                        "joinFieldName": "foreignKeyB",
                        "linkFieldName": "out_ReferenceOfB ",
                        "linkFieldType": "LINK",
                        "lookup": "B.IDENTIFIER",
                        "unresolvedLinkAction": "ERROR"
                }

How do I create the other link / reference which creates out_ReferenceOfA in the same .json configuration by using ETL .


alessand...@gmail.com

unread,
Jul 28, 2015, 10:27:30 AM7/28/15
to OrientDB, anmold...@gmail.com
Hi,
I did not manage to create a bi-directional lightweight with .json configuration by using ETL.
If you want you can create the link from the class A to the class B using ETL and after you can use this javascript function
to create the edges from B to A.

var g=orient.getGraph();
var b=g.command('sql','select from in_ReferenceOfA');
for(i=0;i<b.length;i++){
  rid_out=b[i].getProperty('out').getId().toString();
  rid_in =b[i].getProperty('in').getId().toString();
  g.command('sql',"create edge out_ReferenceOfB from " + rid_in + " to "+ rid_out);
}


Regards,
Alessandro

Luca Garulli

unread,
Jul 28, 2015, 11:08:00 AM7/28/15
to OrientDB, anmold...@gmail.com
Use the "edge" transformer in ETL, not LINK.

Best Regards,

Founder & CEO


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anmol Deep

unread,
Jul 28, 2015, 11:22:28 AM7/28/15
to Luca Garulli, OrientDB
but edge will not create Light weight Edges , we need Light Weight Edges without any class extension E , without any recordID being created.

Regards
Anmol
--
Kind Regards,
Anmol Deep

Luigi Dell'Aquila

unread,
Jul 29, 2015, 2:39:38 AM7/29/15
to orient-...@googlegroups.com, Luca Garulli
Hi Anmol,

You can do it with ETL, just using EDGE transformer and then defining the loader like this (see useLightweightEdges: true):

"loader": {
        "orientdb": {
            "dbURL": ">yourDbUrl>",
            "dbType": "graph",
            "useLightweightEdges": true
        }
    }
I hope it helps

Luigi

Luigi Dell'Aquila

unread,
Jul 29, 2015, 2:39:47 AM7/29/15
to orient-...@googlegroups.com, Luca Garulli
sorry, wrong formatting:

Anmol Deep

unread,
Jul 29, 2015, 5:28:31 AM7/29/15
to OrientDB, l.ga...@orientdb.com, luigi.de...@gmail.com
Really appreciate your reply , but I think may be I have been unable to explain my problem clearly , I will do one more try .

I am putting down my Schema now :

orientDB class Shelf
Properties :

---
out_ShelfContainsSlot


----

orientDB class Slot

Properties :

in_ShelfContainsSlot

Now consider Shelf .csv has no reference of Slot and Slot.csv has reference of Shelf in the .csv as foreign key .

Now please help me how can I use Edge transformer to create bidirectional references .

OK I may have got the understanding of lightWeightEdges wrong as internally implemented as LINKS  , sorry for that .

Now we are clear , can  you help me Luca , Luigi .

Best Regards
Anmol Deep
Reply all
Reply to author
Forward
0 new messages