JSON-LD Playground doesn't like the api's @context


I’m still in the process of poking around the “infrastructure oriented” parts of Omeka S. Some of that involves thinking about what I can do with the API.

When testing the JSON-LD that the API returns, I note that the JSON-LD playground doesn’t like the extra key-value pairs in the context object.

is the Playground’s permalink that will hit the API of an Omeka S server I’m building out. Not much content there yet.

The error is: “jsonld.SyntaxError: Invalid JSON-LD syntax; a term definition must not contain vocabulary_id”

Perhaps the Playground is being too strict. Indeed, it would be nice if it ignored keys it doesn’t recognize. But do ‘vocabulary_id’ and ‘vocabulary_label’ need to be in the context from the Omeka S perspective? If not, perhaps remove for greater compatibility with a common tool? Or another perspective I should be considering? I haven’t tried parsing this in PyLD.



p.s. Yes, I fixed the cross origin issue I was having yesterday.

This has come up previously, there’s an issue about it on the tracker.

My view is basically the same now as it was then: this is a SHOULD restriction in the spec and therefore in my view it’s improper for the Playground to raise it as an error and use the phrase “must” in the error message… but I also don’t think we’re really losing much of value if we simply omit those extra keys. Omeka S itself doesn’t use them; they were just provided to give a more simple or “casual” way to get at the vocabulary labels. With the context now separated out into a separate document they don’t really serve much of a purpose.

Thanks. Figuring out my way around here. Next time I’ll look harder for a pre-exiting issue…

Happy to see those keys omitted when you get the chance.

I’m also looking around the /src/Api/ directory but haven’t quite cracked where those keys are being inserted. If you could quickly point that out, I’ll edit locally. And maybe submit a patch? Though might take a bit to work up to that.

Again, thanks.


Those entries are created by the method addTermDefinitionsToContext in application/Module.php.

1 Like