Is it possible to select distinct non-uid predicate?

Now I get it!

So:


{
  set {
    
 # First we set Unique nodes for Skills
    _:Skill_Java <skill_name> "Java" .
    _:Skill_Dgraph <skill_name> "Dgraph" .
    _:Skill_Python <skill_name> "Python" .

 #Now we assign the users to that skills using your way to relate those
    _:michel <person> "Michel" .
    _:Skill_Java <skill_owner> _:michel .
    _:Skill_Dgraph <skill_owner> _:michel .
    
    _:ondrej <person> "Ondrej" .
    _:Skill_Python <skill_owner> _:ondrej .
    _:Skill_Dgraph <skill_owner> _:ondrej .

  }
}

And the same q:

{
  var(func: eq(person, ["Ondrej", "Michel"])) {
    ~skill_owner {
    	s as skill_name
    }  
  }
  
  q(func: uid(s), first: 10) {
    skill_name
  }
}
{
  "data": {
    "q": [
      {
        "skill_name": "Dgraph"
      },
      {
        "skill_name": "Python"
      },
      {
        "skill_name": "Java"
      }
    ]
  }

1 Like