I got doubt about @reverse edges

I created an edge with @reverse. My question is, when do I make an query above or below of the “obj”. Should not the reverse link appears in both?

Maybe I’m not be clear or this is a bug, but watch the video below. I make a normal user query for the user related object and the relation shows ok. The relationship of both is byreverse. However when the query is reversed the owner does not appear in the query. Now, when I force the link by adding the UID of the owner the relation appears in the query below.

That is, should not this relationship be automatic? the query should not get the same result from the outside in and inside out?

Hey @MichelDiz, I see that you are using Projeto_Owner predicate for traversing the relationship in both directions which is not how it works. You should use ~Projeto_Owner to traverse in reverse direction. I will illustrate with an example.

child: uid @reverse .
set {
  _:f <name> "Father" .
  _:f <child> _:c .
  _:c <name> "Child" .

Then if I started with the father, the query would be

{
  me(func: uid(father_id)) {
    name
    child {
      name
    }
}

If I started with child, the query would be

{
  me(func: uid(child_id)) {
    name
    ~child {
      name
    }
}
2 Likes

I had seen this signal, but I did not think it would be used. That was an allusion for relations - Not a Syntax thing LOL. Thank you very much Pawan!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.