User interface preview

The information in an OSLC resource is composed of RDF triples, defining the values of properties. Triples whose object is the URI of another resource are often called links. When presenting a link to a human user, it is common to want to include information about the other resource referenced by the URI of the link. This information might be included in the rendering of the page of the current resource, or on conventional PCs that have a mouse as an input device it might appear in a pop-up window when the mouse is over the link. [Obviously, the pop-up window technique does not apply for touch-screen devices like smart-phones and tablets, or at least the pop-up has to be triggered by a different gesture.] OSLC defines a protocol that makes it convenient for an application to obtain a small amount of information about the resource that is the target of a link for the purposes of this sort of display.

UI preview consists solely of the definition of a new media type, and a representation format for that media type. The new media type is application/x-oslc-compact+xml. When a GET is performed on a resource with this media type, a conforming implementation is expected to return a small amount of information about the resource suitable for display purposes. This information is in RDF format and includes the following properties:

  • The title of the resource
  • A shorter title of the resource
  • The URL of an icon for the resource. The client application is expected to perform a subsequent GET to retrieve the icon.
  • The URL of an HTML document suitable for displaying in a small pop-up window. The client application is expected to perform a subsequent GET to retrieve the HTML.
  • Some information on sizing for these smaller and larger pop-ups

 

OSLC requires that this information be returned in RDF/XML format - other RDF or non-RDF representations are not allowed.

UI Preview example


<?xml version="1.0" encoding="UTF-8" ?>

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:oslc="http://open-services.net/ns/core#">

    <oslc:Compact
        rdf:about="http://example.com/bugs/12345">

        <dcterms:title> 12345: &lt;s&gt;Null pointer exception during startup&lt;/s&gt; </dcterms:title>
        <oslc:shortTitle> 12345 </oslc:shortTitle>
        <oslc:icon rdf:resource="http://example.com/icons/defect.jpg" />

        <oslc:smallPreview>
            <oslc:Preview>
                <oslc:document rdf:resource="http://example.com/bugs/12345?hover=small" />
            </oslc:Preview>
        </oslc:smallPreview>


        <oslc:largePreview>
            <oslc:Preview>
                <oslc:document rdf:resource="http://example.com/bugs/12345?hover=large" />
                <oslc:hintWidth> 60em </oslc:hintWidth>
                <oslc:hintHeight> 20em </oslc:hintHeight>
            </oslc:Preview>
        </oslc:largePreview>

    </oslc:Compact>
</rdf:RDF>
			

Learn more about UI Preview in the OSLC Core specification