2
votes

As I understand there are ways to validate serialized RDF (e.g RDF/XML) against RDF Schema (How to validate a RDF with your RDF schema). Also, there are various converters from RDF/XML to JSON-LD serialization format (and vice versa). Searching the Internet I could not find a straightforward way to validate JSON-LD against some sort of JSON Schema that relates to JSON-LD as RDF Schema relates to RDF(/XML). Of course, there are various JSON-LD document forms so I assume that one schema cannot easily describe all forms.

So my question is, what is the proper or recommended way of validating JSON-LD document from the RDF perspective?

BTW I run on a project that tries to solve validation of JSON linked data https://github.com/common-workflow-language/schema_salad.

2

2 Answers

2
votes

RDF Schema is somewhat Mia-named, but can be used to make sense of (actually, infer information from) an RDF graph. OWL provides more mechanisms for asserting shapes of RDF Graphs as does new work on RDF Shapes. The key is that these work on the data model, not the syntax. Both RDF/XML and JSON-LD are RDF serializations, which can be used to reduce documents expressed in an appropriate syntax into an RDF Graph, where these tools operate.

The Structured Data Linter uses this approach to "validate" web pages representing information in schema.org and many other vocabularies using these principles.

1
votes

RDF Schema is not for validation. In fact you cannot express a contradiction with RDF Schema alone. For example if an instance of Person is the subject of a triple with maximumSpeed as predicate and the property maximumSpeed has Vehicle (rather than Person) as rdfs:domain there is no contradiction, there is simply a thing that is both a Person and a Vehicle. To say that something cannot at the same time be a person and a vehicle you would need OWL, RDF Schema is not enough for that.

RDF Data Shapes will allow constraints and validation.