Table of Contents

Introduction

The demonstration objects provided with the Fedora download contain an implicit collection of 'Smiley' objects. The child objects (demo:SmileyGlass, demo:SmileyBucket etc) each contain (amongst others) two image datastreams, one referencing a thumbnail and one a rather larger image, and a RELS-EXT datastream in which the object asserts a membership relationship with the parent (collection) object, demo:SmileyStuff. The child objects conform to a dual-resolution-image content model which is dealt with elsewhere. Here we concentrate on the parent, the collection object.

Behaviours

This collection object provides for two specific behaviours:

  • list
    • list will cause the repository resource index to be queried for members of the collection object. The list will be returned as xml
  • view
    • view will use an xslt stylesheet to render the xml produced by 'list' as an html page

Object model

The collection object will require, amongst any others, three specific datastreams:

  • a datastream of type 'text/plain' which references an RDF query used to determine the children of this collection object. The demonstration txt file contains:
select $collTitle $collDesc $member $memberTitle $memberDesc
from   <#ri>
where  <info:fedora/demo:SmileyStuff> <dc:title>                   $collTitle
and    <info:fedora/demo:SmileyStuff> <dc:description>             $collDesc
and    $member                        <fedora-rels-ext:isMemberOf> <info:fedora/demo:SmileyStuff>
and    $member                        <dc:title>                   $memberTitle
and    $member                        <dc:description>             $memberDesc

The location field of the datastream points to the txt file on the web server. Assuming that you imported the demonstration materials, the demonstration file can be found at:

http://yourServer:yourPort/fedora-demo/image-collection-demo/SmileyStuff-MemberQuery.txt

Note that the construction of the query relies on a knowledge of how the Dublin Core (dc) datastream is structured in the collection's child objects. Specifically they must have an entry for <dc:title> and <dc:description> otherwise they will not be matched.

  • a datastream of type text/xml which calls the list function of the collection object.

The location field of the datastream in the demonstration object points to:

http://yourServer:yourPort/fedora/get/demo:SmileyStuff/demo:Collection/list
  • a second datastream of type text/xml which points to an xslt file on the web server. The demonstration xslt file contains:
<xsl:stylesheet version="1.0" xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
{panel}
  <xsl:template match="/">
    <xsl:variable name="collTitle" select="/s:sparql/s:results/s:result/s:collTitle"/>
    <xsl:variable name="collDesc" select="/s:sparql/s:results/s:result/s:collDesc"/>
    <html>
      <head>
        <title>
          <xsl:value-of select="$collTitle"/>
        </title>
      </head>
      <body bgcolor="#bbddbb">
        <center>
          <font face="arial,helvetica">
            <h2>
              <xsl:value-of select="$collTitle"/>
              <br/>
              <i>
                <xsl:value-of select="$collDesc"/>
              </i>
            </h2>
          </font>
        </center>
        <hr size="1"/>
        <center>
          <table border="0" cellpadding="5">
            <xsl:for-each select="/s:sparql/s:results/s:result">
              <xsl:variable name="pid" select="substring-after(s:member/@uri, '/')"/>
              <tr>
                <td>
                  <center>
                    <a>
                      <xsl:attribute name="href">
                        <xsl:text>/fedora/get/</xsl:text>
                        <xsl:value-of select="$pid"/>
                        <xsl:text>/demo:DualResImage/fullSize</xsl:text>
                      </xsl:attribute>
                      <img height="120" width="160">
                        <xsl:attribute name="src">
                          <xsl:text>/fedora/get/</xsl:text>
                          <xsl:value-of select="$pid"/>
                          <xsl:text>/demo:DualResImage/mediumSize</xsl:text>
                        </xsl:attribute>
                      </img>
                      <br/>
              ( Full Size )
            </a>
                  </center>
                </td>
                <td>
                  <b>
                    <xsl:value-of select="s:memberTitle"/>
                  </b>
                  <br/>
                  <xsl:value-of select="s:memberDesc"/>
                </td>
              </tr>
            </xsl:for-each>
          </table>
        </center>
      </body>
    </html>
  </xsl:template>
{panel}
</xsl:stylesheet>

The location field of the datastream points to the xslt file on the web server. Assuming that you imported the demonstration materials, the demonstration file can be found at:

http://yourServer:yourPort/fedora-demo/image-collection-demo/SmileyStuff-ViewStylesheet.xsl
  • The labelling of the datastreams is arbitrary but their MIME-types are not. For the record the datastreams in the demonstration object are called, respectively:
  • MemberQuery.txt
  • MemberList.xml
  • ViewStylesheet.xsl

Disseminator

The BDef providing the two methods, list and view, is called 'demo:Collection'. It requires three bindings: query, list and xslt which are mapped respectively to the three datastreams described above. The mechanisms are provided by the BMech 'demo:DualResImageCollection'.

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels