About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
indexing:open_data_sources:intech

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
indexing:open_data_sources:intech [2022/03/02 07:18] emaijalaindexing:open_data_sources:intech [2022/07/08 12:54] (current) demiankatz
Line 15: Line 15:
 </code> </code>
  
-:!: The code examples below have not been updated/reviewed since 2012 and likely require some updates to be used with newer versions of VuFind. +To import records into your VuFind® installation, you can use (or locally customize) the provided [[https://github.com/vufind-org/vufind/blob/dev/import/intech.properties|intech.properties]] and [[https://github.com/vufind-org/vufind/blob/dev/import/xsl/intech.xsl|intech.xsl]] fileswhich have been included in VuFind® since release 9.0. The work from [[https://github.com/vufind-org/vufind/pull/2467|pull request #2467]] should also be adaptable to earlier releases if necessarySee the [[indexing:xml|XML Indexing]] page for more details.
- +
-Suggested InTech.properties: +
- +
-<code> +
-; XSLT Import Settings for InTech Open (e-Books) OAI XML files +
-[General] +
-; REQUIRED: Name of XSLT file to apply.  Path is relative to the import/xsl directory +
-; of the VuFind installation+
-xslt = InTech.xsl +
-; OPTIONAL: PHP function(sto register for use within XSLT file.  You may repeat +
-; this line to register multiple PHP functions. +
-php_function[] = utf8_encode +
-; 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 University" +
-collection = "e-books" +
-building = "" +
-</code> +
- +
- +
-Full exploit of data providedInTech.xsl +
- +
-!! Warning: contains some "hacks" to have direct access to the PDF of the entire e-book, distinguish Book Chapters e-books from journal articles (<dc:relation>ISBN:0</dc:relation> and other vars), etc.. -- use at your own risk as they are by no means endorsed or supported in any way by InTech !! +
- +
-<code> +
-<!-- available fields are defined in solr/biblio/conf/schema.xml --> +
-<!-- Adapted by Author: Filipe M S Bento <filben@gmail.com; fsb@ua.pt> --> +
-<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 University</xsl:param> +
-    <xsl:param name="collection">InTech</xsl:param> +
-    <xsl:param name="building"></xsl:param> +
-    <xsl:param name="urlPrefix">http</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">ebook</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> +
- +
-                <!-- building --> +
-                <field name="building"> +
-                    <xsl:value-of select="$building" /> +
-                </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_oai_utf8.properties')"/> +
-                                --> +
-                                <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 / TYPE --> +
-                 +
-  +
- <xsl:choose> +
- <xsl:when test="(//dc:type = 00) and (//dc:relation != 'ISBN:0') and (//dc:description = '1') " > +
- <field name="format">Book</field> +
- </xsl:when> +
- <xsl:when test="(contains(//dc:identifier, 'articles/show/title'))"> +
- <field name="format">Book Part</field> +
- </xsl:when> +
- +
- +
- <xsl:when test="//dc:relation = 'ISBN:0'"> +
- <field name="format">Article</field> +
- </xsl:when> +
-  +
-  +
- <xsl:otherwise> +
- <field name="format">Book Part</field> +
- </xsl:otherwise> +
-  +
- </xsl:choose> +
-  +
- +
- <field name="format">Online</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="(contains(//dc:identifier, 'articles/show/title') and (//dc:description != '1'))"> +
- <field name="description">&lt;b&gt;<xsl:if test="//dc:subject"><xsl:value-of select="//dc:subject"/>&lt;/b&gt; </xsl:if> <xsl:if test="//dc:type &gt; 00">, Chap. <xsl:value-of select="//dc:type"/></xsl:if><xsl:if test="//dc:description">:&lt;br&gt;<xsl:value-of select="//dc:description"/></xsl:if></field> +
- </xsl:if>      +
- <xsl:if test="((//dc:type &lt; 1) and (//dc:description != '1'))"> +
- <xsl:if test="//dc:description"><field name="description"><xsl:value-of select="//dc:description"/></field></xsl:if> +
- </xsl:if>  +
-  +
-  +
- +
-                <!-- ADVISOR / CONTRIBUTOR --> +
-                <xsl:if test="//dc:contributor[normalize-space()]"> +
-                    <field name="author2"> +
-                        <xsl:value-of select="php:function('VuFind::InverteNome', //dc:contributor[normalize-space()]" /> +
-                    </field> +
-                </xsl:if> +
- +
- +
-                <!-- AUTHOR --> +
-                <xsl:if test="//dc:creator"> +
-                    <xsl:for-each select="//dc:creator"> +
-                        <xsl:if test="normalize-space()"> +
-                            <field name="author"> +
-                                <xsl:value-of select="php:function('VuFind::InverteNome', normalize-space())"/+
-                            </field> +
-                            <!-- use first author value for sorting --> +
-                            <xsl:if test="position()=1"> +
-                                <field name="author_sort"> +
-                                     <xsl:value-of select="php:function('VuFind::InverteNome', 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> +
- +
-  +
- <!-- ISBN --> +
-                <xsl:if test="//dc:relation"> +
- <xsl:if test="(contains(//dc:relation,'ISBN:'))"> +
- <xsl:if test="//dc:relation != 'ISBN:0'"> +
- <field name="issn"> +
- <xsl:value-of select="substring(//dc:relation, 6, 30)"/> +
- </field> +
- </xsl:if> +
-     </xsl:if> +
-                </xsl:if> +
-  +
-  +
-  +
- <!-- PDF URL of the book chapter--> +
- <xsl:if test="//dc:source">  +
-   <xsl:if test="contains(//dc:source,'://')"> +
-    <field name="url"><xsl:value-of select="//dc:source" /> +
-        </field> +
-    </xsl:if> +
- </xsl:if> +
-  +
-  +
- <!-- PDF URL of the entire e-book--> +
- <xsl:if test="(contains(//dc:identifier, 'articles/show/title') and (//dc:description != '1'))"> +
- <xsl:if test="//dc:relation">  +
-    <field name="url">http://www.intechopen.com/download/books/books_isbn/<xsl:value-of select="substring(//dc:relation, 6, 30)"/+
-    </field> +
-    +
- </xsl:if>  +
- </xsl:if>  +
-  +
- <!-- container_title => Book Title = dc:subject only if it has <dc:relation>ISBN:0</dc:relation> = journal article --> +
-<!-- +
- <xsl:if test="//dc:relation = 'ISBN:0'"> +
- <xsl:if test="//dc:subject"> +
-         <field name="container_title"> +
-    <xsl:value-of select="//dc:subject"/>  +
- </field>  +
- </xsl:if>  +
- </xsl:if>  +
--->     +
-            </doc> +
-        </add> +
-    </xsl:template> +
-</xsl:stylesheet> +
-</code> +
- +
-Note: this .xsl invokes a new function "VuFind::InverteNome". This means that a new function "InverteNome" (Portuguese for Inverts (the author) Name), that builds an inverted form of the Author's name when it detects that it is in a non-inverted form, must be added to ./import/xsl/vufind.php (for your convenience all the code comments were translated from Portuguese to English :) ): +
- +
-<code> +
-public static function InverteNome($in) +
-    { +
-        list($fnames,$lname) = preg_split('/\s+(?=[^\s]+$)/', $in, 2);  // includes the full name, eg.: Bento, Filipe Manuel dos Santos +
-  +
- if ( is_null($lname) ) // if author has only one name +
-+
- $text = "$fnames"; +
-+
- else  +
-+
- $text = "$lname, $fnames"; +
-+
-  +
- /** Only Last and First name +
-  +
- list( $fname, $mname, $lname ) = explode( ' ', $in, 3 ); +
- if ( is_null($lname) ) //Author has only two names +
-+
- $lastname = $mname; +
-+
- else +
-+
- $lname = explode( ' ', $lname ); +
- $size = sizeof($lname); +
- $lastname = $lname[$size-1]; +
-+
-  +
- $text = "$lastname, $fname"; +
-  +
- **/ +
-  +
-        return $text; +
-    } +
-     +
-</code> +
- +
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
indexing/open_data_sources/intech.1646205524.txt.gz · Last modified: 2022/03/02 07:18 by emaijala