Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="b32acb71-c844-464a-8992-dfc804519a5e_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2017-07-03T12:14:22+01:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>claims_openaire_2_OAF</TITLE>
14
				<CODE><![CDATA[<xsl:stylesheet xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"
15
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16
    xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
17
    xmlns:oai="http://www.openarchives.org/OAI/2.0/"
18
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
19
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:date="http://exslt.org/dates-and-times"
21
    extension-element-prefixes="date" exclude-result-prefixes="xsl">
22

    
23
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
24

    
25
    <xsl:output indent="yes"/>
26

    
27
    <xsl:template match="/">
28
        <xsl:choose>
29
            <xsl:when
30
                test="string-length(//*[local-name() = 'objIdentifier']) = 46 and matches(//*[local-name() = 'objIdentifier'], '\w{12}') and (//instance/webresource/url != '' or //pid[@classid = 'doi'] != '')">
31
                <xsl:call-template name="createRecord"/>
32
            </xsl:when>
33
            <xsl:otherwise>
34
                <xsl:call-template name="skipRecord"/>
35
            </xsl:otherwise>
36
        </xsl:choose>
37

    
38
    </xsl:template>
39

    
40
    <xsl:template name="skipRecord">
41
        <oai:record>
42
            <oai:header>
43
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
44
                    copy-namespaces="no"/>
45
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
46
                    copy-namespaces="no"/>
47
                <dri:recordIdentifier>
48
                    <xsl:value-of select="//*[local-name() = 'header']/dri:objIdentifier"/>
49
                </dri:recordIdentifier>
50
                <dr:dateOfTransformation>
51
                    <xsl:value-of select="date:date-time()"/>
52
                </dr:dateOfTransformation>
53
            </oai:header>
54
            <oai:metadata>
55
                <xsl:copy-of select="//*[local-name() = 'metadata']/*"/>
56
            </oai:metadata>
57
        </oai:record>
58
    </xsl:template>
59

    
60
    <xsl:template name="createRecord">
61
        <oai:record>
62
            <oai:header>
63
                <xsl:copy-of select="//*[local-name() = 'header']/dri:objIdentifier"
64
                    copy-namespaces="no"/>
65
                <xsl:copy-of select="//*[local-name() = 'header']/dri:dateOfCollection"
66
                    copy-namespaces="no"/>
67
                <xsl:copy-of select="//*[local-name() = 'header']/oaf:datasourceprefix"
68
                    copy-namespaces="no"/>
69
                <dr:dateOfTransformation>
70
                    <xsl:value-of select="date:date-time()"/>
71
                </dr:dateOfTransformation>
72
            </oai:header>
73
            <oai:metadata>
74
                <xsl:apply-templates/>
75
                <!-- Ordered creators (M) -->
76
                <xsl:call-template name="orderedAuthorsInRels"/>
77
                <xsl:call-template name="orderedAuthorsInCreators"/>
78
                <xsl:call-template name="oafFields"/>
79
            </oai:metadata>
80
            <xsl:copy-of select="//*[local-name() = 'about']" copy-namespaces="no"/>
81
        </oai:record>
82
    </xsl:template>
83

    
84

    
85
    <!-- Creators (M) -->
86
    <xsl:template name="orderedAuthorsInRels">
87
        <xsl:for-each select="//oaf:result//rel[./to/@class = 'hasAuthor']">
88
            <xsl:sort select="ranking"/>
89
            <dc:creator>
90
                <xsl:value-of select="./fullname"/>
91
            </dc:creator>
92
        </xsl:for-each>
93
    </xsl:template>
94

    
95
    <!-- Creators (M) when they are not as linked entities -->
96
    <xsl:template name="orderedAuthorsInCreators">
97
        <xsl:for-each select="//oaf:result/creator">
98
            <xsl:sort select="./@rank"/>
99
            <dc:creator>
100
                <xsl:value-of select="./text()"/>
101
            </dc:creator>
102
        </xsl:for-each>
103
    </xsl:template>
104

    
105
    <!-- Titles (M): based on title/@classname <dc:title>main title:subtitle</dc:title>
106
												<dc:title>alternative title</dc:title> <dc:title>translated title</dc:title>
107
												We have only "main title" for now: let's keep it simple here... -->
108
    <xsl:template match="//oaf:result/title">
109
        <dc:title>
110
            <xsl:value-of select="normalize-space(./text())"/>
111
        </dc:title>
112
    </xsl:template>
113

    
114
    <!-- Contributors (R)  -->
115
    <xsl:template match="//oaf:result//rel[./to/@class = 'hasContributor']">
116
        <dc:contributor>
117
            <xsl:value-of select="./fullname"/>
118
        </dc:contributor>
119
    </xsl:template>
120
    <xsl:template match="//oaf:result/contributor">
121
        <dc:contributor>
122
            <xsl:value-of select="./text()"/>
123
        </dc:contributor>
124
    </xsl:template>
125

    
126

    
127
    <!-- Let's not keep the original ids, only the PIDs -->
128
    <!--
129
    <xsl:template match="//oaf:result/originalId/text()">
130
        <dc:identifier><xsl:value-of select="normalize-space(.)"/></dc:identifier>
131
    </xsl:template>
132
    -->
133

    
134
    <!--
135
        Alternative Identifier (R), idType from pid@classid
136
        <dc:relation>info:eu-repo/semantics/altIdentifier/[idType]/[ID]</dc:relation>
137
    -->
138
    <xsl:template match="//oaf:result/pid[./text()]">
139
        <dc:relation>
140
            <xsl:value-of
141
                select="concat('info:eu-repo/semantics/altIdentifier/', @classid, '/', ./text())"/>
142
        </dc:relation>
143
    </xsl:template>
144

    
145
    <xsl:template match="//oaf:result//*[local-name() = 'instance']/webresource/url/text()">
146
        <dc:identifier>
147
            <xsl:value-of select="."/>
148
        </dc:identifier>
149
    </xsl:template>
150

    
151
    <!--
152
        Subjects (M w A) <dc:subject>bag of words</dc:subject>
153
        If subject@classname != keywords, then we have a classification scheme to encode
154
        <dc:subject>info:eu-repo/classification/[scheme]/[value]</dc:subject>
155
        <dc:subject>info:eu-repo/classification/dcc/whatever</dc:subject>
156
    -->
157
    <xsl:template match="//oaf:result/subject[@classname = 'keyword']">
158
        <dc:subject>
159
            <xsl:value-of select="normalize-space(./text())"/>
160
        </dc:subject>
161
    </xsl:template>
162
    <xsl:template match="//oaf:result/subject[not(@classname = 'keyword') and @classid != '']">
163
        <dc:subject>
164
            <xsl:value-of
165
                select="concat('info:eu-repo/classification/', @classid, '/', normalize-space(./text()))"
166
            />
167
        </dc:subject>
168
    </xsl:template>
169

    
170
    <!--description (M w A) from description -->
171
    <xsl:template match="//oaf:result/description/text()">
172
        <dc:description>
173
            <xsl:value-of select="normalize-space(.)"/>
174
        </dc:description>
175
    </xsl:template>
176
    <!--publisher (M w A) from publisher -->
177
    <xsl:template match="//oaf:result/publisher/text()">
178
        <dc:publisher>
179
            <xsl:value-of select="normalize-space(.)"/>
180
        </dc:publisher>
181
    </xsl:template>
182
    <!-- Publication date (M) from dateofacceptance -->
183
    <xsl:template match="//oaf:result/dateofacceptance/text()">
184
        <dc:date>
185
            <xsl:value-of select="normalize-space(.)"/>
186
        </dc:date>
187
    </xsl:template>
188

    
189
    <xsl:template
190
        match="//oaf:result//*[local-name() = 'instance']/*[local-name() = 'instancetype']">
191
        <dc:type>
192
            <xsl:value-of select="./@classname"/>
193
        </dc:type>
194
    </xsl:template>
195

    
196
    <!--
197
        Format (R), in theory from format, not sure we are filling it
198
		<dc:format>mediaType of the digital manifestation of the resource</dc:format>
199
		<dc:format>application/pdf</dc:format>
200
    -->
201
    <xsl:template match="//oaf:result/format/text()">
202
        <dc:format>
203
            <xsl:value-of select="normalize-space(.)"/>
204
        </dc:format>
205
    </xsl:template>
206

    
207
    <!-- source (R) from source -->
208
    <xsl:template match="//oaf:result/source/text()">
209
        <dc:source>
210
            <xsl:value-of select="normalize-space(.)"/>
211
        </dc:source>
212
    </xsl:template>
213

    
214
    <xsl:template match="//oaf:result/collectedfrom">
215
        <dc:source>
216
            <xsl:value-of select="normalize-space(@name)"/>
217
        </dc:source>
218
    </xsl:template>
219

    
220
    <!-- Language (R) from language@classid -->
221
    <xsl:template match="//oaf:result/language">
222
        <dc:language>
223
            <xsl:value-of select="./@classid"/>
224
        </dc:language>
225
    </xsl:template>
226

    
227

    
228
    <!-- Oaf:fields -->
229
    <xsl:template name="oafFields">
230
        <dr:CobjCategory>
231
            <xsl:value-of
232
                select="//*[local-name() = 'children']/*[local-name() = 'instance' and ./*[local-name() = 'instancetype']/@classid != ''][1]/*[local-name() = 'instancetype']/@classid"
233
            />
234
        </dr:CobjCategory>
235
        <oaf:dateAccepted>
236
            <xsl:value-of select="//oaf:result/dateofacceptance/text()"/>
237
        </oaf:dateAccepted>
238
        <oaf:accessrights>
239
            <xsl:value-of select="//oaf:result/bestaccessright/@classid"/>
240
        </oaf:accessrights>
241
        <oaf:language>
242
            <xsl:value-of select="//oaf:result/language/@classid"/>
243
        </oaf:language>
244
        <oaf:embargoenddate>
245
            <xsl:value-of select="//oaf:result/embargoenddate/text()"/>
246
        </oaf:embargoenddate>
247
        <oaf:hostedby id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
248
            name="Unknown Repository"/>
249
        <oaf:collectedfrom id="infrastruct_::openaire" name="OpenAIRE"/>
250
        <oaf:journal eissn="{//oaf:result/journal/@eissn}" ep="{//oaf:result/journal/@ep}"
251
            iss="{//oaf:result/journal/@issn}" issn="{//oaf:result/journal/@issn}"
252
            lissn="{//oaf:result/journal/@lissn}" sp="{//oaf:result/journal/@sp}"
253
            vol="{//oaf:result/journal/@vol}">
254
            <xsl:value-of select="//oaf:result/journal/text()"/>
255
        </oaf:journal>
256
    </xsl:template>
257

    
258
    <!-- Override default template -->
259
    <xsl:template match="text() | @*"/>
260

    
261
</xsl:stylesheet>
262
]]></CODE>
263
			</SCRIPT>
264
		</CONFIGURATION>
265
		<STATUS/>
266
		<SECURITY_PARAMETERS/>
267
	</BODY>
268
</RESOURCE_PROFILE>
(3-3/6)