IntroductionThe 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. BehavioursThis collection object provides for two specific behaviours:
Object modelThe collection object will require, amongst any others, three specific datastreams:
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.
The location field of the datastream in the demonstration object points to: http://yourServer:yourPort/fedora/get/demo:SmileyStuff/demo:Collection/list
<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
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'. |