Yeah that seems true. But it's very important to ahve such a thing. 

But do you know how the JavaScript would look like. It's kind of


   - 1.take first id of class Author
   - 2.look for that id on class Post
   - 3.create an edge on all entries
   - return to 1.
   

Am Donnerstag, 28. August 2014 21:48:30 UTC+2 schrieb odbuser:
>
> I think you're still stuck with creating the edges programmatically using 
> sql "create edge" or using the blueprint api.
>
> create edge doesn't have a where clause to do the 'join'... but a syntax 
> like this might be interesting:
>
> # WARNING: this is not currenty valid syntax
> create edge from ( select from car ) to ( select from car where $from.id=id 
> )
> or
> create edge from ( select from car ) to ( select from car ) where $from.id
> =$to.id
>
>
> On Thursday, August 28, 2014 8:53:00 AM UTC-4, Curtis Mosters wrote:
>>
>> Will try it out for sure. But another idea maybe. When I run this:
>>
>> CREATE LINK comments TYPE linkset FROM comment.postId To post.id INVERSE
>>
>> This runs great. It connects the right entries with each other. Just 
>> missing the real edges and you cannot set properties this way. So maybe 
>> would it be good to do this. And after this another statement that looks 
>> for those connections and creating on them the real edges. 
>>
>> WDYT?
>>
>> Am Mittwoch, 27. August 2014 22:33:05 UTC+2 schrieb odbuser:
>>>
>>> Ok, sorry, I misunderstood your original intent.  I didn't realize that 
>>> person.id=post.id.
>>>
>>> create edge doesn't take a where clause so that won't work.
>>>
>>> You can almost do it with update like so:
>>> update person add out_Wrote=( select from post where id = $parent.
>>> current.id )
>>> update car add in_Wrote=( select from person where id = $parent.current.id 
>>> )
>>> # Cleanup the empty collections
>>> update person remove out_Wrote where out_Wrote.size() = 0
>>> update car remove in_Wrote where in_Wrote.size() = 0
>>>
>>> but that stores the edge as the wrong type even though graph functions 
>>> seem to work fine...  this is also implementation specific and things 
>>> probably break down if your edges have properties... or if the 
>>> implementation changes over time... and it may not even be efficient.
>>>
>>> Your only choice may be to do it programmatically in a loop using one of 
>>> the apis... or create a js script and run it using the js or jss console 
>>> commands...
>>>
>>> #Note that function definition defaults to sql so you have to specify 
>>> javascript
>>> create function test "somejavascript" LANGUAGE javascript
>>> select test()
>>>
>>> The select statement will print a bogus empty record but it does execute 
>>> your javascript.  functions are stored in the class OFunction so you can 
>>> manage them using SQL
>>> select from OFunction
>>> delete from OFunction
>>> etc.
>>>
>>> Your javascript can include loops and access the database.  Check the 
>>> wiki documentation.
>>>
>>> On Wednesday, August 27, 2014 2:34:30 AM UTC-4, Curtis Mosters wrote:
>>>>
>>>> But image one million entries. So I need a for loop in SQL. Looking for 
>>>> an id in Person and then doing this statement above. Is that possible?
>>>>
>>>> Edit: Also tried 
>>>> create edge Wrote let $a = 1 from ( select from person where id = $a ) 
>>>> to ( select from post where id = $a )
>>>>
>>>> but does not work. In that way I could do another SELECT on Person. But 
>>>> yeah it does not work =/
>>>>
>>>>
>>>>
>>>> Am Dienstag, 26. August 2014 23:33:41 UTC+2 schrieb odbuser:
>>>>>
>>>>> Alex is right.  Just replace personID and postID with actual values 
>>>>> (and use an appropriate link name).
>>>>>
>>>>> In your example:
>>>>>
>>>>> create edge hasPost from ( select from person where id = 1 ) to ( 
>>>>> select from post where id = 1 )
>>>>>
>>>>>
>>>>>

-- 

--- 
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.

Reply via email to