Hi Gianluigi,
good questions.

On 20 December 2013 09:49, Gianluigi Belli <[email protected]> wrote:

> Thank you @Lvc@,
> that's a great improvement!
>
> Can I ask you which computational complexity we can expect from this?
>
> select out('Friend')[67] from #31:40
>

We support 1-N relationships with LINKSET so once deserialized the
collection in memory the access to the 68th position is sequential but RID
are not resolved while browsing. So I'd say it's close to O(log N).

We're working to new feature to let users to specify the collection type to
store edges. With LINKLIST accessing to the 68th would be even faster.


> Is it a O(1) or O(N) where N is the number of edges outgoing from the
> vertex?
>
> Another question:
>
> select out('Friend')[name='MONA'] from #31:40
>
> uses indexes?
>

Not now. Once we've finished the implementation of new Vertex-Centric
indexes, if you create the out(friend) as a map<name,edge> you could access
to Mona link in O(log N).

Lvc@



>
>
>
> On Thursday, December 19, 2013 1:05:36 PM UTC+1, Lvc@ wrote:
>>
>> Hi all,
>> in "develop" branch I've just committed a new powerful feature: allow to
>> filter collections in chain. To understand it let's go to a couple of
>> examples.
>>
>> *Examples*
>>
>> *Example 1: Get the first friend of mine*
>>
>> You can get it by using:
>>
>> select expand( out ) from (
>>   select out('Friend') from Profile where name = 'Luca'
>> ) limit 1
>>
>> But now you can also do this:
>>
>> select out('Friend')*[0]* from Profile where name = 'Luca'
>>
>> Much easier and faster on execution!
>>
>> *Example 2: from GratefulDeadConcerts database traverse all the out()
>> connection and get the first song called 'MONA'*
>>
>> select from (
>>   select expand( out() ) from V
>> ) where name = 'MONA' and type = 'song' limit 1
>>
>>  @rid @version @class name in_followed_by song_type performances 
>> typeout_followed_byout_sung_byout_written_by
>> #9:6<http://localhost:2480/studio/index.html#/database/GratefulDeadConcerts/browse/edit/9:6>19VMONA[2]cover1song[2][1][1]
>> Executed in 0.455 seconds.
>>
>> Now let's use the new way:
>>
>> select expand( out()*[name='MONA'][type='song']* ) from V
>>
>>  @rid @version @class name in_followed_by song_type performances 
>> typeout_followed_byout_sung_byout_written_by
>> #9:6<http://localhost:2480/studio/index.html#/database/GratefulDeadConcerts/browse/edit/9:6>19VMONA[2]cover1song[2][1][1]
>> Executed in 0.106 seconds.
>>
>> Note last execution, in this case, is 4x faster!
>>
>> Squared brackets [] allows:
>> - filtering by one index, example out()[0]
>> - filtering by multiple indexes, example out()[0,2,4]
>> - filtering by ranges, example out()[0-9]
>> - filtering by equal conditions (only equals is supported), example
>> out()[@class = 'Person']
>>
>> Brackets [] can be chained, in this case it's like filtering by AND
>> operator. Look at the Example 2.
>>
>> For more information about the issue: https://github.com/
>> orientechnologies/orientdb/issues/1888
>>
>>
>> Luca Garulli
>> CEO at Orient Technologies
>> the Company behind OrientDB
>> http://about.me/luca.garulli
>>
>>  --
>
> ---
> 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/groups/opt_out.
>

-- 

--- 
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/groups/opt_out.

Reply via email to