Hi Davide,

it seems to be a bug, could you please report it in the issue tracker?

Thanks

Luigi


2015-10-20 10:31 GMT+02:00 Davide Neri <[email protected]>:

> Hey,
> does anybody have any idea?
>
>
>
> Il giorno mercoledì 14 ottobre 2015 10:57:34 UTC+2, Davide Neri ha scritto:
>>
>> Hi!
>> I'm using OrientDB *v.2.1.1* with *useLightweightEdges *property set to
>> true.
>> I have a question on fetch plans. I'm not sure if I'm not using it well,
>> but I'm not getting the result I was looking for.
>>
>> The structure of the database classes in the example is:
>>
>> *User*    V     #13
>> *Event*   V     #14
>> *Org*     V     #15
>> *Media*   V     #16
>>
>> *admin   *E     *User  --> Org*
>> *fol**low  *E     *User  --> Org*
>> *aut**hor  *E     *Event --> Org*
>> *ava**tar  *E     *Org   --> Media*
>> *thumb   *E     *Event --> Media*
>>
>>
>>
>> I need to write a query that fetches a specific Event, its relative
>> thumb, author and the author's avatar. Nothing else.
>> So this is what I wrote in the beginning:
>>
>> SELECT @this.toJSON('rid,class,fetchPlan:[*]in_*:-2 [*]out_*:-2
>> out_thumb:0 out_author:0 out_author.out_avatar:0') FROM Event WHERE @rid
>> = #14:8
>>
>>
>> With *[*]in_*:-2 [*]out_*:-2* I thought I'd exclude any edge and with
>> the rest of the parameters I specify what I need.
>> But while this works for the level 0, it doesn't seem to work for the
>> other levels: out_author and out_thumb have listed all the other properties
>> too.
>>
>> {
>>     "@rid": "#14:8",
>>     "@class": "Event",
>>     "name": "EVENT_TEST",
>>     "out_author": [
>>         {
>>             "@rid": "#15:0",
>>             "@class": "Org",
>>             "name": "ORG_TEST",
>>             *"in_admin": [ "#13:0", "#13:5", "#13:6", "#13:9", "#13:10",
>> "#13:13", ... ],*
>>             *"in_follow": [ "#13:0", "#13:4", "#13:5", "#13:6",
>> "#13:14", "#13:15", ... ],*
>>             *"in_author": [ "#14:6", "#14:7", "#14:8", "#14:9",
>> "#14:10", "#14:11" ... ]*
>>             "out_avatar": [
>>                 {
>>                     "@rid": "#16:2",
>>                     "@class": "Media",
>>                     "url": "www.image.com"
>>                     *"in_thumb": [ "#14:4", "#14:6", "#14:7", "#14:12",
>> "#14:14", "#14:15", ... ],*
>>                     *"in_avatar": [ "#15:0" ]*
>>                 }
>>             ]
>>         }
>>     ],
>>     "out_thumb": [
>>         {
>>             "@rid": "#16:1",
>>             "@class": "Media",
>>             "url": "www.image.com"
>>             *"in_thumb": [ "#14:2", "#14:5", "#14:8", "#14:9", "#14:10",
>> "#14:13", ... ],*
>>             *"in_avatar": [ "#15:2" ]*
>>         }
>>     ]
>> }
>>
>>
>>
>>
>> So I tried to add some more parameters to remove the properties I don't
>> want:
>>
>> *[*]in_avatar:-2   [*]in_thumb:-2   [*]in_author:-2   [*]in_admin:-2
>> [*]in_follow:-2*
>>
>> So the query became like this:
>>
>> SELECT @this.toJSON('rid,class,fetchPlan:[*]in_*:-2 [*]out_*:-2
>> out_thumb:0 out_author:0 out_author.out_avatar:0 [*]in_avatar:-2
>> [*]in_thumb:-2 [*]in_author:-2 [*]in_admin:-2 [*]in_follow:-2') FROM
>> Event WHERE @rid = #14:8
>>
>>
>> This partially worked since it removed
>> *   "out_author.in_author"*
>> *   "out_author.out_avatar.in_thumb"*
>> *   "out_author.out_avatar.in_avatar"*
>>
>> But it did NOT remove
>> *   "out_author.in_admin"*
>> *   "out_author.in_follow"*
>>
>>
>> {
>>     "@rid": "#14:8",
>>     "@class": "Event",
>>     "name": "EVENT_TEST",
>>     "out_author": [
>>         {
>>             "@rid": "#15:0",
>>             "@class": "Org",
>>             "name": "ORG_TEST",
>>             "in_admin": [ "#13:0", "#13:5", "#13:6", "#13:9", "#13:10",
>> "#13:13", ... ],
>>             "in_follow": [ "#13:0", "#13:4", "#13:5", "#13:6", "#13:14",
>> "#13:15", ... ],
>>             "out_avatar": [
>>                 {
>>                     "@rid": "#16:2",
>>                     "@class": "Media",
>>                     "url": "www.image.com"
>>                 }
>>             ]
>>         }
>>     ],
>>     "out_thumb": [
>>         {
>>             "@rid": "#16:1",
>>             "@class": "Media",
>>             "url": "www.image.com"
>>         }
>>     ]
>> }
>>
>>
>> I also tried to use:
>>
>> *out_author.in_admin:-2   **out_author.in_follow:-2*
>>
>> but the result is the same, it's just not excluding them from the result.
>>
>>
>> Am I doing anything wrong?
>> How can I setup this query?
>>
>> Thank you very much!
>>
>> [davide]
>>
>> --
>
> ---
> 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.

Reply via email to