Hi Colin,
Hi Nagu,

thanks for your answers! This works well for me.

I'll think this query feels most natural for my use case:

    select * from DocElem where type = "paragraph" and 
out('hasModel')[0].model like '%world%'

But what if I'll want to seek all connected hasModels and not only the one 
with index [0]?
Is it possible to do something like that?:

    ... and out('hasModel')[*].model like '%world%'

Thanks!

Regards,
Sven

Am Dienstag, 14. April 2015 07:33:00 UTC+2 schrieb nagaraja sosale 
ramaswamy:
>
> Colin's suggestion retrieves the properties of 'Model' vertex. If instead 
> you need the properties of DocElem vertex, you can try this:
>
> select * from DocElem where type = "paragraph" and out()[0].model like 
> '%world%'
>
> ----+-----+-------+---------+----------+------------
> #   |@RID |@CLASS |type     |uri       |out_hasModel
> ----+-----+-------+---------+----------+------------
> 0   |#48:0|DocElem|paragraph|domain.tdl|[size=1]
> ----+-----+-------+---------+----------+------------
>
> if you need to be specific about which edge to traverse, then use 
> something like this:
> select * from DocElem where type = "paragraph" and 
> out('hasModel')[0].model like '%world%'
>
> ----+-----+-------+---------+----------+------------
> #   |@RID |@CLASS |type     |uri       |out_hasModel
> ----+-----+-------+---------+----------+------------
> 0   |#48:0|DocElem|paragraph|domain.tdl|[size=1]
> ----+-----+-------+---------+----------+------------
>
> Note that in both cases, the Model vertex must be referenced using 
> index[0] (assuming that a DocElem can only be connected to one Model), 
> since the internal properties used to store edge references is a linkbag.
>
>
> ~nagu.
>
> On Monday, April 13, 2015 at 9:16:44 PM UTC+5:30, Sven Hodapp wrote:
>>
>> Hi there,
>>
>> I'm experimenting with OrientDB. Now I want to do some queries with more 
>> complexity.
>> DocElem and Model are subclasses of V and hasModel of E, I'm assuming 
>> this:
>>
>>     insert into DocElem set uri = 'domain.tdl', type = "paragraph"
>>
>>     insert into Model set hash = '0e1f', model = "hello world"
>>
>>     create edge hasModel from #12:2738 to #13:2658
>>
>> Now reading the docs, tempted me to do a query like this:
>>
>>     select * from DocElem where type = "paragraph" and 
>> out('hasModel').in.model like "%world%"
>>
>> What is my faulty reasoning? I'm using OrientDB 2.0.6.
>>
>> Thank you!
>>
>> Regards,
>> Sven
>>
>

-- 

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