Share on Google+Share on Google+

XML Interviews Question page29,xml Interviews Guide,xml Interviews

This page discusses - XML Interviews Question page29,xml Interviews Guide,xml Interviews

XML Interviews Question page29


  1. 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 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.
    GET /myTripleStore HTTP/1.1
    Accept: application/rdf+xml
    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<>
    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
    Accept: application/rdf+xml
    Range: xpointer = xmlns(x:
    SELECT (?x foaf:mbox ?mbox)
    WHERE (?x foaf:name "John Smith") (?x foaf:mbox ?mbox)
    USING foaf FOR <>
    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 />
  2. What about non-XML resources?
    You can use the XPointer Framework with non-XML resources. This is especially effective when your resource is backed by some kind of a DBMS, or when you want to query a data model, such as RDF, and not the XML syntax of a representation of that data model.
    However, please note that the authoratitive interpretation of the fragment identifier is determined by the Internet Media Type. If you want to opt-in for XPointer, then you can always create publish your own Internet Media Type with IANA and specify that it supports the XPointer Framework for some kind of non-XML resource. In this case, you are going to need to declare your own XPointer schemes as well.
  3. What XPointer schemes are supported in this release?
    The XPointer integration distributions support shorthand pointers. In addition, they bundle support for at last the following XPointer schemes:
    * xmlns()
    * element()
    * xpath() - This is not a W3C defined XPointer scheme since W3C has not published an XPointer sheme for XPath. The namespace URI for this scheme is . It provides for addressing XML subresources using a XPath 1.0 expressions.
  4. How do I configure an XPointer processor?
    There is no required configuration for the XPointer Framework. The uberjar command line utility provides some configuration options. Applications configure individual XPointer processors when they obtain an instance from an appropriate XPointerProcessor factory method.
  5. How do integrate XPointer into my application?
    There are several ways to do this. The easiest is to use the uberjar release, which can be directly executed on any Java enabled platform. This makes it trivial to test and develop XPointer support in your applications, including server-side XPointer. The uberjar release contains a Java class org.CognitiveWeb.xpointer.XPointerDriver that provides a simple but flexible command line utility that exposes an XPointer processor. The XPointer is provided as a command line argument and the XML resource is read from stdin. The results are written on stdout by default as a set of null-terminated XML fragments. See XPointerDriver in the XPointer JavaDoc for more information.
    If you already have a Java application, then it is straight-forward to integrate XPointer support using: org.CognitiveWeb.xpointer.XPointerProcessor You can see an example integration by looking at the XPointerDriver in the source code release.
  6. How do I implement an application-specific XPointer scheme?
    Short answer: Implement org.CognitiveWeb.xpointer.ISchemeProcessor
    The XPointer Framework is extensible. One of the very coolest things about this is that you can develop your own XPointer schemes that expose your application using the data model that makes the most sense for your application clients. For example, let's say that you have a CRM application. The important logical addressing units probably deal with concepts such as customers, channels, and products. You can directly expose these data using a logical addressing scheme independent of the actual XML data model. Not only does this let people directly address the relevant concepts using a purpose-built addressing vocabulary, but this means that your addressing scheme can remain valid even if you change or version your XML data model. What a bonus! The same approach is being used by the MindSwap laboratory at the University of Maryland to prototype a variety of XPointer schemes for addressing semantic web data.
  7. How do I support very large resources?
    You can only do this with server-side XPointer. Further, you need to use (or implement) XPointer schemes that do not depend on a parsed XML document model. Basically, you need to use an XPointer scheme that interfaces with an indexed persistence store (RDBMS, ODBMS, or XML DBMS) which exposes to your ISchemeProcessor the information that it needs to answer subresource addressing requests. You will also have to provide shorthand pointer support for your DBMS-based resource. The default shorthand pointer processor assumes that it has access to a parsed XML document, so it can't be used when you have a very large XML resource.
  8. How do I contribute?
    The XPointer implementation is hosted as a SourceForge project. If you want to contribute send an email to one of the project administrators from the project home page. The XPointer module uses numerous tests to validate correct behavior of the XPointer processor. One valuable way to contribute is by developing new tests that demonstrate broken behavior. Patches that fix the problems identified by those tests are also valuable, but it is by the tests themselves that we can insure that each release of the XPointer processor will continue to meet the requirements of the various XPointer specifications.
  9. What's XLink?
    This specification defines the XML Linking Language (XLink), which allows elements to be inserted into XML documents in order to create and describe links between resources. It uses XML syntax to create structures that can describe links similar to the simple unidirectional hyperlinks of today's HTML, as well as more sophisticated links. Definition: An XLink link is an explicit relationship between resources or portions of resources.] [Definition: It is made explicit by an XLink linking element, which is an XLink-conforming XML element that asserts the existence of a link.] There are six XLink elements; only two of them are considered linking elements. The others provide various pieces of information that describe the characteristics of a link.


Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: XML Interviews Question page29,xml Interviews Guide,xml Interviews  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image