Does dgraph support multiple facets?

Hi all,

Does dgraph support adding multiple facets to a single edge? for example, an edge between a person and a friend might have a facet since=DATE and how_we_know_each_other=[“WORK”, “SCHOOL”, “FAMILY”]

Yes, but not the way you suggest it. Facets can only be Edge to Edge, there’s no way to extend it.

If you want to do something more “dynamic” I would recommend creating a nodes structure and relating people to these Nodes.

Facet example:

_:alice <friend> _:bob (since=2006-02-02T13:01:09, close=true, know1=WORK, know2=SCHOOL, know3=FAMILY) .

would return this way:

 "friend|close": true,
 "friend|know1": "WORK",
 "friend|know2": "SCHOOL",
 "friend|know3": "FAMILY"

And if you do:

_:alice <friend> _:bob (since=2006-02-02T13:01:09, close=true, how_we_know_each_other="WORK, SCHOOL, FAMILY") .

would return this way:

 "friend": [
          {
            "friend|close": true,
            "friend|how_we_know_each_other": "WORK, SCHOOL, FAMILY",
            "friend|since": "2006-02-02T13:01:09Z"
          }
        ]
1 Like

ah makes sense. thank you!

1 Like

that’s correct .

just be caution, once you want to modify this facets, it will be a overwrite operation