Skip to content

Faulty validation of @container in JSON-LD version 1.1 #40

Closed
@gebsl

Description

@gebsl

Following setup:

I have a JSON-LD document with an @import statement (shortened):

{
  "@context": {
    "@version": 1.1,    
    "@import": "http://localhost:8080/some-document.jsonld",
  },
  "@graph": [
  ]
}

The referenced @import resolves to this document (shortened):

{
  "@context": {
    "rdfs": "https://www.w3.org/2000/01/rdf-schema#",
    "xsd": "https://www.w3.org/2001/XMLSchema#",
    "owl": "https://www.w3.org/2002/07/owl#",
    "subClassOf": {
      "@id": "rdfs:subClassOf",
      "@type": "@id"
    },
    "import": {
      "@id": "owl:import",
      "@type": "@id"
    },
    "entry": {
      "@id": "some:entry",
      "@container": "@language"
    }
  }
}

Parsing the document gives the follwing error:
Error: Invalid term @container for 'label' ('0'), must be one of @list, @set, @index, @language, @graph, @id, @type

Parsing is done via jsonld-streaming-parser.

The error is thrown on this line:

throw new ErrorCoded(`Invalid term @container for '${key}' ('${containerValue}'), \

Actually, @language should be a valid term, as it is also used in the specification:
https://www.w3.org/TR/json-ld11/#example-71-language-map-expressing-a-property-in-three-languages

Also, json-ld playground says this is valid JSON-LD
https://json-ld.org/playground/#startTab=tab-expanded&json-ld=%7B%22%40context%22%3A%7B%22rdfs%22%3A%22https%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%22%2C%22xsd%22%3A%22https%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%22%2C%22owl%22%3A%22https%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%22%2C%22subClassOf%22%3A%7B%22%40id%22%3A%22rdfs%3AsubClassOf%22%2C%22%40type%22%3A%22%40id%22%7D%2C%22import%22%3A%7B%22%40id%22%3A%22owl%3Aimport%22%2C%22%40type%22%3A%22%40id%22%7D%2C%22entry%22%3A%7B%22%40id%22%3A%22some%3Aentry%22%2C%22%40container%22%3A%22%40language%22%7D%7D%7D&context=%7B%7D

What I don't understand: Why is there a loop over the keys of objectValue in your code? As I understand, objectValue should already be a string and looping over it does not make sense to me.

Thanks in advance for your help, best regards,
gebsl

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions