Hi Luigi,

you're right. It seems to work now with intersect, maybe it was too late 
yesterday. It wasn't the parenthesis, was a mistake while writing the code 
directly by hand.
Thank you for the quick help.

Patrick

Am Mittwoch, 15. April 2015 12:31:55 UTC+2 schrieb Luigi Dell'Aquila:
>
> Hi Patrick
>
> a way to do this is the following 
>
> SELECT FROM (SELECT expand(out("Owns")) from #16:1) where out("Located") 
> contains #17:0
>
> another way is with the intersect, that is supposed to work... I see that 
> at the beginning of main select there is a spare parenthesis, maybe that's 
> the problem. If it's not, could you provide a simple test case? I'll check 
> it for you
>
> Thanks
>
> Luigi 
>
>
> 2015-04-15 10:55 GMT+02:00 qnts <[email protected] <javascript:>>:
>
>> Hello all,
>>
>> I try to work OrientDB since a few weeks and have a lot of fun. One 
>> question came around. I have some classes Product, Team and Region with 
>> edge classes Owns and Located. Edges are Team -> Owns -> Product and Region 
>> -> Located -> Product. Now I want to query fast all products owned by some 
>> teams and located in some regions.
>>
>> Single subqueries with (given #16:1 is a team and #17:0 is a region)
>>
>> *SELECT FROM (TRAVERSE out("Owns") from #16:1) where @class="Product"*
>> *SELECT FROM (TRAVERSE out("Located") from #17:0) where @class="Product"*
>>
>> or
>>
>> *SELECT EXPAND(out("Owns")) from #16:1*
>> *SELECT EXPAND(out("Located")) from #17:0*
>>
>> work well and are very fast.
>>
>> Now I want to do get the intersected rows of both queries like this:
>>
>> *SELECT (EXPAND($c) LET*
>> *$a = (SELECT EXPAND(out("Owns")) from #16:1),*
>> *$b = (SELECT EXPAND(out("Located")) from #17:0),*
>> *$c = INTERSECT($a, $b)*
>>
>> what doesn't work. I found the following gets the right result, but is 
>> quite slow with lots of data:
>>
>> *SELECT FROM Product WHERE in_Owns.out = #16:1 AND in_Located.out = #17:0*
>>
>> Is there a way to accomplish this or to speed up the last query with an 
>> index? Thanks for helping.
>>
>> Patrick
>>
>> -- 
>>
>> --- 
>> 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] <javascript:>.
>> 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.

Reply via email to