Setting Relationship/Edge name

Sample data:

A simple relationship between node ‘akshay’ and ‘django’ but I also want to set a property called ‘created’ in the relationship like
Akshay -(created)-> django

I also want to add some properties to that relationship like
Akshay -(created {year: 2018})-> django


So if I have data like
a -(knows {since: 2018})-> b
b -(knows)-> c
a -(friend)-> c

I just want to filter by relationship “knows” since 2018

2 Likes

You can use Facets to add a extra value to that edge relation.
https://docs.dgraph.io/query-language/#facets-edge-attributes

{
  set {
    _:alice <friend> _:bob (since=2018-02-02T13:01:09, close=true, relative=false) .
    _:alice <friend> _:charlie (since=2018-02-02T13:01:09, close=false, relative=true) .
    _:alice <friend> _:dave (since=2018-02-02T13:01:09, close=true, relative=true) .
   }
}
1 Like