الجمعة، 4 يناير 2013

GSDL on VuFind

VuFind is developed to ensure the users to search and browse through all of your library's resources by replacing the traditional OPAC to include:
·         Catalog Records
·         Locally Cached Journals
·         Digital Library Items
·         Institutional Repository
·         Institutional Bibliography
Greenstone is for building and distributng digital library collection and organizing that information. Integrating GSDL on VuFind is not hard as both software uses OAI-PMH protocol for metadata harvesting. Moreover there is already DSpace integrated on VuFind and with its reference, oai settings and other properties file are created as both GSDL and DSpace use Dublic Core Metadata Set.
OAI must be enabled on the Greenstone repository first:
You can modify file of Greenstone to enable and configure OAI-PMH on file:
$GSDL_HOME/etc/oai.cfg 
Then you may proceed to import the OAI feed into VuFind:
1.      Modify $VUFIND_HOME/harvest/oai.ini as per oai.ini below
2.      Create and modify  $VUFIND_HOME/import/gsdl.properties as per Greenstone properties below
3.      Create & modify $VUFIND_HOME/import/xsl/gsdl.xsl as per gsdl.xsl below
4.      cd $VUFIND_HOME/harvest
5.      php harvest_oai.php
6.      sh batch-import-xsl.sh ./Greenstone ../import/gsdl.properties
7.      ../vufind.sh restart
oai.ini
; oai.ini -- OAI-PMH harvest settings.
[Greenstone]
url = http://localhost/greenstone/cgi-bin/oaiserver.cgi
metadataPrefix = oai_dc
; oai:repID:col:oid //This is the indetifier format used in GREENSTONE OAI-PMH
idSearch[] = "/^oai:gsdl:demo:demo./"
;using only idSearch[] will create error on url link,so replace idSearch[] values with values on idReplace[]
idReplace[] = "demo-"
;i.e example oai:gsdl:demo:demo.1 will be replace to demo-1 on url link of VuFind
idSearch[] = "/\//"
injectId = "identifier"
dateGranularity = auto
harvestedIdLog = harvest.log
 
 
 
 
 
 
 
 
 
 
 
gsdl.properties
; XSLT Import Settings for GSDL
[General]
; REQUIRED: Name of XSLT file to apply.  Path is relative to the import/xsl directory
; of the VuFind installation.
xslt = gsdl.xsl
; OPTIONAL: PHP function(s) to register for use within XSLT file.  You may repeat
; this line to register multiple PHP functions.
;php_function[] = str_replace
; OPTIONAL: PHP class filled with public static functions for use by the XSLT file.
; The class name must match the filename, and the file must exist in the import/xsl
; directory of the VuFind installation.  You may repeat this line to load multiple
; custom classes.
custom_class[] = VuFind

