1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER
|
4
|
value="102207dc-aaf5-41b7-a7c7-4fbc6bcb60b9_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
5
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
6
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
7
|
<RESOURCE_URI value=""/>
|
8
|
<DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
|
9
|
</HEADER>
|
10
|
<BODY>
|
11
|
<CONFIGURATION>
|
12
|
<SOURCE_METADATA_FORMAT name="dmf" layout="store" interpretation="cleaned"/>
|
13
|
<SINK_METADATA_FORMAT name="dngf_hbase"/>
|
14
|
<IMPORTED/>
|
15
|
<SCRIPT>
|
16
|
<TITLE>DLI2HBASE:dataset mapping to hbase</TITLE>
|
17
|
<CODE>
|
18
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
19
|
xmlns:dnet="eu.dnetlib.data.transform.xml.DmfToHbaseXsltFunctions"
|
20
|
xmlns:exslt="http://exslt.org/common"
|
21
|
xmlns:oaf="http://namespace.dnet.eu/oaf"
|
22
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
23
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
24
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
25
|
version="1.0" extension-element-prefixes="exslt"
|
26
|
exclude-result-prefixes="xsl oaf dr dri dnet exslt">
|
27
|
|
28
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
29
|
<xsl:template match="/*">
|
30
|
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
31
|
<xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
|
32
|
<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
|
33
|
|
34
|
<xsl:variable name="trust" select="string('0.9')"/>
|
35
|
<xsl:variable name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
|
36
|
|
37
|
<xsl:variable name="metadata"
|
38
|
select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
39
|
<xsl:variable name="namespaceprefix">
|
40
|
<xsl:choose>
|
41
|
<!-- TODO check namespaceprefix length is 12 -->
|
42
|
<xsl:when test="string-length(//dri:datasourceprefix) > 0">
|
43
|
<xsl:choose>
|
44
|
<xsl:when test="count(//dri:datasourceprefix) > 1">
|
45
|
<xsl:value-of select="//dri:datasourceprefix[1]"/>
|
46
|
</xsl:when>
|
47
|
<xsl:otherwise>
|
48
|
<xsl:value-of select="//dri:datasourceprefix"/>
|
49
|
</xsl:otherwise>
|
50
|
|
51
|
</xsl:choose>
|
52
|
</xsl:when>
|
53
|
<xsl:otherwise>
|
54
|
<xsl:value-of select="unknown_____"/>
|
55
|
</xsl:otherwise>
|
56
|
</xsl:choose>
|
57
|
</xsl:variable>
|
58
|
|
59
|
<xsl:choose>
|
60
|
<xsl:when test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
|
61
|
<ROWS/>
|
62
|
</xsl:when>
|
63
|
<xsl:otherwise>
|
64
|
|
65
|
<xsl:variable name="datasetId"
|
66
|
select="dnet:oafSimpleId('dataset', //dri:objIdentifier)"/>
|
67
|
|
68
|
<xsl:if test="string-length($datasetId) > 0">
|
69
|
<xsl:variable name="originalids"
|
70
|
select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
|
71
|
<xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
|
72
|
<xsl:variable name="titles" select="//*[local-name() = 'title']"/>
|
73
|
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
|
74
|
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
|
75
|
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
|
76
|
<xsl:variable name="dates" select="//*[local-name() = 'date']"/>
|
77
|
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
|
78
|
<xsl:variable name="resourceType"
|
79
|
select="//*[local-name() = 'resourceType']/@resourceTypeGeneral"/>
|
80
|
<xsl:variable name="formats" select="//*[local-name() = 'format']"/>
|
81
|
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
|
82
|
<xsl:variable name="rights" select="//oaf:accessrights"/>
|
83
|
<xsl:variable name="version" select="//*[local-name() = 'version']"/>
|
84
|
<xsl:variable name="language" select="//oaf:language"/>
|
85
|
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
|
86
|
<xsl:variable name="contributor"
|
87
|
select="//*[local-name() = 'creator']/*[local-name() = 'creatorName']"/>
|
88
|
<xsl:variable name="pid"
|
89
|
select="//*[local-name()='resource']/*[local-name()='identifier']/text()"/>
|
90
|
<xsl:variable name="pidType"
|
91
|
select="//*[local-name()='resource']/*[local-name()='identifier']/@identifierType"/>
|
92
|
<xsl:variable name="aboutNode" select="//oaf:about"/>
|
93
|
<xsl:variable name="pids"
|
94
|
select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
|
95
|
|
96
|
<ROWS>
|
97
|
<ROW>
|
98
|
<xsl:attribute name="value">
|
99
|
<xsl:value-of select="dnet:dliDataset($datasetId, $about, $titles, $subjects, $publisher, $descriptions,
|
100
|
$dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights,
|
101
|
$pids, $provenance, $aboutNode, $originalids, $dateOfCollection, $dateoftransformation, $trust)"/>
|
102
|
</xsl:attribute>
|
103
|
</ROW>
|
104
|
|
105
|
<!--PUBLICATION RELATIONS-->
|
106
|
<xsl:for-each
|
107
|
select="//*[local-name()='relatedIdentifier' and ./@entityType='publication']">
|
108
|
|
109
|
<xsl:variable name="relationSemantic" select="./@relationType"/>
|
110
|
<xsl:variable name="inverseRelationSemantic"
|
111
|
select="./@inverseRelationType"/>
|
112
|
|
113
|
<!-- relatedDataset ids must be in the openaire format -->
|
114
|
<xsl:variable name="publicationId">
|
115
|
<xsl:choose>
|
116
|
<xsl:when test="./@relatedIdentifierType = 'dnet'">
|
117
|
<xsl:value-of select="concat('50|' , . )"/>
|
118
|
</xsl:when>
|
119
|
<xsl:otherwise>
|
120
|
<xsl:value-of
|
121
|
select="dnet:oafSimpleId('publication', normalize-space(.))"/>
|
122
|
</xsl:otherwise>
|
123
|
</xsl:choose>
|
124
|
</xsl:variable>
|
125
|
<xsl:if test="string-length($datasetId) > 0">
|
126
|
<ROW>
|
127
|
<xsl:attribute name="value">
|
128
|
<xsl:value-of
|
129
|
select="dnet:createRel($publicationId, $datasetId, $inverseRelationSemantic, 'publication_dataset', $provenance, $trust, $about)"/>
|
130
|
</xsl:attribute>
|
131
|
</ROW>
|
132
|
<ROW>
|
133
|
<xsl:attribute name="value">
|
134
|
<xsl:value-of
|
135
|
select="dnet:createRel($datasetId, $publicationId, $relationSemantic, 'publication_dataset', $provenance, $trust, $about)"/>
|
136
|
</xsl:attribute>
|
137
|
</ROW>
|
138
|
<ROW>
|
139
|
<xsl:attribute name="value">
|
140
|
<xsl:value-of
|
141
|
select="dnet:createSimpleEntity(./@relatedIdentifierType, normalize-space(.), $namespaceprefix, $about, 'publication', 'incomplete')"/>
|
142
|
</xsl:attribute>
|
143
|
</ROW>
|
144
|
</xsl:if>
|
145
|
</xsl:for-each>
|
146
|
|
147
|
<!--DATASET RELATIONS-->
|
148
|
<xsl:for-each
|
149
|
select="//*[local-name()='relatedIdentifier' and ./@entityType='dataset']">
|
150
|
<xsl:variable name="relationSemantic" select="./@relationType"/>
|
151
|
<xsl:variable name="inverseRelationSemantic"
|
152
|
select="./@inverseRelationType"/>
|
153
|
|
154
|
<!-- relatedDataset ids must be in the openaire format -->
|
155
|
<xsl:variable name="relDatasetId">
|
156
|
<xsl:choose>
|
157
|
<xsl:when test="./@relatedIdentifierType = 'dnet'">
|
158
|
<xsl:value-of select="concat('60|' , . )"/>
|
159
|
</xsl:when>
|
160
|
<xsl:otherwise>
|
161
|
<xsl:value-of
|
162
|
select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
|
163
|
</xsl:otherwise>
|
164
|
</xsl:choose>
|
165
|
</xsl:variable>
|
166
|
|
167
|
|
168
|
<xsl:if test="string-length($datasetId) > 0">
|
169
|
<ROW>
|
170
|
<xsl:attribute name="value">
|
171
|
<xsl:value-of
|
172
|
select="dnet:createRel($relDatasetId, $datasetId, $inverseRelationSemantic, 'dataset_dataset', $provenance, $trust, $about)"/>
|
173
|
</xsl:attribute>
|
174
|
</ROW>
|
175
|
<ROW>
|
176
|
<xsl:attribute name="value">
|
177
|
<xsl:value-of
|
178
|
select="dnet:createRel($datasetId, $relDatasetId, $relationSemantic, 'dataset_dataset', $provenance, $trust, $about)"/>
|
179
|
</xsl:attribute>
|
180
|
</ROW>
|
181
|
<ROW>
|
182
|
<xsl:attribute name="value">
|
183
|
<xsl:value-of
|
184
|
select="dnet:createSimpleEntity(./@relatedIdentifierType, normalize-space(.), $namespaceprefix, $about, 'dataset', 'incomplete')"/>
|
185
|
</xsl:attribute>
|
186
|
</ROW>
|
187
|
</xsl:if>
|
188
|
</xsl:for-each>
|
189
|
|
190
|
<!--UNKOWN RELATIONS-->
|
191
|
<xsl:for-each
|
192
|
select="//*[local-name()='relatedIdentifier' and (./@entityType='unknown' or not(./@entityType))]">
|
193
|
|
194
|
<xsl:variable name="relationSemantic" select="./@relationType"/>
|
195
|
<xsl:variable name="inverseRelationSemantic"
|
196
|
select="./@inverseRelationType"/>
|
197
|
<xsl:variable name="enityId"
|
198
|
select="dnet:createDNetEntityIdentifier(./@relatedIdentifierType, ., $namespaceprefix, 'unknown')"/>
|
199
|
|
200
|
<xsl:if test="string-length(normalize-space(.)) > 0">
|
201
|
<ROW>
|
202
|
<xsl:attribute name="value">
|
203
|
<xsl:value-of
|
204
|
select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about, 'incomplete')"/>
|
205
|
</xsl:attribute>
|
206
|
</ROW>
|
207
|
<ROW>
|
208
|
<xsl:attribute name="value">
|
209
|
<xsl:value-of
|
210
|
select="dnet:createRel($datasetId, $enityId, $relationSemantic, 'dataset_unknown', $provenance, $trust, $about)"/>
|
211
|
</xsl:attribute>
|
212
|
</ROW>
|
213
|
<ROW>
|
214
|
<xsl:attribute name="value">
|
215
|
<xsl:value-of
|
216
|
select="dnet:createRel($enityId, $datasetId, $inverseRelationSemantic, 'dataset_unknown', $provenance, $trust, $about)"/>
|
217
|
</xsl:attribute>
|
218
|
</ROW>
|
219
|
</xsl:if>
|
220
|
</xsl:for-each>
|
221
|
</ROWS>
|
222
|
</xsl:if>
|
223
|
</xsl:otherwise>
|
224
|
</xsl:choose>
|
225
|
</xsl:template>
|
226
|
</xsl:stylesheet>
|
227
|
</CODE>
|
228
|
</SCRIPT>
|
229
|
</CONFIGURATION>
|
230
|
<STATUS/>
|
231
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
232
|
</BODY>
|
233
|
</RESOURCE_PROFILE>
|