1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="43108eba-4b67-4d7a-8928-55ca09f1c8ff_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_oaf2hbase</TITLE>
|
16
|
<CODE>
|
17
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
18
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dc="http://purl.org/dc/elements/1.1/"
|
19
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
20
|
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 oaf dr dri dnet exslt">
|
24
|
|
25
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
26
|
|
27
|
<xsl:param name="writeCoAuthors" select="false()"/>
|
28
|
|
29
|
<xsl:param name="trust" select="string('0.9')"/>
|
30
|
<xsl:param name="provenance" select="string('sysimport:crosswalk:repository')"/>
|
31
|
|
32
|
<xsl:template match="/*">
|
33
|
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
34
|
<xsl:variable name="dateofcollection" select="/*[local-name() = 'record']/*[local-name() = 'header']/*[local-name()='dateOfCollection' and text()][1]"/>
|
35
|
<xsl:variable name="dateoftransformation" select="/*[local-name() = 'record']/*[local-name() = 'header']/*[local-name()='dateOfTransformation' and text()][1]"/>
|
36
|
<xsl:variable name="metadata" select="exslt:node-set(/*[local-name() = 'record']/*[local-name()='metadata']/*)"/>
|
37
|
<xsl:variable name="namespaceprefix">
|
38
|
<xsl:choose>
|
39
|
|
40
|
<!-- TODO check namespaceprefix length is 12 -->
|
41
|
<xsl:when test="string-length(//oaf:datasourceprefix) > 0">
|
42
|
<xsl:value-of select="//oaf:datasourceprefix"/>
|
43
|
</xsl:when>
|
44
|
<xsl:otherwise>
|
45
|
<xsl:value-of select="unknown_"/>
|
46
|
</xsl:otherwise>
|
47
|
</xsl:choose>
|
48
|
</xsl:variable>
|
49
|
|
50
|
<xsl:choose>
|
51
|
<!-- <xsl:when test="count($metadata) = 0 or string-length($namespaceprefix) = 0"> -->
|
52
|
<xsl:when test="count($metadata) = 0">
|
53
|
<ROWS/>
|
54
|
</xsl:when>
|
55
|
<xsl:otherwise>
|
56
|
|
57
|
<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
|
58
|
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
|
59
|
|
60
|
<xsl:if test="string-length($resultId) > 0">
|
61
|
|
62
|
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
|
63
|
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
|
64
|
|
65
|
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
|
66
|
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
|
67
|
|
68
|
<xsl:variable name="originalidTest" select="/*[local-name()='record']/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
|
69
|
<xsl:variable name="originalid">
|
70
|
<xsl:choose>
|
71
|
<xsl:when test="contains($originalidTest, '::')">
|
72
|
<xsl:value-of select="substring-after($originalidTest, '::')"/>
|
73
|
</xsl:when>
|
74
|
<xsl:otherwise>
|
75
|
<xsl:value-of select="$originalidTest"/>
|
76
|
</xsl:otherwise>
|
77
|
</xsl:choose>
|
78
|
</xsl:variable>
|
79
|
|
80
|
<xsl:variable name="result"
|
81
|
select="dnet:oafResult($resultId, $provenance, $trust, $about, $hostedbyid, $hostedbyname, $collectedfromid,
|
82
|
$collectedfromname, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
|
83
|
|
84
|
<ROWS>
|
85
|
<ROW key="{$resultId}" columnFamily="result">
|
86
|
<QUALIFIER name="body" type="base64">
|
87
|
<xsl:value-of select="$result"/>
|
88
|
</QUALIFIER>
|
89
|
</ROW>
|
90
|
|
91
|
<xsl:for-each select="//*[local-name()='projectid']">
|
92
|
|
93
|
<xsl:variable name="projectId" select="dnet:oafSplitId('project', normalize-space(.))"/>
|
94
|
|
95
|
<xsl:if test="string-length($projectId) > 0">
|
96
|
|
97
|
<xsl:variable name="resultproject"
|
98
|
select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy',
|
99
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
100
|
<xsl:variable name="projectresult"
|
101
|
select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces',
|
102
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
103
|
|
104
|
<ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
|
105
|
<QUALIFIER name="{$projectId}" type="base64">
|
106
|
<xsl:value-of select="$resultproject"/>
|
107
|
</QUALIFIER>
|
108
|
</ROW>
|
109
|
<ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
|
110
|
<QUALIFIER name="{$resultId}" type="base64">
|
111
|
<xsl:value-of select="$projectresult"/>
|
112
|
</QUALIFIER>
|
113
|
</ROW>
|
114
|
</xsl:if>
|
115
|
</xsl:for-each>
|
116
|
|
117
|
<xsl:for-each select="//*[local-name()='relatedDataset']">
|
118
|
|
119
|
<!-- relatedDataset ids must be in the openaire format -->
|
120
|
<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(./@id))"/>
|
121
|
|
122
|
<xsl:if test="string-length($datasetId) > 0">
|
123
|
|
124
|
<xsl:variable name="resultDataset"
|
125
|
select="dnet:rel($resultId, $datasetId, 'resultResult', 'publicationDataset', 'isRelatedTo',
|
126
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
127
|
<xsl:variable name="datasetResult"
|
128
|
select="dnet:rel($datasetId, $resultId, 'resultResult', 'publicationDataset', 'isRelatedTo',
|
129
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
130
|
|
131
|
<ROW key="{$resultId}" columnFamily="resultResult_publicationDataset_isRelatedTo">
|
132
|
<QUALIFIER name="{$datasetId}" type="base64">
|
133
|
<xsl:value-of select="$resultDataset"/>
|
134
|
</QUALIFIER>
|
135
|
</ROW>
|
136
|
<ROW key="{$datasetId}" columnFamily="resultResult_publicationDataset_isRelatedTo">
|
137
|
<QUALIFIER name="{$resultId}" type="base64">
|
138
|
<xsl:value-of select="$datasetResult"/>
|
139
|
</QUALIFIER>
|
140
|
</ROW>
|
141
|
</xsl:if>
|
142
|
</xsl:for-each>
|
143
|
|
144
|
<xsl:for-each select="//*[local-name()='creator']">
|
145
|
|
146
|
<xsl:if test="string-length(normalize-space(.)) > 0">
|
147
|
<xsl:variable name="originalPersonId">
|
148
|
<xsl:choose>
|
149
|
<xsl:when test="string-length(@nameIdentifier) > 0">
|
150
|
<xsl:value-of select="normalize-space(@nameIdentifier)"/>
|
151
|
</xsl:when>
|
152
|
<xsl:otherwise>
|
153
|
<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/>
|
154
|
</xsl:otherwise>
|
155
|
</xsl:choose>
|
156
|
</xsl:variable>
|
157
|
|
158
|
<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, $originalPersonId)"/>
|
159
|
<xsl:variable name="position" select="position()"/>
|
160
|
|
161
|
<xsl:variable name="person"
|
162
|
select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
|
163
|
$originalPersonId, $dateofcollection, $dateoftransformation, normalize-space(.), @nameIdentifier, @nameIdentifierScheme)"/>
|
164
|
<xsl:variable name="personresult"
|
165
|
select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf',
|
166
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
167
|
<xsl:variable name="resultperson"
|
168
|
select="dnet:personResult_Authorship($resultId, $personId, $position, 'hasAuthor',
|
169
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
170
|
|
171
|
<xsl:if test="string-length($personId) > 0">
|
172
|
<ROW key="{$personId}" columnFamily="person">
|
173
|
<QUALIFIER name="body" type="base64">
|
174
|
<xsl:value-of select="$person"/>
|
175
|
</QUALIFIER>
|
176
|
</ROW>
|
177
|
<ROW key="{$personId}" columnFamily="personResult_authorship_isAuthorOf">
|
178
|
<QUALIFIER name="{$resultId}" type="base64">
|
179
|
<xsl:value-of select="$personresult"/>
|
180
|
</QUALIFIER>
|
181
|
</ROW>
|
182
|
<ROW key="{$resultId}" columnFamily="personResult_authorship_hasAuthor">
|
183
|
<QUALIFIER name="{$personId}" type="base64">
|
184
|
<xsl:value-of select="$resultperson"/>
|
185
|
</QUALIFIER>
|
186
|
</ROW>
|
187
|
</xsl:if>
|
188
|
|
189
|
<!-- COAUTHORS -->
|
190
|
<xsl:if test="$writeCoAuthors = true()">
|
191
|
<xsl:for-each select="../dc:creator">
|
192
|
<xsl:if test="$position != position()">
|
193
|
|
194
|
<xsl:variable name="originalCoauthorId">
|
195
|
<xsl:choose>
|
196
|
<xsl:when test="string-length(@nameIdentifier) > 0">
|
197
|
<xsl:value-of select="normalize-space(@nameIdentifier)"/>
|
198
|
</xsl:when>
|
199
|
<xsl:otherwise>
|
200
|
<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/>
|
201
|
</xsl:otherwise>
|
202
|
</xsl:choose>
|
203
|
</xsl:variable>
|
204
|
|
205
|
<xsl:variable name="coauthorId"
|
206
|
select="dnet:oafId('person', $namespaceprefix, $originalCoauthorId)"/>
|
207
|
|
208
|
<xsl:variable name="personperson"
|
209
|
select="dnet:rel($personId, $coauthorId, 'personPerson', 'coauthorship', 'isCoAuthorOf',
|
210
|
$collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
|
211
|
|
212
|
<ROW key="{$personId}" columnFamily="personPerson_coAuthorship_isCoAuthorOf">
|
213
|
<QUALIFIER name="{$coauthorId}" type="base64">
|
214
|
<xsl:value-of select="$personperson"/>
|
215
|
</QUALIFIER>
|
216
|
</ROW>
|
217
|
</xsl:if>
|
218
|
</xsl:for-each>
|
219
|
</xsl:if>
|
220
|
<!-- / COAUTHORS -->
|
221
|
</xsl:if>
|
222
|
</xsl:for-each>
|
223
|
|
224
|
</ROWS>
|
225
|
</xsl:if>
|
226
|
</xsl:otherwise>
|
227
|
</xsl:choose>
|
228
|
</xsl:template>
|
229
|
</xsl:stylesheet>
|
230
|
</CODE>
|
231
|
</SCRIPT>
|
232
|
</CONFIGURATION>
|
233
|
<STATUS/>
|
234
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
235
|
</BODY>
|
236
|
</RESOURCE_PROFILE>
|