The relationship between a URI
, resource
and entity body
has been confusing to many and subject to much debate.
A formalism is presented which hopefully will elucidate the basis of Fielding's "Representational State Transfer" (REST).
The XML MIME Transformation Protocol (XMTP) is used to represent an HTTP request and response. Resolution of a particular URI via the HTTP protocol involves an HTTP request message, an HTTP Method, and an HTTP response message.
Assuming the HTTP request and response messages were identified with Message Ids, the respective "mid:" URIs form the object
of two RDF statement statements each whose
subject
is the URI to be resolved e.g. http://example.org/uri
.
The predicate
of the statements is the URIref formed by the canonical URI of the HTTP protocol: http://www.ietf.org/rfc/rfc2616
composed with the particular HTTP method name as fragment identifier e.g.
http://www.ietf.org/rfc/rfc2616#GET
.
In N-Triples form:
@prefix http = <http://www.ietf.org/rfc/rfc2616#> . <http://example.org/uri> http:GET <mid:xxx-request> . <mid:xxx-request> rdf:type http:Request . <http://example.org/uri> http:GET <mid:xxx-response> . <mid:xxx-response> rdf:type http:Response .
When the request and response messages are not assigned URIs, they are treated as anonymous nodes. An RDF/XML syntax representation:
<rdf:RDF xmlns:http="http://www.ietf.org/rfc/rfc2616#" xmlns="http://www.openhealth.org/xmtp#"> <http:GET> <http:Request rdf:parseType="Resource"> <Request-URI rdf:resource="http://example.org/uri" /> <Host rdf:resource="http://example.org/uri" /> <Accept>*/*</Accept> </http:Request> <http:Response rdf:parseType="Resource"> <http:Status>200</http:Status> <Content-Type>text/plain</Content-Type> <Body>This is an example document entity</Body> </http:Response> </http:GET> </rdf:RDF>