Validate a json-ld file against the context #24
-
Hi, which options do I have to validate the schema of a json-ld file? I want to be sure there are only valid keys and of the correct type... if possible Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
For validating the allowed keys ("valid keys"), you'll need to do this at the JSON level before the JSON-LD processing, since JSON-LD will create new IRIs for any properties it encounters. Libraries like Type validation can be done at the RDF level using SHACL or ShEx. However, there's currently no maintained SHACL implementation in Elixir, and you'd need to use external tools like Apache Jena or TopBraid. While there was a ShEx implementation for Elixir, it's no longer maintained and isn't compatible with current RDF.ex versions. If you plan to work with the data in Elixir anyway, you might want to look into Grax: https://rdf-elixir.dev/grax/, which also provides type validation capabilities. |
Beta Was this translation helpful? Give feedback.
For validating the allowed keys ("valid keys"), you'll need to do this at the JSON level before the JSON-LD processing, since JSON-LD will create new IRIs for any properties it encounters. Libraries like
ex_json_schema
can help you with this.Type validation can be done at the RDF level using SHACL or ShEx. However, there's currently no maintained SHACL implementation in Elixir, and you'd need to use external tools like Apache Jena or TopBraid. While there was a ShEx implementation for Elixir, it's no longer maintained and isn't compatible with current RDF.ex versions.
If you plan to work with the data in Elixir anyway, you might want to look into Grax: https://rdf-elixir.dev/grax/, which…