Add DwC indexing to Solr

  • edit DWC_to_solr.xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:foxml="info:fedora/fedora-system:def/foxml#"
  xmlns:dwr="http://rs.tdwg.org/dwc/xsd/simpledarwincore/"
  xmlns:dcterms="http://purl.org/dc/terms/"
  xmlns:dwc="http://rs.tdwg.org/dwc/terms/"
  exclude-result-prefixes="dwr dcterms dwc">
  <xsl:template match="foxml:datastream[@ID='DWC']/foxml:datastreamVersion[last()]">
    <xsl:param name="content"/>
    <xsl:param name="prefix">dwc.</xsl:param>
    <xsl:param name="suffix"></xsl:param>
    <xsl:apply-templates select="$content//dwr:SimpleDarwinRecordSet[1]/dwr:SimpleDarwinRecord[1]">
      <xsl:with-param name="prefix" select="$prefix"/>
      <xsl:with-param name="suffix" select="$suffix"/>
    </xsl:apply-templates>
  </xsl:template>
  <xsl:template match="dwr:SimpleDarwinRecord">
    <xsl:param name="prefix">dwc.</xsl:param>
    <xsl:param name="prefixdct">dcterms.</xsl:param>
    <xsl:param name="suffix"></xsl:param>
    <xsl:for-each select="./dcterms:*">
      <field>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($prefixdct, local-name(), $suffix)"/>
        </xsl:attribute>
        <xsl:value-of select="text()"/>
      </field>
    </xsl:for-each>
    <xsl:for-each select="./dwc:*">
      <field>
        <xsl:attribute name="name">
          <xsl:value-of select="concat($prefix, local-name(), $suffix)"/>
        </xsl:attribute>
        <xsl:value-of select="text()"/>
      </field>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
  • cp DWC_to_solr.xslt into /var/lib/tomcat7/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/
  • edit /var/lib/tomcat7/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/foxmlToSolr.xslt
+   <xsl:include href="/var/lib/tomcat7/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms/DWC_to_solr.xslt"/>
  • edit /usr/local/solr/islandora/conf/schema.xml
+   <dynamicField name="dwc.*"  type="text_fgs" indexed="true" stored="true" multiValued="true"/>
+   <dynamicField name="dcterms.*"  type="text_fgs" indexed="true" stored="true" multiValued="true"/>
  • restart Tomcat7
  • DWC datastream example to test DwC indexing
<?xml version="1.0" encoding="UTF-8"?>
<dwr:SimpleDarwinRecordSet
 	xmlns:dwr="http://rs.tdwg.org/dwc/xsd/simpledarwincore/"
 	xmlns:dcterms="http://purl.org/dc/terms/"
	xmlns:dwc="http://rs.tdwg.org/dwc/terms/"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd">
	<dwr:SimpleDarwinRecord>
		<dcterms:type>StillImage</dcterms:type>
		<dcterms:modified>1942</dcterms:modified>
		<dcterms:language>it</dcterms:language>
		<dcterms:rights>Creative Commons license: Attribution-NonCommercial-NoDerivatives 4.0 International(CC BY-NC-ND 4.0)</dcterms:rights>
		<dcterms:rightsHolder>Istituto di Studi Adriatici, Osservatorio per la Pesca Marittima di Venezia </dcterms:rightsHolder>
		<dcterms:accessRights>not-for-profit use only</dcterms:accessRights>
		<dwc:scientificName>Nome scientifico</dwc:scientificName>
		<dwc:vernacularName>Nome comune</dwc:vernacularName>
 	</dwr:SimpleDarwinRecord>
</dwr:SimpleDarwinRecordSet>
 
 
repo381/dwc.txt ยท Last modified: 2016/09/30 10:22 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ ircres.cnr.it) and Anna Perin (anna.perin _@_ ircres.cnr.it)
ASA@TO.CNR is licensed under: Creative Commons License
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki