-
Notifications
You must be signed in to change notification settings - Fork 7
HATEOAS
Martynas Jusevičius edited this page Sep 23, 2019
·
2 revisions
Processor supports HATEOAS in two ways.
Every interaction with an LDT processor can be seen as a template call with LDT parameter arguments:
-
?this
bound to the request absolute path (request URI without query string) as the default argument - arguments provided in the URI query string
Linked Data Templates specify that every application state has to be URI-identifiable. Therefore, if any query string arguments are present, a "state" URI resource is generated. Its description contains all the arguments (LDT parameters and their values) and is appended to the response body. For example:
<http://localhost:8080/birthdays?sex=http%3A%2F%2Fwww.wikidata.org%2Fentity%2FQ6581097> <https://github.com/AtomGraph/Processor/blob/develop/examples/wikidata#sex> <http://www.wikidata.org/entity/Q6581097> ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://github.com/AtomGraph/Processor/blob/develop/examples/wikidata#SexParam> ;
<https://www.w3.org/ns/ldt#paramName> "sex" ;
<http://spinrdf.org/spl#predicate> <https://github.com/AtomGraph/Processor/blob/develop/examples/wikidata#sex> ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#value> <http://www.wikidata.org/entity/Q6581097> ;
<https://www.w3.org/ns/ldt#arg> <http://localhost:8080/birthdays?sex=http%3A%2F%2Fwww.wikidata.org%2Fentity%2FQ6581097> ;
<https://www.w3.org/ns/ldt/core/domain#stateOf> <http://localhost:8080/birthdays> .
Any HTTP response code other than 2xx
will include a machine-readable RDF description of the error. An example with 500 Internal Server Error
:
[
<http://purl.org/dc/terms/title> "Forbidden" ;
<http://www.w3.org/2011/http#sc> <http://www.w3.org/2011/http-statusCodes#InternalServerError> ;
<http://www.w3.org/2011/http#reasonPhrase> "Internal Server Error" ;
<http://www.w3.org/2011/http#statusCodeValue> "500"^^<http://www.w3.org/2001/XMLSchema#long> ;
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2011/http#Response>
] .