1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="7197dcb2-b1f5-4de5-9ead-7bb4056bb549_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="dmf_wds" layout="store" interpretation="cleaned" />
|
12
|
<SINK_METADATA_FORMAT name="dngf_hbase" />
|
13
|
<IMPORTED/>
|
14
|
<SCRIPT>
|
15
|
<TITLE>WDS2HBASE: DMF 2 HBASE</TITLE>
|
16
|
<CODE>
|
17
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
18
|
xmlns:oaf="http://namespace.openaire.eu/oaf"
|
19
|
xmlns:dnet="eu.dnetlib.data.transform.xml.WdsToHbaseXsltFunctions"
|
20
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
21
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr" 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
|
<xsl:template match="/*">
|
27
|
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
28
|
<xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
|
29
|
<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
|
30
|
|
31
|
<xsl:variable name="trust" select="string('0.9')"/>
|
32
|
<xsl:variable name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
|
33
|
|
34
|
<xsl:variable name="metadata"
|
35
|
select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
36
|
<xsl:variable name="namespaceprefix">
|
37
|
<xsl:choose>
|
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 or normalize-space(//oaf:skipRecord)= 'true'">
|
50
|
<ROWS/>
|
51
|
</xsl:when>
|
52
|
<xsl:otherwise>
|
53
|
|
54
|
<xsl:variable name="datasetId"
|
55
|
select="dnet:oafSimpleId('dataset', //dri:objIdentifier)"/>
|
56
|
|
57
|
<xsl:if test="string-length($datasetId) > 0">
|
58
|
<xsl:variable name="originalids"
|
59
|
select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
|
60
|
<xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
|
61
|
<xsl:variable name="titles" select="//*[local-name() = 'title']"/>
|
62
|
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
|
63
|
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
|
64
|
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
|
65
|
<xsl:variable name="dates" select="//*[local-name() = 'date']"/>
|
66
|
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
|
67
|
<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/>
|
68
|
<xsl:variable name="formats" select="//*[local-name() = 'format']"/>
|
69
|
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
|
70
|
<xsl:variable name="rights" select="//oaf:accessrights"/>
|
71
|
<xsl:variable name="version" select="//*[local-name() = 'version']"/>
|
72
|
<xsl:variable name="language" select="//oaf:language"/>
|
73
|
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
|
74
|
<xsl:variable name="contributor" select="//*[local-name() = 'contributor']/*[local-name() = 'contributorName']"/>
|
75
|
|
76
|
<xsl:variable name="relatedIdentifiers"
|
77
|
select="//*[local-name() = 'relatedIdentifier']"/>
|
78
|
|
79
|
<xsl:variable name="geoLocations" select="//*[local-name() = 'geoLocations']"/>
|
80
|
|
81
|
<xsl:variable name="instanceURI">
|
82
|
<xsl:choose>
|
83
|
<xsl:when test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']) > 0">
|
84
|
<xsl:value-of select="concat('http://dx.doi.org','/', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']/text())"/>
|
85
|
</xsl:when>
|
86
|
<xsl:otherwise>
|
87
|
<xsl:choose>
|
88
|
<xsl:when test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL']) > 0">
|
89
|
<xsl:value-of select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/>
|
90
|
</xsl:when>
|
91
|
<xsl:otherwise>
|
92
|
<xsl:value-of select="concat('', //*[local-name() = 'resource']//*[local-name()='alternateIdentifier' and ./@alternateIdentifierType='URL'])"/>
|
93
|
</xsl:otherwise>
|
94
|
</xsl:choose>
|
95
|
</xsl:otherwise>
|
96
|
</xsl:choose>
|
97
|
</xsl:variable>
|
98
|
|
99
|
<xsl:variable name="hostedbyid"
|
100
|
select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
|
101
|
<xsl:variable name="hostedbyname" select="concat('', //oaf:hostedBy/@name)"/>
|
102
|
<xsl:variable name="collectedfromid"
|
103
|
select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
|
104
|
<xsl:variable name="collectedfromname"
|
105
|
select="concat('', //oaf:collectedFrom/@name)"/>
|
106
|
|
107
|
<xsl:variable name="pids"
|
108
|
select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
|
109
|
|
110
|
<xsl:variable name="dataset"
|
111
|
select="dnet:wdsDataset($datasetId, $about, $titles, $subjects, $publisher, $descriptions,
|
112
|
$dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights,
|
113
|
$version, $pids, $geoLocations, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
|
114
|
$collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
|
115
|
|
116
|
<ROWS>
|
117
|
<ROW key="{$datasetId}" columnFamily="dataset">
|
118
|
<QUALIFIER name="body" type="base64">
|
119
|
<xsl:value-of select="$dataset"/>
|
120
|
</QUALIFIER>
|
121
|
</ROW>
|
122
|
<xsl:for-each select="//*[local-name() = 'creator']">
|
123
|
|
124
|
<xsl:variable name="personIdTemp">
|
125
|
<xsl:choose>
|
126
|
<xsl:when test="string-length(./*[local-name() = 'nameIdentifier']) > 0">
|
127
|
<xsl:value-of
|
128
|
select="translate(normalize-space(./*[local-name() = 'nameIdentifier']),' .,','___')"/>
|
129
|
</xsl:when>
|
130
|
<xsl:otherwise>
|
131
|
<xsl:value-of select="translate(normalize-space(./*[local-name() = 'creatorName']),' .,','___')"/>
|
132
|
</xsl:otherwise>
|
133
|
</xsl:choose>
|
134
|
</xsl:variable>
|
135
|
|
136
|
<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdTemp))"/>
|
137
|
|
138
|
<xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/>
|
139
|
|
140
|
<xsl:if test="string-length($personId) > 0">
|
141
|
<xsl:variable name="position" select="position()"/>
|
142
|
<xsl:variable name="person"
|
143
|
select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
|
144
|
$originalPersonId, $dateOfCollection, $dateoftransformation, normalize-space(./*[local-name() = 'creatorName']),
|
145
|
./*[local-name() = 'nameIdentifier'], ./*[local-name() = 'nameIdentifier']/@nameIdentifierScheme)"/>
|
146
|
<xsl:variable name="persondataset"
|
147
|
select="dnet:personDataset_Authorship($personId, $datasetId, $position, 'isAuthorOf', $provenance, $trust, $about)"/>
|
148
|
<xsl:variable name="datasetperson"
|
149
|
select="dnet:personDataset_Authorship($datasetId, $personId, $position, 'hasAuthor', $provenance, $trust, $about)"/>
|
150
|
|
151
|
<ROW key="{$personId}" columnFamily="person">
|
152
|
<QUALIFIER name="body" type="base64">
|
153
|
<xsl:value-of select="$person"/>
|
154
|
</QUALIFIER>
|
155
|
</ROW>
|
156
|
<ROW key="{$personId}" columnFamily="personDataset_authorship_isAuthorOf">
|
157
|
<QUALIFIER name="{$datasetId}" type="base64">
|
158
|
<xsl:value-of select="$persondataset"/>
|
159
|
</QUALIFIER>
|
160
|
</ROW>
|
161
|
<ROW key="{$datasetId}" columnFamily="personDataset_authorship_hasAuthor">
|
162
|
<QUALIFIER name="{$personId}" type="base64">
|
163
|
<xsl:value-of select="$datasetperson"/>
|
164
|
</QUALIFIER>
|
165
|
</ROW>
|
166
|
</xsl:if>
|
167
|
</xsl:for-each>
|
168
|
|
169
|
<xsl:for-each select="//*[local-name()='projectid']">
|
170
|
|
171
|
<xsl:variable name="projectId"
|
172
|
select="dnet:oafSplitId('project', normalize-space(.))"/>
|
173
|
|
174
|
<xsl:variable name="datasetproject"
|
175
|
select="dnet:rel($datasetId, $projectId, 'datasetProject', 'outcome', 'isProducedBy', $provenance, $trust, $about)"/>
|
176
|
<xsl:variable name="projectdataset"
|
177
|
select="dnet:rel($projectId, $datasetId, 'datasetProject', 'outcome', 'produces', $provenance, $trust, $about)"/>
|
178
|
|
179
|
<xsl:if test="string-length($projectId) > 0">
|
180
|
<ROW key="{$datasetId}" columnFamily="datasetProject_outcome_isProducedBy">
|
181
|
<QUALIFIER name="{$projectId}" type="base64">
|
182
|
<xsl:value-of select="$datasetproject"/>
|
183
|
</QUALIFIER>
|
184
|
</ROW>
|
185
|
<ROW key="{$projectId}" columnFamily="datasetProject_outcome_produces">
|
186
|
<QUALIFIER name="{$datasetId}" type="base64">
|
187
|
<xsl:value-of select="$projectdataset"/>
|
188
|
</QUALIFIER>
|
189
|
</ROW>
|
190
|
</xsl:if>
|
191
|
</xsl:for-each>
|
192
|
|
193
|
<xsl:for-each
|
194
|
select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
|
195
|
|
196
|
<!-- relatedDataset ids must be in the openaire format -->
|
197
|
<xsl:variable name="targetId" select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
|
198
|
|
199
|
<xsl:if test="string-length($targetId) > 0">
|
200
|
|
201
|
<xsl:variable name="childParent"
|
202
|
select="dnet:rel($datasetId, $targetId, 'datasetDataset', 'part', 'isPartOf', $provenance, $trust, $about)"/>
|
203
|
<xsl:variable name="parentChild"
|
204
|
select="dnet:rel($targetId, $datasetId, 'datasetDataset', 'part', 'hasPart', $provenance, $trust, $about)"/>
|
205
|
|
206
|
<ROW key="{$datasetId}" columnFamily="datasetDataset_part_isPartOf">
|
207
|
<QUALIFIER name="{$targetId}" type="base64">
|
208
|
<xsl:value-of select="$childParent"/>
|
209
|
</QUALIFIER>
|
210
|
</ROW>
|
211
|
<ROW key="{$targetId}" columnFamily="datasetDataset_part_hasPart">
|
212
|
<QUALIFIER name="{$datasetId}" type="base64">
|
213
|
<xsl:value-of select="$parentChild"/>
|
214
|
</QUALIFIER>
|
215
|
</ROW>
|
216
|
</xsl:if>
|
217
|
</xsl:for-each>
|
218
|
|
219
|
</ROWS>
|
220
|
</xsl:if>
|
221
|
</xsl:otherwise>
|
222
|
</xsl:choose>
|
223
|
</xsl:template>
|
224
|
</xsl:stylesheet>
|
225
|
</CODE>
|
226
|
</SCRIPT>
|
227
|
</CONFIGURATION>
|
228
|
<STATUS />
|
229
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
230
|
</BODY>
|
231
|
</RESOURCE_PROFILE>
|