Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports wildcard(*) in exclude method or fetchplan. #4773

Closed
gongdo opened this issue Aug 11, 2015 · 1 comment
Closed

Supports wildcard(*) in exclude method or fetchplan. #4773

gongdo opened this issue Aug 11, 2015 · 1 comment
Assignees
Milestone

Comments

@gongdo
Copy link

gongdo commented Aug 11, 2015

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?

@lvca lvca added this to the 3.0 milestone Sep 21, 2015
@lvca lvca modified the milestones: 2.2.x (next hotfix), 3.0 Apr 24, 2017
@lvca lvca self-assigned this Apr 24, 2017
@lvca
Copy link
Member

lvca commented Apr 24, 2017

Supporting in the exclude/include functions makes totally sense to me, I'd like to port this on 2.2.x too.

lvca added a commit that referenced this issue Apr 24, 2017
lvca added a commit that referenced this issue Apr 24, 2017
@lvca lvca closed this as completed Apr 24, 2017
@robfrank robfrank modified the milestones: 2.2.x (next hotfix), 2.2.19 Apr 25, 2017
lvca added a commit that referenced this issue Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants