Ask a Question

Facet Lists in RDF

Schema:

<name>: string @index(exact).
<nickname>: [string] .

Creating a list with facets in RDF is straightforward.

{
  set {
    _:Julian <name> "Julian" .
    _:Julian <nickname> "Jay-Jay" (kind="first") .
    _:Julian <nickname> "Jules" (kind="official") .
    _:Julian <nickname> "JB" (kind="CS-GO") .
  }
}
{
  q(func: eq(name,"Julian")){
    name
    nickname @facets
  }
}

Result:

{
  "data": {
    "q": [
      {
        "name": "Julian",
        "nickname|kind": {
          "0": "first",
          "1": "official",
          "2": "CS-GO"
        },
        "nickname": [
          "Jay-Jay",
          "Jules",
          "JB"
        ]
      }
    ]
  }
}