Gianpaolo,
I've done something similar using OrientDB 2.0.5, and am glad to see I am
not the only one to use this approach. Perhaps you have solved my next
problem already: I need to first check to see if there is already an
instance of the edge I am about to create. If the edge already exists, then
I don't need to do anything.
I'm struggling with the existence test. Do you have any recommendations?
Thanks in advance,
Patrick
On Sunday, April 20, 2014 at 4:30:13 AM UTC-6, Gianpaolo Altamura wrote:
>
> I created this js function to resolve the problem:
>
>
>
> function(masterTableName,masterTableName, linkedTableName, linkedPkName,
> edgeName){
> var cursor=db.query("select "+ linkedPkName + " from "+ linkedTableName);
> if(cursor!=null){
> for(var i=0; i<cursor.length; i++){
> var idFk=cursor[i].field(linkedPkName);
> var from = "from (select from " + masterTableName + " where "+
> masterFkName +" = "+ idFk+")";
> var to= "to (select from " + linkedTableName + " where "+ linkedPkName
> +" = "+ idFk+")";
> //return "Create edge " + edgeName + " "+ from + " " + to;
> db.command("Create edge " + edgeName + " "+ from + " " + to );
> }
> db.commit();
> }
> }
>
> Il giorno domenica 20 aprile 2014 11:01:17 UTC+2, Lvc@ ha scritto:
>>
>> Hi Gianpaolo,
>> sorry but such creation of links is not yet supported:
>>
>> https://github.com/orientechnologies/orientdb/issues/2045
>>
>> This issue is scheduled for 2.0 and this feature is in draft now.
>>
>> In the meanwhile you could create your own batch or use CREATE LINK mimic
>> the graph behavior:
>> https://github.com/orientechnologies/orientdb/wiki/Import-RDBMS-to-Document-Model#create-links
>>
>> Example:
>>
>> CREATE LINK out_comments TYPE linkset FROM comment.postId To post.id INVERSE
>>
>> CREATE LINK in_comments TYPE linkset FROM comment.postId To post.id
>>
>>
>>
>> Lvc@
>>
>>
>> On 19 April 2014 09:48, Gianpaolo Altamura <[email protected]> wrote:
>>
>>> Can anyone help me?
>>>
>>> Il giorno venerdì 18 aprile 2014 16:11:03 UTC+2, Gianpaolo Altamura ha
>>> scritto:
>>>
>>>> Hi all,
>>>> I'm trying to create edges between two entities imported from RDBMS.
>>>>
>>>> I'm following this tutorial: https://github.com/
>>>> orientechnologies/orientdb/wiki/Import-RDBMS-to-Graph-Model
>>>>
>>>> But this command:
>>>>
>>>> CREATE EDGE e FROM comment JOIN post ON postId = id INVERSE
>>>>
>>>>
>>>> doesn't work. I receive this error:
>>>>
>>>> java.lang.IllegalArgumentException: Argument 'comment' is not a
>>>> RecordId in form of string. Format must be: :
>>>>
>>>>
>>>> Where is the problem? How i can create edges using RDBMS foreign key?
>>>>
>>>>
>>>> Thanks in advance,
>>>> Gianpaolo.
>>>>
>>> --
>>>
>>> ---
>>> 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 [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.