Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="c3e5410f-fab0-4c7a-af15-8a9447174e2d_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU=" />
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType" />
5
		<RESOURCE_KIND value="TransformationRuleDSResources" />
6
		<RESOURCE_URI value="" />
7
		<DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
8
	</HEADER>
9
	<BODY>
10
        <CONFIGURATION>
11
			<SOURCE_METADATA_FORMAT name="oaf" layout="store" interpretation="cleaned" />
12
			<SINK_METADATA_FORMAT name="oaf_hbase" />          
13
            <IMPORTED/>
14
            <SCRIPT>
15
                <TITLE>xslt_mapping_oaf_person2hbase</TITLE>
16
                <CODE>
17
	                <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
	                                xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
	                                xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa"
20
	                                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
21
	                                xmlns:exslt="http://exslt.org/common"
22
	                                version="1.0" extension-element-prefixes="exslt"
23
	                                exclude-result-prefixes="xsl dc dr dri oaa oaf dnet exslt">
24
    
25
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
26
    
27
    <xsl:param name="writeCoAuthors" select="false()" />
28
    
29
	<xsl:template match="/*">
30
		<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
31
		<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
32
		<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/>
33

    
34
		<xsl:variable name="trust" select="string('0.9')"/>
35
		<xsl:variable name="provenance" select="string('sysimport:crosswalk:repository')"/>
36
		
37
		<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)" />
38
		<xsl:variable name="namespaceprefix">
39
			<xsl:choose>
40
			
41
				<!-- TODO check namespaceprefix length is 12 -->
42
				<xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
43
					<xsl:value-of select="//oaf:datasourceprefix" />
44
				</xsl:when>
45
				<xsl:otherwise>
46
					<xsl:value-of select="unknown_" />
47
				</xsl:otherwise>
48
			</xsl:choose>
49
		</xsl:variable>
50
	
51
		<xsl:choose>
52
			<xsl:when test="count($metadata) = 0">
53
				<ROWS/>
54
			</xsl:when>
55
			<xsl:otherwise>
56

    
57
				<xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
58

    
59
				<xsl:if test="string-length($resultId) &gt; 0">
60
				
61
					<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)" />
62
					<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name" />
63
					
64
					<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)" />
65
					<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name" />					
66
				
67
					<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']" />
68
					<xsl:variable name="originalid">
69
						<xsl:choose>
70
							<xsl:when test="contains($originalidTest, '::')">
71
								<xsl:value-of select="substring-after($originalidTest, '::')" />
72
							</xsl:when>
73
							<xsl:otherwise>
74
								<xsl:value-of select="$originalidTest" />
75
							</xsl:otherwise>
76
						</xsl:choose>
77
					</xsl:variable>
78

    
79
					<ROWS>
80
						<xsl:for-each select="//*[local-name()='creator']">
81

    
82
							<xsl:if test="string-length(normalize-space(.)) &gt; 0">
83
								<xsl:variable name="originalPersonId">
84
									<xsl:choose>
85
										<xsl:when test="string-length(@nameIdentifier) &gt; 0">
86
											<xsl:value-of select="normalize-space(@nameIdentifier)"/>
87
										</xsl:when>
88
										<xsl:otherwise>
89
											<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/>
90
										</xsl:otherwise>
91
									</xsl:choose>
92
								</xsl:variable>
93

    
94
								<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, $originalPersonId)"/>
95
								<xsl:variable name="position" select="position()"/>
96

    
97
								<xsl:variable name="person"
98
								              select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
99
								              $originalPersonId, $dateofcollection, $dateoftransformation, normalize-space(.), @nameIdentifier, @nameIdentifierScheme)"/>
100

    
101
								<xsl:if test="string-length($personId) &gt; 0">
102
									<ROW key="{$personId}" columnFamily="person">
103
										<QUALIFIER name="body" type="base64">
104
											<xsl:value-of select="$person"/>
105
										</QUALIFIER>
106
									</ROW>
107
								</xsl:if>
108
							</xsl:if>
109
						</xsl:for-each>
110
					</ROWS>
111
				</xsl:if>
112
			</xsl:otherwise>
113
		</xsl:choose>
114
	</xsl:template>
115
</xsl:stylesheet>
116
	</CODE>
117
            </SCRIPT>
118
        </CONFIGURATION>
119
		<STATUS />
120
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
121
	</BODY>
122
</RESOURCE_PROFILE>
(66-66/84)