Collection object for custom query and view
List all collections of books (not collections of collections) and count total pages and books
select $object $title $memberofd count(select $libri from <#ri> where $libri <fedora-rels-ext:isMemberOfCollection> $object ) count(select $pagine from <#ri> where $pagine <fedora-rels-ext:isMemberOf> $member3 ) from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> and $member3 <fedora-rels-ext:isMemberOfCollection> $object) and $member3 <fedora-model:hasModel> <info:fedora/islandora:bookCModel> and $object <dc:title> $title and $object <fedora-rels-ext:isMemberOfCollection> $memberof and $memberof <dc:title> $memberofd order by $memberofd $title
<xsl:stylesheet xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:variable name="BASEURL"> <xsl:value-of select="$baseUrl"></xsl:value-of> </xsl:variable> <ul> <xsl:for-each select="/s:sparql/s:results/s:result"> <xsl:variable name="pid" select="substring-after(s:object/@uri,'/')"></xsl:variable> <xsl:variable name="npage" select="s:k1"></xsl:variable> <li> <a> <xsl:attribute name="href"> <xsl:value-of select="$BASEURL"></xsl:value-of> <xsl:text>/fedora/repository/</xsl:text> <xsl:value-of select="$pid"></xsl:value-of>/-/ <xsl:value-of select="$pid"></xsl:value-of> </xsl:attribute> <xsl:value-of select="s:title"></xsl:value-of> </a> (<xsl:value-of select="s:memberofd"></xsl:value-of>) [<xsl:value-of select="s:k0"></xsl:value-of>] </li> </xsl:for-each> </ul> <em>Repository contains <b> <xsl:value-of select="/s:sparql/s:results/s:result/s:k1"></xsl:value-of> </b> pages.</em> </xsl:template> </xsl:stylesheet> List all parents of collections of books and count total pages and books
select $memberof $title count(select $member3 from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> and $member3 <fedora-rels-ext:isMemberOfCollection> $object) and $member3 <fedora-model:hasModel> <info:fedora/islandora:bookCModel> and $object <fedora-rels-ext:isMemberOfCollection> $memberof) count(select $pagine from <#ri> where $pagine <fedora-rels-ext:isMemberOf> $member3 ) from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> and $member3 <fedora-rels-ext:isMemberOfCollection> $object) and $member3 <fedora-model:hasModel> <info:fedora/islandora:bookCModel> and $object <fedora-rels-ext:isMemberOfCollection> $memberof and $memberof <dc:title> $title order by $title
<xsl:stylesheet xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:variable name="BASEURL"> <xsl:value-of select="$baseUrl"></xsl:value-of> </xsl:variable> <table class="tocnr_collection"> <xsl:for-each select="/s:sparql/s:results/s:result"> <xsl:variable name="pid" select="substring-after(s:memberof/@uri,'/')"></xsl:variable> <xsl:variable name="npage" select="s:k1"></xsl:variable> <tr> <td class="label"> <a> <xsl:attribute name="href"> <xsl:value-of select="$BASEURL"></xsl:value-of> <xsl:text>/fedora/repository/</xsl:text> <xsl:value-of select="$pid"></xsl:value-of>/-/collection </xsl:attribute> <img> <xsl:attribute name="src"> <xsl:value-of select="$BASEURL"></xsl:value-of> <xsl:text>/fedora/repository/</xsl:text> <xsl:value-of select="$pid"></xsl:value-of> <xsl:text>/TN</xsl:text> </xsl:attribute> </img> </a> </td> <td class="value"> <b> <xsl:value-of select="s:title"></xsl:value-of> </b> <br></br> <br></br> [<xsl:value-of select="s:k0"></xsl:value-of> books] </td> </tr> </xsl:for-each> </table> <em>Repository contains <b> <xsl:value-of select="/s:sparql/s:results/s:result/s:k1"></xsl:value-of> </b> pages.</em> </xsl:template> </xsl:stylesheet> List all parents and collections of books and count total pages, books and collections
select $memberof $title $id1 $title1 count(select $member3 from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> and $member3 <fedora-rels-ext:isMemberOfCollection> $object) and $member3 <fedora-model:hasModel> <info:fedora/islandora:bookCModel> and $object <fedora-rels-ext:isMemberOfCollection> $memberof) count(select $pagine from <#ri> where $pagine <fedora-rels-ext:isMemberOf> $member3 ) count(select $child from <#ri> where $child <fedora-rels-ext:isMemberOfCollection> $memberof ) count(select $bchild from <#ri> where $bchild <fedora-rels-ext:isMemberOfCollection> $member3 and $bchild <fedora-model:hasModel> <info:fedora/islandora:bookCModel> ) count(select $object from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> and $member3 <fedora-rels-ext:isMemberOfCollection> $object) and $member3 <fedora-model:hasModel> <info:fedora/islandora:bookCModel> ) from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> and $member3 <fedora-rels-ext:isMemberOfCollection> $object) and $member3 <fedora-model:hasModel> <info:fedora/islandora:bookCModel> and $object <fedora-rels-ext:isMemberOfCollection> $memberof and $memberof <dc:title> $title and $object <dc:title> $title1 and $object <dc:identifier> $id1 order by $title $title1
<?xml version="1.0"?> <xsl:stylesheet xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:variable name="BASEURL"> <xsl:value-of select="$baseUrl"/> </xsl:variable> <xsl:variable name="totcolle" select="count(/s:sparql/s:results/s:result)"/> <table class="tocnr_collection"> <xsl:for-each select="/s:sparql/s:results/s:result"> <xsl:variable name="pid" select="substring-after(s:memberof/@uri,'/')"/> <xsl:variable name="npage" select="s:k1"/> <xsl:variable name="posm" select="position()-1"/> <xsl:variable name="pidm" select="substring-after(/s:sparql/s:results/s:result[$posm]/s:memberof/@uri,'/')"/> <xsl:choose> <xsl:when test="$pid!=$pidm or $posm=0"> <tr> <td class="label"> <xsl:attribute name="rowspan"> <xsl:value-of select="2"/> </xsl:attribute> <a> <xsl:attribute name="href"><xsl:value-of select="$BASEURL"/><xsl:text>/fedora/repository/</xsl:text><xsl:value-of select="$pid"/>/-/collection </xsl:attribute> <img> <xsl:attribute name="src"> <xsl:value-of select="$BASEURL"/> <xsl:text>/fedora/repository/</xsl:text> <xsl:value-of select="$pid"/> <xsl:text>/TN</xsl:text> </xsl:attribute> </img> </a> </td> <td class="value"> <h3> <xsl:value-of select="s:title"/> </h3> <xsl:choose> <xsl:when test="s:k2=1 and s:k0=1"> [<xsl:value-of select="s:k2"/> collection / <xsl:value-of select="s:k0"/> book] </xsl:when> <xsl:when test="s:k2>1 and s:k0=1"> [<xsl:value-of select="s:k2"/> collections / <xsl:value-of select="s:k0"/> book] </xsl:when> <xsl:when test="s:k2=1 and s:k0>1"> [<xsl:value-of select="s:k2"/> collection / <xsl:value-of select="s:k0"/> books] </xsl:when> <xsl:otherwise> [<xsl:value-of select="s:k2"/> collections / <xsl:value-of select="s:k0"/> books] </xsl:otherwise> </xsl:choose> </td> </tr> <tr> <td class="value1"> <xsl:call-template name="elecolle"> <xsl:with-param name="start" select="1"/> </xsl:call-template> </td> </tr> </xsl:when> </xsl:choose> </xsl:for-each> </table> <em>Repository contains <b><xsl:value-of select="/s:sparql/s:results/s:result/s:k1"/></b> pages, <b><xsl:value-of select="/s:sparql/s:results/s:result/s:k3"/></b> books, <b><xsl:value-of select="/s:sparql/s:results/s:result/s:k4"/></b> collections. </em> </xsl:template> <xsl:template name="elecolle"> <xsl:param name="start"/> <xsl:variable name="indizero" select="position()"/> <xsl:variable name="indi" select="position() + $start -1"/> <xsl:variable name="pidzero" select="substring-after(/s:sparql/s:results/s:result[$indizero]/s:memberof/@uri,'/')"/> <xsl:variable name="pidindi" select="substring-after(/s:sparql/s:results/s:result[$indi]/s:memberof/@uri,'/')"/> <xsl:choose> <xsl:when test="$pidindi=$pidzero"> <a> <xsl:attribute name="href"><xsl:value-of select="$baseUrl"/><xsl:text>/fedora/repository/</xsl:text><xsl:value-of select="/s:sparql/s:results/s:result[$indi]/s:id1"/>/-/collection </xsl:attribute> <xsl:value-of select="/s:sparql/s:results/s:result[$indi]/s:title1"/> </a> <xsl:value-of select="' | '"/> <xsl:if test="$start != s:k2"> <xsl:call-template name="elecolle"> <xsl:with-param name="start" select="$start + 1"/> </xsl:call-template> </xsl:if> </xsl:when> </xsl:choose> </xsl:template> </xsl:stylesheet> Repository statistics
select $ordine $colle $titlecolle count( select $object from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> $colle and $libro <fedora-rels-ext:isMemberOfCollection> $object) and $pagine <fedora-rels-ext:isMemberOf> $libro) count( select $libro from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> $colle and $libro <fedora-rels-ext:isMemberOfCollection> $object) and $libro <fedora-model:hasModel> <info:fedora/islandora:bookCModel>) count( select $pagine from <#ri> where walk($object <fedora-rels-ext:isMemberOfCollection> $colle and $libro <fedora-rels-ext:isMemberOfCollection> $object) and $pagine <fedora-rels-ext:isMemberOf> $libro) from <#ri> where ((($colle <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:root> minus $colle <mulgara:is> <info:fedora/openbess:collezioni>) and $ordine <mulgara:is> '3') or ($colle <fedora-rels-ext:isMemberOfCollection> <info:fedora/openbess:collezioni> and $ordine <mulgara:is> '2') or ($colle <mulgara:is> <info:fedora/islandora:root> and $ordine <mulgara:is> '1')) and $colle <dc:title> $titlecolle order by $ordine $titlecolle
<?xml version="1.0"?> <xsl:stylesheet xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:variable name="BASEURL"> <xsl:value-of select="$baseUrl"/> </xsl:variable> <table> <tr> <td> </td> <td align="right"> Pages </td> <td align="right"> Books </td> <td align="right"> Collections </td> </tr> <xsl:for-each select="/s:sparql/s:results/s:result"> <xsl:choose> <xsl:when test="s:ordine=1"> <tr BGCOLOR="#E0E0E0" HEIGHT="50"> <td> <b> <xsl:value-of select="s:titlecolle"/> </b> </td> <td align="right"> <b> <xsl:value-of select="s:k2"/> </b> </td> <td align="right"> <b> <xsl:value-of select="s:k1"/> </b> </td> <td align="right"> <b> <xsl:value-of select="s:k0"/> </b> </td> </tr> </xsl:when> <xsl:when test="s:ordine=2"> <tr BGCOLOR="#F0F0F0" HEIGHT="35"> <td><xsl:value-of select="s:titlecolle"/> (BESS) </td> <td align="right"> <xsl:value-of select="s:k2"/> </td> <td align="right"> <xsl:value-of select="s:k1"/> </td> <td align="right"> <xsl:value-of select="s:k0"/> </td> </tr> </xsl:when> <xsl:when test="s:ordine=3"> <tr BGCOLOR="#E8E8E8" HEIGHT="35"> <td> <xsl:value-of select="s:titlecolle"/> </td> <td align="right"> <xsl:value-of select="s:k2"/> </td> <td align="right"> <xsl:value-of select="s:k1"/> </td> <td align="right"> <xsl:value-of select="s:k0"/> </td> </tr> </xsl:when> </xsl:choose> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet> |