1 |
37016
|
claudio.at
|
<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 version="1.0"
|
18 |
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/"
|
19 |
|
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
20 |
|
|
xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf"
|
21 |
|
|
xmlns:dnet="eu.dnetlib.data.transform.xml.DNetMdStoreToHbaseXsltFunctions"
|
22 |
|
|
xmlns:exslt="http://exslt.org/common" 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="mergeIdForHomonyms" select="true()" />
|
28 |
|
|
<xsl:param name="writeCoAuthors" select="false()" />
|
29 |
|
|
|
30 |
|
|
<xsl:template match="/*">
|
31 |
|
|
<xsl:variable name="dataInfo" select="/*[local-name() = 'record']/*[local-name() = 'about']/*[local-name() = 'datainfo']"/>
|
32 |
|
|
<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
|
33 |
|
|
|
34 |
|
|
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)" />
|
35 |
|
|
<xsl:variable name="namespaceprefix">
|
36 |
|
|
<xsl:choose>
|
37 |
|
|
|
38 |
|
|
<!-- TODO check namespaceprefix length is 12 -->
|
39 |
|
|
<xsl:when test="string-length(//oaf:datasourceprefix) > 0">
|
40 |
|
|
<xsl:value-of select="//oaf:datasourceprefix" />
|
41 |
|
|
</xsl:when>
|
42 |
|
|
<xsl:otherwise>
|
43 |
|
|
<xsl:value-of select="unknown_" />
|
44 |
|
|
</xsl:otherwise>
|
45 |
|
|
</xsl:choose>
|
46 |
|
|
</xsl:variable>
|
47 |
|
|
|
48 |
|
|
<xsl:choose>
|
49 |
|
|
<xsl:when test="count($metadata) = 0">
|
50 |
|
|
<ROWS/>
|
51 |
|
|
</xsl:when>
|
52 |
|
|
<xsl:otherwise>
|
53 |
|
|
|
54 |
|
|
<xsl:variable name="objIdentifier" select="//dri:objIdentifier" />
|
55 |
|
|
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)" />
|
56 |
|
|
|
57 |
|
|
<xsl:if test="string-length($resultId) > 0">
|
58 |
|
|
|
59 |
|
|
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)" />
|
60 |
|
|
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name" />
|
61 |
|
|
|
62 |
|
|
<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']" />
|
63 |
|
|
<xsl:variable name="originalid">
|
64 |
|
|
<xsl:choose>
|
65 |
|
|
<xsl:when test="contains($originalidTest, '::')">
|
66 |
|
|
<xsl:value-of select="substring-after($originalidTest, '::')" />
|
67 |
|
|
</xsl:when>
|
68 |
|
|
<xsl:otherwise>
|
69 |
|
|
<xsl:value-of select="$originalidTest" />
|
70 |
|
|
</xsl:otherwise>
|
71 |
|
|
</xsl:choose>
|
72 |
|
|
</xsl:variable>
|
73 |
|
|
|
74 |
|
|
<ROWS>
|
75 |
|
|
<xsl:for-each select="//*[local-name()='creator']">
|
76 |
|
|
|
77 |
|
|
<xsl:if test="string-length(normalize-space(.)) > 0">
|
78 |
|
|
|
79 |
|
|
<xsl:variable name="personIdPart">
|
80 |
|
|
<xsl:call-template name="personIdTmpl">
|
81 |
|
|
<xsl:with-param name="objIdentifier" select="$objIdentifier" />
|
82 |
|
|
</xsl:call-template>
|
83 |
|
|
</xsl:variable>
|
84 |
|
|
<xsl:variable name="position" select="position()" />
|
85 |
|
|
|
86 |
|
|
<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdPart))" />
|
87 |
|
|
<xsl:variable name="person" select="dnet:oafPersonFromMDStore($personId, $dataInfo, $collectedfromid, $collectedfromname, $originalid, $dateofcollection, .)" />
|
88 |
|
|
|
89 |
|
|
<xsl:if test="string-length($personId) > 0">
|
90 |
|
|
<ROW key="{$personId}" columnFamily="person">
|
91 |
|
|
<QUALIFIER name="body" type="base64"><xsl:value-of select="$person" /></QUALIFIER>
|
92 |
|
|
</ROW>
|
93 |
|
|
</xsl:if>
|
94 |
|
|
|
95 |
|
|
<!-- COAUTHORS -->
|
96 |
|
|
<xsl:if test="$writeCoAuthors = true()">
|
97 |
|
|
<xsl:for-each select="../dc:creator">
|
98 |
|
|
<xsl:if test="$position != position()">
|
99 |
|
|
<xsl:variable name="coauthorIdPart">
|
100 |
|
|
<xsl:call-template name="personIdTmpl">
|
101 |
|
|
<xsl:with-param name="objIdentifier" select="$objIdentifier" />
|
102 |
|
|
</xsl:call-template>
|
103 |
|
|
</xsl:variable>
|
104 |
|
|
<xsl:variable name="coauthorId" select="dnet:oafId('person', $namespaceprefix, normalize-space($coauthorIdPart))" />
|
105 |
|
|
<xsl:variable name="personperson" select="dnet:oafPersonPerson_CoAuthorship_FromDMF($personId, $coauthorId, 'isCoAuthorOf', $dataInfo)" />
|
106 |
|
|
<ROW key="{$personId}" columnFamily="personPerson_coAuthorship_isCoAuthorOf">
|
107 |
|
|
<QUALIFIER name="{$coauthorId}" type="base64"><xsl:value-of select="$personperson" /></QUALIFIER>
|
108 |
|
|
</ROW>
|
109 |
|
|
</xsl:if>
|
110 |
|
|
</xsl:for-each>
|
111 |
|
|
</xsl:if>
|
112 |
|
|
<!-- / COAUTHORS -->
|
113 |
|
|
</xsl:if>
|
114 |
|
|
</xsl:for-each>
|
115 |
|
|
</ROWS>
|
116 |
|
|
</xsl:if>
|
117 |
|
|
</xsl:otherwise>
|
118 |
|
|
</xsl:choose>
|
119 |
|
|
</xsl:template>
|
120 |
|
|
|
121 |
|
|
<xsl:template name="personIdTmpl">
|
122 |
|
|
<xsl:param name="objIdentifier" />
|
123 |
|
|
<xsl:choose>
|
124 |
|
|
<xsl:when test="$mergeIdForHomonyms = false()">
|
125 |
|
|
<xsl:value-of select="concat($objIdentifier, '::', normalize-space(.))" />
|
126 |
|
|
</xsl:when>
|
127 |
|
|
<xsl:otherwise>
|
128 |
|
|
<xsl:value-of select="normalize-space(.)" />
|
129 |
|
|
</xsl:otherwise>
|
130 |
|
|
</xsl:choose>
|
131 |
|
|
</xsl:template>
|
132 |
|
|
|
133 |
|
|
</xsl:stylesheet>
|
134 |
|
|
</CODE>
|
135 |
|
|
</SCRIPT>
|
136 |
|
|
</CONFIGURATION>
|
137 |
|
|
<STATUS />
|
138 |
|
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
139 |
|
|
</BODY>
|
140 |
|
|
</RESOURCE_PROFILE>
|