property indexing and nested props?

Hi! I have a JSON that looks like this:

{
  "prefixes": {
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  }
}

Is it possible to cast it to a turtle like this:

[] :prefixes
  [ex:pfx "rdfs"; ex:iri: "http://www.w3.org/2000/01/rdf-schema#"],
  [ex:pfx "xsd"; ex:iri "http://www.w3.org/2001/XMLSchema#"]

I played at http://rdf.greggkellogg.net/distiller . I used
https://www.w3.org/TR/json-ld11/#property-based-data-indexing in this
context:

{
  "@context": {
    "@vocab": "http://example.org/",
    "ex": "http://example.org/",
    "prefixes" : {
      "@container": "@index",
      "@index": "ex:pfx",
      "@nest": "ex:iri"
    }
  }
}

I can convert this JSON (please note the extra added dict with key "iri"):

{
  "prefixes": {
    "rdfs": {"iri": "http://www.w3.org/2000/01/rdf-schema#"},
    "xsd": {"iri": "http://www.w3.org/2001/XMLSchema#"}
  }
}

But I cannot convert the original JSON (that doesn't have "iri" keys).
I get error "invalid value object: Attempt to add illegal key to value
object: ex:pfx".

Received on Monday, 17 February 2020 13:26:13 UTC