HTTP requests, databases and how to transmit SHACL validation reports

Hi,

I’m a committer over at Eclipse RDF4J and am currently looking at how we can extend our RDF4J Server to respond to the client with the SHACL validation report if the user's request could not be processed due to a violation.

An example:

We have a database of users with some SHACL rules that among other things specify that a user needs to have exactly one password. 

The client tries to add a user, but the user didn’t specify a password, so the request gets rejected by the database. This should naturally have been detected on the client side first - but you know… lazy developers and the like :P

Anyway, since this is happening over HTTP we need to send an appropriate response to the client so that the client can tell the user to provide a password. This response should contain the SHACL validation report, we don’t want to reinvent the wheel.

For the actual HTTP response we have a few things to consider:

 - Status and status line. Currently considering 409 - Conflict 
 - Content-type header. Currently considering this to be "application/n-quads" to reflect the serialisation of the SHACL validation report
 - Custom header. Currently considering "Eclipse-RDF4J-Exception: ShaclSailValidationException” to tell the client that this response is due to a ShaclSailValidationException

We have other options too:

 - "Content-type: application/n-quads+shacl-validation-report” similar to how json-ld is handled
 - Custom status: 409 - SHACL violation
 - Magic numbers train of thought with the first line of the response being something like “SHACL validation report”.


What I’m wondering is: How are other databases solving this particular problem?

And: Did the SHACL Working Group discuss this issue? Maybe in light of the SPARQL protocol?

Best regards,
Håvard M. Ottestad

Received on Sunday, 22 March 2020 16:23:35 UTC