Interview Questions

What is server-side XPointer?

XML Interview Questions and Answers


(Continued from previous question...)

124. What is server-side XPointer?

The XPointer Framework provides an authoritative and extensible interpretation of the semantics of fragment identifiers for XML media types. However, HTTP does NOT transmit the fragment identifier as part of the HTTP request. Therefore XPointer is generally applied by the client, not by the server.
For example, assuming that http://www.myorg.org/myTripleStore identifies a resource that is willing to negotiate for RDF/XML, then the following is typical of an HTTP request for an RDF/XML representation of that resource and the server's response.
Request:

GET /myTripleStore HTTP/1.1
Host: www.myorg.org
Accept: application/rdf+xml

Response:
HTTP/1.1 200 Ok
Content-Type: application/rdf+xml

<rdf:RDF />
This request asks for the entire triple store, serialized as RDF/XML.
Server-side XPointer uses the HTTP "Range" header to transmit the XPointer expression to the server. For example, let's assume that the URI of the triple store is the same, but we want to select the subresources identified by the following RDQL query:
SELECT (?x foaf:mbox ?mbox)
WHERE (?x foaf:name "John Smith") (?x foaf:mbox ?mbox)
USING foaf FOR<http://xmlns.com/foaf/0.1/>
)

In that case the HTTP request, including a copy of the RDQL query wrapped up as an XPointer expression, looks as follows. Note that we have added a range-unit whose value is xpointer to indicate that the value of the Range header should be interpreted by an XPointer processor. Also note the use of the XPointer xmlns() scheme to set bind the namespace URI for the rdql() XPointer scheme. This is necessary since this scheme has not been standardized by the W3C.
GET /myTripleStore HTTP/1.1
Host: www.myorg.org
Accept: application/rdf+xml
Range: xpointer = xmlns(x:http://www.mindswap.org)x:rdql(
SELECT (?x foaf:mbox ?mbox)
WHERE (?x foaf:name "John Smith") (?x foaf:mbox ?mbox)
USING foaf FOR <http://xmlns.com/foaf/0.1/>
)

The response looks as follows. The HTTP 206 (Partial Content) status code is used to indicate that the server recognized and processed the Range header and that the response entity includes only the identified logical range of the addressed resource.
HTTP/1.1 206 Partial Content
Content-Type: application/rdf+xml

<!-- Only the selected sub-graph is transmitted to the client. --> <rdf:RDF />

(Continued on next question...)

Other Interview Questions