2.1.1 fetchPlan not excluding some unwanted edges

43 views
Skip to first unread message

Davide Neri

unread,
Oct 14, 2015, 4:57:34 AM10/14/15
to OrientDB
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
follow  E     User  --> Org
author  E     Event --> Org
avatar  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]

Davide Neri

unread,
Oct 20, 2015, 4:31:27 AM10/20/15
to OrientDB
Hey,
does anybody have any idea?

Luigi Dell'Aquila

unread,
Oct 20, 2015, 8:16:07 AM10/20/15
to orient-...@googlegroups.com
Hi Davide,

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

Thanks

Luigi


--

---
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 orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Davide Neri

unread,
Oct 20, 2015, 11:53:54 AM10/20/15
to OrientDB
Ok ;)
Reply all
Reply to author
Forward
0 new messages