1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER
|
4
|
value="oaiAndsTransform_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
5
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
6
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
7
|
<RESOURCE_URI value=""/>
|
8
|
<DATE_OF_CREATION value="2014-11-19T11:05:55+01:00"/>
|
9
|
</HEADER>
|
10
|
<BODY>
|
11
|
<CONFIGURATION>
|
12
|
<IMPORTED/>
|
13
|
<SCRIPT>
|
14
|
<TITLE>DLI: OAI_ANDS transform</TITLE>
|
15
|
<CODE><![CDATA[<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
16
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
17
|
xmlns:datetime="http://exslt.org/dates-and-times" xmlns:exslt="http://exslt.org/common"
|
18
|
xmlns:oai="http://www.openarchives.org/OAI/2.0/"
|
19
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
20
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
21
|
xmlns:oaf="http://namespace.dnet.eu/oaf"
|
22
|
xmlns:dnet="eu.dnetlib.dli.DLIUtils"
|
23
|
exclude-result-prefixes="xsl datetime exslt dnet">
|
24
|
<xsl:template match="/">
|
25
|
<xsl:variable name="namespacePrefix" select="//dri:datasourceprefix"/>
|
26
|
<xsl:variable name="pid"><xsl:value-of select="dnet:fixPID(//*[local-name()='source']/*[local-name()='identifier']/*[local-name()='identifier'])"/> </xsl:variable>
|
27
|
<xsl:variable name="pidType"><xsl:value-of select="dnet:inferPidType(//*[local-name()='source']/*[local-name()='identifier']/*[local-name()='identifier'],//*[local-name()='source']/*[local-name()='identifier']/*[local-name()='schema'])"/> </xsl:variable>
|
28
|
|
29
|
|
30
|
<xsl:variable name="relatedPid"><xsl:value-of select="dnet:fixPID(//*[local-name()='target']/*[local-name()='identifier']/*[local-name()='identifier'])"/> </xsl:variable>
|
31
|
<xsl:variable name="relatedPidType"><xsl:value-of select="dnet:inferPidType(//*[local-name()='target']/*[local-name()='identifier']/*[local-name()='identifier'],//*[local-name()='target']/*[local-name()='identifier']/*[local-name()='schema'])"/> </xsl:variable>
|
32
|
|
33
|
<xsl:variable name="relation"><xsl:value-of select="//*[local-name()='relationship']/*[local-name()='name']"/></xsl:variable>
|
34
|
<xsl:variable name="inverseRelation"><xsl:value-of select="//*[local-name()='relationship']/*[local-name()='inverseRelationship']"/></xsl:variable>
|
35
|
|
36
|
<xsl:variable name="targetType">
|
37
|
<xsl:choose>
|
38
|
<xsl:when test="//*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] ='dataset' or //*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type']= 'collection'">dataset</xsl:when>
|
39
|
<xsl:when test="//*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] = 'literature' or //*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] = 'publication'">publication</xsl:when>
|
40
|
<xsl:otherwise>unknown</xsl:otherwise>
|
41
|
</xsl:choose>
|
42
|
</xsl:variable>
|
43
|
|
44
|
<xsl:variable name="sourceType">
|
45
|
<xsl:choose>
|
46
|
<xsl:when test="//*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type'] ='dataset' or //*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type']= 'collection'">dataset</xsl:when>
|
47
|
<xsl:when test="//source/objectType/type = 'literature' or //source/objectType/type = 'publication'">publication</xsl:when>
|
48
|
<xsl:otherwise>unknown</xsl:otherwise>
|
49
|
</xsl:choose>
|
50
|
</xsl:variable>
|
51
|
<xsl:variable name="dnetSourceId"><xsl:value-of select="concat($namespacePrefix, '::', dnet:generateIdentifier(concat($pid, '::', $relatedPid), concat($pidType, '::', $relatedPidType)))"/></xsl:variable>
|
52
|
<xsl:variable name="dnetTargetId"><xsl:value-of select="concat($namespacePrefix, '::', dnet:generateIdentifier(concat($relatedPid, '::', $pid), concat($relatedPidType, '::', $pidType)))"/></xsl:variable>
|
53
|
<pack>
|
54
|
<xsl:choose>
|
55
|
<xsl:when test=".//*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type'] = 'dataset' or .//*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type'] = 'collection'">
|
56
|
<oai:record xmlns="http://namespace.openaire.eu/"
|
57
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
58
|
<oai:header>
|
59
|
<dri:objIdentifier><xsl:value-of select="$dnetSourceId"/></dri:objIdentifier>
|
60
|
<dri:recordIdentifier><xsl:value-of select="concat($pid, '::', $pidType)"/></dri:recordIdentifier>
|
61
|
<dri:dateOfCollection><xsl:value-of select="//dri:dateOfCollection"/> </dri:dateOfCollection>
|
62
|
<dri:repositoryId><xsl:value-of select="//dri:repositoryId"/></dri:repositoryId>
|
63
|
<dri:datasourceprefix><xsl:value-of select="$namespacePrefix"/></dri:datasourceprefix>
|
64
|
</oai:header>
|
65
|
<metadata>
|
66
|
<resource xmlns="http://datacite.org/schema/kernel-3"
|
67
|
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
|
68
|
<identifier identifierType="{$pidType}" >
|
69
|
<xsl:value-of select="$pid"/>
|
70
|
</identifier>
|
71
|
<titles>
|
72
|
<xsl:for-each
|
73
|
select="//*[local-name()='source']/*[local-name()='title']">
|
74
|
<title>
|
75
|
<xsl:value-of select="."/>
|
76
|
</title>
|
77
|
</xsl:for-each>
|
78
|
</titles>
|
79
|
<publisher >
|
80
|
<xsl:value-of select="//*[local-name()='publisher']/*[local-name()='name']"/></publisher>
|
81
|
<dates>
|
82
|
<xsl:for-each select="//*[local-name()='source']/*[local-name()='publicationDate']">
|
83
|
<date dateType="Collected">
|
84
|
<xsl:value-of select="."/>
|
85
|
</date>
|
86
|
</xsl:for-each>
|
87
|
</dates>
|
88
|
<creators>
|
89
|
<xsl:for-each select="//*[local-name()='source']//*[local-name()='creatorName']">
|
90
|
<creator>
|
91
|
<creatorName><xsl:value-of select="."/></creatorName>
|
92
|
</creator>
|
93
|
</xsl:for-each>
|
94
|
</creators>
|
95
|
<resourceType resourceTypeGeneral="Dataset">Dataset</resourceType>
|
96
|
<relatedIdentifiers>
|
97
|
<relatedIdentifier xmlns:oaf="http://namespace.dnet.eu/oaf"
|
98
|
inverseRelationType="{$inverseRelation}" relationType="{$relation}"
|
99
|
entityType="{$targetType}" name="dnet">
|
100
|
<xsl:value-of select="$dnetTargetId"/>
|
101
|
</relatedIdentifier>
|
102
|
</relatedIdentifiers>
|
103
|
</resource>
|
104
|
</metadata>
|
105
|
<oaf:about>
|
106
|
<oaf:datainfo>
|
107
|
<oaf:collectedFrom completionStatus="complete">
|
108
|
<xsl:attribute name="id">
|
109
|
<xsl:value-of select="dnet:getIdFromDataSourcePrefix($namespacePrefix)"/>
|
110
|
</xsl:attribute>
|
111
|
<xsl:attribute name="name">
|
112
|
<xsl:value-of select="dnet:getNameFromDataSourcePrefix($namespacePrefix)"/>
|
113
|
</xsl:attribute>
|
114
|
</oaf:collectedFrom>
|
115
|
<oaf:completionStatus>complete</oaf:completionStatus>
|
116
|
<oaf:provisionMode>collected</oaf:provisionMode>
|
117
|
</oaf:datainfo>
|
118
|
</oaf:about>
|
119
|
</oai:record>
|
120
|
</xsl:when>
|
121
|
<xsl:when test=".//*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type'] = 'literature' or .//*[local-name()='source']/*[local-name()='objectType']/*[local-name()='type'] = 'publication'">
|
122
|
<oai:record xmlns="http://namespace.openaire.eu/"
|
123
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
124
|
<oai:header>
|
125
|
<dri:objIdentifier><xsl:value-of select="$dnetSourceId"/></dri:objIdentifier>
|
126
|
<dri:recordIdentifier><xsl:value-of select="concat($pid, '::', $pidType)"/></dri:recordIdentifier>
|
127
|
<dri:dateOfCollection><xsl:value-of select="//dri:dateOfCollection"/> </dri:dateOfCollection>
|
128
|
<dri:repositoryId><xsl:value-of select="//dri:repositoryId"/></dri:repositoryId>
|
129
|
<dri:datasourceprefix><xsl:value-of select="$namespacePrefix"/></dri:datasourceprefix>
|
130
|
</oai:header>
|
131
|
<metadata>
|
132
|
<oaf:pid type="{$pidType}"><xsl:value-of select="$pid"/></oaf:pid>
|
133
|
<dc:identifier><xsl:value-of select="$pid"/> </dc:identifier>
|
134
|
<dc:title><xsl:value-of select="//*[local-name()='source']/*[local-name()='title']"/></dc:title>
|
135
|
<xsl:for-each select="//*[local-name()='source']//*[local-name()='creatorName']">
|
136
|
<dc:creator><xsl:value-of select="."/></dc:creator>
|
137
|
</xsl:for-each>
|
138
|
<dc:type >publication</dc:type>
|
139
|
<oaf:relatedIdentifier inverseRelationType="{$inverseRelation}" relationType="{$relation}"
|
140
|
entityType="{$targetType}" name="dnet">
|
141
|
<xsl:value-of select="$dnetTargetId"/>
|
142
|
</oaf:relatedIdentifier>
|
143
|
</metadata>
|
144
|
<oaf:about>
|
145
|
<oaf:datainfo>
|
146
|
<oaf:collectedFrom completionStatus="complete">
|
147
|
<xsl:attribute name="id">
|
148
|
<xsl:value-of select="dnet:getIdFromDataSourcePrefix($namespacePrefix)"/>
|
149
|
</xsl:attribute>
|
150
|
<xsl:attribute name="name">
|
151
|
<xsl:value-of select="dnet:getNameFromDataSourcePrefix($namespacePrefix)"/>
|
152
|
</xsl:attribute>
|
153
|
</oaf:collectedFrom>
|
154
|
<oaf:completionStatus>complete</oaf:completionStatus>
|
155
|
<oaf:provisionMode>collected</oaf:provisionMode>
|
156
|
</oaf:datainfo>
|
157
|
</oaf:about>
|
158
|
</oai:record>
|
159
|
</xsl:when>
|
160
|
</xsl:choose>
|
161
|
<xsl:choose>
|
162
|
<xsl:when test="//*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] = 'literature' or //*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] = 'publication'">
|
163
|
<oai:record xmlns="http://namespace.openaire.eu/"
|
164
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
165
|
<oai:header>
|
166
|
<dri:objIdentifier><xsl:value-of select="$dnetTargetId"/></dri:objIdentifier>
|
167
|
<dri:recordIdentifier><xsl:value-of select="concat($relatedPid, '::', $relatedPidType)"/></dri:recordIdentifier>
|
168
|
<dri:dateOfCollection><xsl:value-of select="//dri:dateOfCollection"/> </dri:dateOfCollection>
|
169
|
<dri:repositoryId><xsl:value-of select="//dri:repositoryId"/></dri:repositoryId>
|
170
|
<dri:datasourceprefix><xsl:value-of select="$namespacePrefix"/></dri:datasourceprefix>
|
171
|
</oai:header>
|
172
|
<metadata>
|
173
|
<oaf:pid type="{$relatedPidType}"><xsl:value-of select="$relatedPid"/></oaf:pid>
|
174
|
<dc:identifier><xsl:value-of select="$relatedPid"/> </dc:identifier>
|
175
|
<dc:title><xsl:value-of select="//*[local-name()='target']/*[local-name()='title']"/></dc:title>
|
176
|
<xsl:for-each select="//*[local-name()='target']//*[local-name()='creatorName']">
|
177
|
<dc:creator><xsl:value-of select="."/></dc:creator>
|
178
|
</xsl:for-each>
|
179
|
<dc:type >publication</dc:type>
|
180
|
<oaf:relatedIdentifier inverseRelationType="{$relation}" relationType="{$inverseRelation}"
|
181
|
entityType="{$sourceType}" name="dnet">
|
182
|
<xsl:value-of select="$dnetSourceId"/>
|
183
|
</oaf:relatedIdentifier>
|
184
|
</metadata>
|
185
|
<oaf:about>
|
186
|
<oaf:datainfo>
|
187
|
<oaf:collectedFrom completionStatus="complete">
|
188
|
<xsl:attribute name="id">
|
189
|
<xsl:value-of select="dnet:getIdFromDataSourcePrefix($namespacePrefix)"/>
|
190
|
</xsl:attribute>
|
191
|
<xsl:attribute name="name">
|
192
|
<xsl:value-of select="dnet:getNameFromDataSourcePrefix($namespacePrefix)"/>
|
193
|
</xsl:attribute>
|
194
|
</oaf:collectedFrom>
|
195
|
<oaf:completionStatus>complete</oaf:completionStatus>
|
196
|
<oaf:provisionMode>collected</oaf:provisionMode>
|
197
|
</oaf:datainfo>
|
198
|
</oaf:about>
|
199
|
</oai:record>
|
200
|
</xsl:when>
|
201
|
<xsl:when test=".//*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] = 'dataset' or .//*[local-name()='target']/*[local-name()='objectType']/*[local-name()='type'] = 'collection'">
|
202
|
<oai:record xmlns="http://namespace.openaire.eu/"
|
203
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
204
|
<oai:header>
|
205
|
<dri:objIdentifier><xsl:value-of select="$dnetTargetId"/></dri:objIdentifier>
|
206
|
<dri:recordIdentifier><xsl:value-of select="concat($relatedPid, '::', $relatedPidType)"/></dri:recordIdentifier>
|
207
|
<dri:dateOfCollection><xsl:value-of select="//dri:dateOfCollection"/> </dri:dateOfCollection>
|
208
|
<dri:repositoryId><xsl:value-of select="//dri:repositoryId"/></dri:repositoryId>
|
209
|
<dri:datasourceprefix><xsl:value-of select="$namespacePrefix"/></dri:datasourceprefix>
|
210
|
</oai:header>
|
211
|
<metadata>
|
212
|
<resource xmlns="http://datacite.org/schema/kernel-3"
|
213
|
xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
|
214
|
<identifier identifierType="{$relatedPidType}" >
|
215
|
<xsl:value-of select="$relatedPid"/>
|
216
|
</identifier>
|
217
|
<titles>
|
218
|
<xsl:for-each
|
219
|
select="//*[local-name()='target']/*[local-name()='title']">
|
220
|
<title>
|
221
|
<xsl:value-of select="."/>
|
222
|
</title>
|
223
|
</xsl:for-each>
|
224
|
</titles>
|
225
|
<publisher >
|
226
|
<xsl:value-of select="//*[local-name()='publisher']/*[local-name()='name']"/></publisher>
|
227
|
<dates>
|
228
|
<xsl:for-each select="//*[local-name()='target']/*[local-name()='publicationDate']">
|
229
|
<date dateType="Collected">
|
230
|
<xsl:value-of select="."/>
|
231
|
</date>
|
232
|
</xsl:for-each>
|
233
|
</dates>
|
234
|
<creators>
|
235
|
<xsl:for-each select="//*[local-name()='target']//*[local-name()='creatorName']">
|
236
|
<creator>
|
237
|
<creatorName><xsl:value-of select="."/></creatorName>
|
238
|
</creator>
|
239
|
</xsl:for-each>
|
240
|
</creators>
|
241
|
<resourceType resourceTypeGeneral="Dataset">Dataset</resourceType>
|
242
|
<relatedIdentifiers>
|
243
|
<relatedIdentifier xmlns:oaf="http://namespace.dnet.eu/oaf"
|
244
|
inverseRelationType="{$relation}" relationType="{$inverseRelation}"
|
245
|
entityType="{$sourceType}" name="dnet">
|
246
|
<xsl:value-of select="$dnetSourceId"/>
|
247
|
</relatedIdentifier>
|
248
|
</relatedIdentifiers>
|
249
|
</resource>
|
250
|
</metadata>
|
251
|
<oaf:about>
|
252
|
<oaf:datainfo>
|
253
|
<oaf:collectedFrom completionStatus="complete">
|
254
|
<xsl:attribute name="id">
|
255
|
<xsl:value-of select="dnet:getIdFromDataSourcePrefix($namespacePrefix)"/>
|
256
|
</xsl:attribute>
|
257
|
<xsl:attribute name="name">
|
258
|
<xsl:value-of select="dnet:getNameFromDataSourcePrefix($namespacePrefix)"/>
|
259
|
</xsl:attribute>
|
260
|
</oaf:collectedFrom>
|
261
|
<oaf:completionStatus>complete</oaf:completionStatus>
|
262
|
<oaf:provisionMode>collected</oaf:provisionMode>
|
263
|
</oaf:datainfo>
|
264
|
</oaf:about>
|
265
|
</oai:record>
|
266
|
</xsl:when>
|
267
|
</xsl:choose>
|
268
|
</pack>
|
269
|
</xsl:template>
|
270
|
</xsl:stylesheet>]]>
|
271
|
</CODE>
|
272
|
</SCRIPT>
|
273
|
</CONFIGURATION>
|
274
|
<STATUS/>
|
275
|
<SECURITY_PARAMETERS/>
|
276
|
</BODY>
|
277
|
</RESOURCE_PROFILE>
|