-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Labels
Stalearea/querylang/expandIssues related to expand queries.Issues related to expand queries.area/querylang/functiondgraphIssue or PR created by an internal Dgraph contributor.Issue or PR created by an internal Dgraph contributor.exp/intermediateFixing this requires some experience with the project.Fixing this requires some experience with the project.kind/enhancementSomething could be better.Something could be better.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.
Description
Experience Report
reference: https://discuss.dgraph.io/t/how-to-find-relationship-between-two-nodes/7495/3?u=micheldiz
What you wanted to do
Use expand func to reduce hard typing. This increases the users experience.
{
M as var(func: type(Person)) @filter(eq(name, 'Martin Sheen')
O as var(func: type(Person)) @filter(eq(name, 'Oliver Stone')
q(func: uid(O) @recurse(depth: 50, loop: true) {
expand(User) @filter(uid(M))
}
}
What you actually did
{
M as var(func: type(Person)) @filter(eq(name, 'Martin Sheen')
O as var(func: type(Person)) @filter(eq(name, 'Oliver Stone')
q(func: uid(O) @recurse(depth: 50, loop: true) {
friend @filter(uid(M))
~friend @filter(uid(M))
follows @filter(uid(M))
~follows @filter(uid(M))
# maybe even more edges to add (...)
}
}
Why that wasn't great, with examples
The only problem is that you need to hard type all possible edges to accomplish that. Using "Expand(Type)" with a filter it would catch all possible edges from the Type Definition and apply the filter as a "template".
Metadata
Metadata
Assignees
Labels
Stalearea/querylang/expandIssues related to expand queries.Issues related to expand queries.area/querylang/functiondgraphIssue or PR created by an internal Dgraph contributor.Issue or PR created by an internal Dgraph contributor.exp/intermediateFixing this requires some experience with the project.Fixing this requires some experience with the project.kind/enhancementSomething could be better.Something could be better.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.