Skip to content

GraphQL: Add support for rdfList #24

@Aklakan

Description

@Aklakan

The @rdfList annotation should produce JSON arrays in JSON mode but nested objects (with the usual first/rest properties) in RON (RDF Object Notation) mode.

A goal is to make it possible to expose the intermediate list nodes. This means that at least internally the pattern ?rdf:rest* ?inter . ?iter rdf:first ?item needs to be constructed. Ideally, it would also be possible to provide a pattern and designate one variable as the intermediate one.

So what needs to be clarified is the interaction between @pattern and @rdfList.

Rough ideas:

  • Have pattern point to the variable which carries the list, then use @rdfList on that variable.
{
   myList @pattern(of: "?s eg:authors ?l") @rdfList(from: "l", to: "item", via: "intermediate")
}

Generated pattern would be:

SELECT * {
  ?s eg:authors ?l .
  ?l rdf:rest* ?intermediate . ?intermediate rdf:first ?item .
}
  • Point the pattern's target to the list items, and use @rdfList to declare the intermediate variable.
{
   myList @pattern(of: "?s eg:authors/rdf:rest* ?i . ?i rdf:first ?o", from: "s", to: "o")
          @rdfList(of: "?i")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions