json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
857 stars 152 forks source link

Relax the colliding keywords constraint for @type #402

Closed letmaik closed 6 years ago

letmaik commented 8 years ago

I want the following:

{
  "@context": {
    "type": "@type",
    "profile": "@type"
  },
  "type": "cov:Coverage",
  "profile": "cov:GridCoverage"
}

However this is not allowed. The playground says "Invalid JSON-LD syntax; colliding keywords detected".

However, this one works:

{
  "@context": {
    "type": {"@id": "rdf:type", "@type": "@id" },
    "profile": {"@id": "rdf:type", "@type": "@id" }
  },
  "type": "cov:Coverage",
  "profile": "cov:GridCoverage"
}

I understand that this restriction probably makes sense for other keywords, but could it do any harm for @type?

gkellogg commented 6 years ago

Transfered to the WG: https://github.com/w3c/json-ld-api/issues/4.

azaroth42 commented 6 years ago

@letmaik Would scoped contexts resolve your use case without relaxing the collision constraint? Or is it that you have existing JSON that you want to map to RDF and there are two fields that both map to rdf:type / @type?