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

This is an old revision of the document!


InTech Open (e-Books)

“InTech is a pioneer and world's largest multidisciplinary open access publisher of books covering the fields of Science, Technology and Medicine. Since 2004, InTech has collaborated with more than 70 000 authors and published 1827 books and 12 journals with the aim of providing free online access to high-quality research and helping leading academics to make their work visible and accessible to diverse new audiences around the world.”; full info here.

Suggested entry in ./harvest/oai.ini:

[InTech]
url =  http://www.intechopen.com/oai/
metadataPrefix = oai_dc
idSearch[] = "/oai:intechopen.com:/"
idReplace[] = "InTech-"
injectId = "identifier"
injectDate = "datestamp"

:!: The code examples below have not been updated/reviewed since 2012 and likely require some updates to be used with newer versions of VuFind.

Suggested InTech.properties:

; 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(s) to 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 = ""

Full exploit of data provided: InTech.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 !!

<!-- 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>

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 :) ):

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;
    }
    
indexing/open_data_sources/intech.1646205524.txt.gz · Last modified: 2022/03/02 07:18 by emaijala