-
-
Notifications
You must be signed in to change notification settings - Fork 874
Description
I'm running v2.1.0. I'm using HTTP APIs, and also Studio to run SQLs.
Here's my setup:
create class A extends V
create class B extends V
create class C extends V
create class Called extends E
let A = create vertex A set name="A";
let B = create vertex B set name="B";
create edge Called from $A to $B;
// ... repeat several times to show heavy relationship between A and B ...
create edge Called from $A to $B;
let C = create vertex C set aLink=$A, name="C";
Assume the $A is #12:0, and $C is #20:0.
I want to select all $C with linked $A but exclude $A's heavy edges. I could archive that with this command:
select *, aLink.exclude('out_Called') from #20:0 fetchplan in_*:-2 out_*:-2 aLink:0
The result looks like this:
{
"result": [
{
"@type": "d",
"@rid": "#20:0",
"@version": 2,
"@class": "C",
"aLink": {
"@type": "d",
"@rid": "#12:0",
"@version": 7,
"@class": "A",
"name": "A"
},
"name": "C"
}
]
}
But, what if vertex $A had many kind of in/out edges? I need to exclude all those edges explicitly. Like aLink.exclude('out_A', 'out_B', 'out_C', ...)
. This is not a good practice, definitely.
It would be happier if I could do like aLink.exclude('out_*', 'in_*')
.
Wait, it looks like fetchplan
, Why didn't I make same thing with fetchplan
? Because I couldn't make it via fetchplan
. I tried several commands but none of these were worked for me.
select from #20:0 fetchplan in_*:-2 out_*:-2 aLink:0 aLink.out_*:-2
select from #20:0 fetchplan in_*:-2 out_*:-2 aLink:0 aLink.out_Called:-2
select from #20:0 fetchplan in_*:-2 out_*:-2 aLink:0 aLink.out_*:-2 aLink.out_Called:-2
// all these do NOT exclude aLink.out_Called in result.
I think fetchplan
is too tricky to make it right.
It would be easier, also happier if I could do like fetchplan *.in_*:-2 *.out_*
so that all edges within all levels could be excluded in the result.
How do you guys think? Is there better way to manage nested properties in the result?