Skip to content

Validation of RDF

EntryStore makes use of several different libraries and classes that handle RDF differently. Some libraries fail when sending in RDF that does not conform completely to the specification, others are more relaxed.

When sending in erroneous metadata, EntryStore responds with a HTTP 400 status code. In order to find out about the exact reason it is possible to use the validator resource. It performs checks in three stages:

  1. Can the RDF be deserialized into a Graph object.
  2. Do all URIs used in subject, predicate, object and context (named graph identifier) position conform to RFC 3986 as used by java.net.URI.
  3. Can the graph be loaded into a repository.

The resource support content negotiation and all RDF formats supported by Sesame/RDF4J may be used when using the POST verb to send RDF data in the request.

The response contains always an HTTP status 200 and a JSON structure consisting of an object with an error array. A successfully validated request contains an empty error array. The validator attempts to return a validation result that is as complete as possible, but this is not possible in all cases. E.g. it is not possible to validate all URIs if the request body cannot be deserialized into a proper RDF graph before.

If an error occurs on the server side that is unrelated to the request, an HTTP status 500 without JSON body is responded with.

Example

POST http://{base}/validator

Content-Type: application/rdf+xml

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcat="http://www.w3.org/ns/dcat#">
  <dcat:Distribution rdf:about="https://sub.domain.tld/#1#2">
  </dcat:Distribution>
</rdf:RDF>

Example response

{
  "errors": [
    "Illegal character in fragment at index 25: https://sub.domain.tld/#1#2"
  ]
}