; XSLT parameters -- any key/value pairs set here will be passed as parameters to
; the XSLT file, allowing local values to be set without modifying XSLT code.
[Parameters]
institution = "My Institute"
collection = "GSDL"
gsdl.xsl
<!-- available fields are defined in solr/biblio/conf/schema.xml -->
<!-- This xsl file is similar to xsl file of DSpace as both system use Dublic Core MetadataSet -->
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:php="http://php.net/xsl"
    xmlns:xlink="http://www.w3.org/2001/XMLSchema-instance">
    <xsl:output method="xml" indent="yes" encoding="utf-8"/>
    <xsl:param name="institution">My Institute</xsl:param>
    <xsl:param name="collection">DEMO</xsl:param>
    <xsl:param name="gsdlurl">http://greenstone.org</xsl:param>
    <xsl:template match="oai_dc:dc">
        <add>
            <doc>
                <!-- ID -->
                <!-- Important: This relies on an <identifier> tag being injected by the OAI-PMH harvester. -->
                <field name="id">
                    <xsl:value-of select="//identifier"/>
                </field>
                <!-- RECORDTYPE -->
                <field name="recordtype">gsdl</field>
                <!-- FULLRECORD -->
                <!-- disabled for now; records are so large that they cause memory problems!
                <field name="fullrecord">
                    <xsl:copy-of select="php:function('VuFind::xmlAsText', //oai_dc:dc)"/>
                </field>
                  -->
                <!-- ALLFIELDS -->
                <field name="allfields">
                    <xsl:value-of select="normalize-space(string(//oai_dc:dc))"/>
                </field>
                <!-- INSTITUTION -->
                <field name="institution">
                    <xsl:value-of select="$institution" />
                </field>
                <!-- COLLECTION -->
                <field name="collection">
                    <xsl:value-of select="$collection" />
                </field>
                <!-- LANGUAGE -->
                <xsl:if test="//dc:language">
                    <xsl:for-each select="//dc:language">
                        <xsl:if test="string-length() > 0">
                            <field name="language">
                                <xsl:value-of select="php:function('VuFind::mapString', normalize-space(string(.)), 'language_map_iso639-1.properties')"/>
                            </field>
                        </xsl:if>
                    </xsl:for-each>
                </xsl:if>
                <!-- FORMAT -->
                    <field name="format">eResources</field>
                <!-- SUBJECT -->
                <xsl:if test="//dc:subject">
                    <xsl:for-each select="//dc:subject">
                        <xsl:if test="string-length() > 0">
                            <field name="topic">
                                <xsl:value-of select="normalize-space()"/>
                            </field>
                        </xsl:if>
                    </xsl:for-each>
                </xsl:if>
                <!-- DESCRIPTION -->
                <xsl:if test="//dc:description">
                    <field name="description">
                        <xsl:value-of select="//dc:description" />
                    </field>
                </xsl:if>
                <!-- ADVISOR / CONTRIBUTOR -->
                <xsl:if test="//dc:contributor[normalize-space()]">
                    <field name="author_additional">
                        <xsl:value-of select="//dc:contributor[normalize-space()]" />
                    </field>
                </xsl:if>
                <!-- TYPE -->
                <!-- AUTHOR -->
                <xsl:if test="//dc:creator">
                    <xsl:for-each select="//dc:creator">
                        <xsl:if test="normalize-space()">
                            <!-- author is not a multi-valued field, so we'll put
                                 first value there and subsequent values in author2.
                             -->
                            <xsl:if test="position()=1">
                                <field name="author">
                                    <xsl:value-of select="normalize-space()"/>
                                </field>
                                <field name="author-letter">
                                    <xsl:value-of select="normalize-space()"/>
                                </field>
                            </xsl:if>
                            <xsl:if test="position()>1">
                                <field name="author2">
                                    <xsl:value-of select="normalize-space()"/>
                                </field>
                            </xsl:if>
                        </xsl:if>
                    </xsl:for-each>
                </xsl:if>
                <!-- TITLE -->
                <xsl:if test="//dc:title[normalize-space()]">
                    <field name="title">
                        <xsl:value-of select="//dc:title[normalize-space()]"/>
                    </field>
                    <field name="title_short">
                        <xsl:value-of select="//dc:title[normalize-space()]"/>
                    </field>
                    <field name="title_full">
                        <xsl:value-of select="//dc:title[normalize-space()]"/>
                    </field>
                    <field name="title_sort">
                        <xsl:value-of select="php:function('VuFind::stripArticles', string(//dc:title[normalize-space()]))"/>
                    </field>
                </xsl:if>
                <!-- PUBLISHER -->
                <xsl:if test="//dc:publisher[normalize-space()]">
                    <field name="publisher">
                        <xsl:value-of select="//dc:publisher[normalize-space()]"/>
                    </field>
                </xsl:if>
                <!-- PUBLISHDATE -->
                <xsl:if test="//dc:date">
                    <field name="publishDate">
                        <xsl:value-of select="substring(//dc:date, 1, 4)"/>
                    </field>
                    <field name="publishDateSort">
                        <xsl:value-of select="substring(//dc:date, 1, 4)"/>
                    </field>
                </xsl:if>
                <!-- URL -->
                            <xsl:for-each select="//dc:identifier">
                    <xsl:choose>
                        <xsl:when test="contains(., '://')">
                               <field name="url">
                                   <xsl:value-of select="." />
                               </field>
                        </xsl:when>
                        <xsl:when test="contains(., 'urn:')">
                               <field name="url">
                                   <xsl:value-of select="$gsdlurl" /><xsl:value-of select="." />
                               </field>
                        </xsl:when>
                    </xsl:choose>
                </xsl:for-each>
            </doc>
        </add>
    </xsl:template>
</xsl:stylesheet>
 

ليست هناك تعليقات:

إرسال تعليق