How to deduplicate facet data?

Schema:

name: string @index(hash) .
seq: int @index(int) .
followed: [uid] @reverse .

Mutation:

  "set": [
    {
      "name": "Nancee",
      "uid":"_:Nancee0",
      "seq": 0
    },
    {
      "name": "Nancee",
      "uid":"_:Nancee1",
      "seq": 1
    },
    {
      "name": "Tayler",
      "uid":"_:Tayler",
      "seq": 0
    },
    {
      "name": "Kae",
      "uid":"_:Kae",
      "seq": 0
    },
    {
      "name": "Manel",
      "uid":"_:Manel",
      "seq": 0
    },
    {
      "uid":"_:Nancee0",
      "followed": {
        "uid":"_:Kae",
        "followed|group": "A"
      }
    },
    {
      "uid":"_:Tayler",
      "followed": {
        "uid":"_:Kae",
        "followed|group": "A"
      }
    },
    {
      "uid":"_:Nancee1",
      "followed": {
        "uid":"_:Kae",
        "followed|group": "B"
      }
    },
    {
      "uid":"_:Manel",
      "followed": {
        "uid":"_:Kae",
        "followed|group": "B"
      }
    }
  ]
}

About the data:
Nancee and Tayler followed Kae through group A, Manel followed Kae through group B, and also Nancee followed Kae through group B.
Question:
How to query which groups users follow Kae through?

I try to use this json, but it lookup all groups and the groups are repeated.

	q(func: eq(name, "Kae")) @recurse(depth: 3){
		name,
        ~followed @facets
  }
}

Facets are not first class citizens. Having that said, facets are not good for filtering data and primarily should be used for meta data IMO. I don’t kbow of any good way to do what you want.

a bit diffucult. :joy:

Indeed. Good for very simple use cases.