Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="522cd83c-4177-4401-85ad-3217d5cb7ba0_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2016-03-10T16:03:17+00:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>xslt_rioxx2oaf_core</TITLE>
14
                <CODE>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1" 
15
                             xmlns:dri="http://www.driver-repository.eu/namespace/dri" 
16
                             xmlns:dc="http://purl.org/dc/elements/1.1/" 
17
                             xmlns:oaf="http://namespace.openaire.eu/oaf" 
18
                             xmlns:dr="http://www.driver-repository.eu/namespace/dr" 
19
                             xmlns:transformExt="http://namespace.openaire.eu/java/org.apache.commons.codec.digest.DigestUtils" 
20
                             xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
21
                             extension-element-prefixes="transformExt TransformationFunction"
22
                             exclude-result-prefixes="transformExt TransformationFunction" &gt;
23
                        &lt;xsl:output indent="yes" omit-xml-declaration="yes"/&gt;
24

    
25
  &lt;xsl:param name="varOfficialName" /&gt;
26
  &lt;xsl:param name="varDsType" /&gt;
27
  &lt;xsl:param name="varDataSourceId" /&gt;
28
  &lt;xsl:param name="varFP7" select="'corda_______::'"/&gt;
29
  &lt;xsl:param name="varH2020" select="'corda__h2020::'"/&gt;
30

    
31
  &lt;xsl:param name="repoCode" select="replace(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], '^([^:]*:[^:]*):.*$', '$1')"/&gt;
32

    
33
  &lt;xsl:param name="index" select="0"/&gt;
34
  &lt;xsl:param name="transDate" select="current-dateTime()"/&gt;
35
  &lt;xsl:variable name="tf" select="TransformationFunction:getInstance()"/&gt;
36

    
37

    
38

    
39
&lt;xsl:variable name="vCodes"&gt;
40
  &lt;codes&gt;
41
   &lt;code key="oai:usir.salford.ac.uk" value="od_______991"   id="opendoar____::991" name="University of Salford Institutional repository"/&gt;
42
   &lt;code key="oai:sro.sussex.ac.uk" value="od______2384"   id="opendoar____::2384" name="Sussex Research Online"/&gt;
43
   &lt;code key="oai:eprints.gla.ac.uk" value="od_______162"  id="opendoar____::162" name="Enlighten"/&gt;
44
   &lt;code key="oai:researchspace.bathspa.ac.uk" value="od______2694" id="opendoar____::2694" name="ResearchSPace - Bath Spa University"/&gt;
45
   &lt;code key="oai:wrap.warwick.ac.uk" value="od______1288"  id="opendoar____::1288" name="Warwick Research Archives Portal Repository"/&gt;
46
   &lt;code key="oai:centaur.reading.ac.uk" value="od______1731"    id="opendoar____::1731" name="Central Archive at the University of Reading"/&gt;
47
   &lt;code key="oai:eprints.lse.ac.uk" value="od_______206"   id="opendoar____::206" name="LSE Research Online"/&gt;
48
   &lt;code key="oai:westminsterresearch.wmin.ac.uk" value="od_______936"  id="opendoar____::936" name="WestminsterResearch"/&gt;
49
   &lt;code key="oai:eprints.soas.ac.uk" value="od_______285"  id="opendoar____::285" name="SOAS Research Online"/&gt;
50
   &lt;code key="oai:open.ac.uk.OAI2" value="od_______300"  id="opendoar____::300" name="Open Research Online"/&gt;
51
   &lt;code key="oai:nectar.northampton.ac.uk" value="od______1251"  id="opendoar____::1251" name="NECTAR"/&gt;
52
   &lt;code key="oai:openaccess.sgul.ac.uk" value="od______2556"  id="opendoar____::2556" name="St George's Online Research Archive"/&gt;
53
   &lt;code key="oai:researchrepository.napier.ac.uk" value="od______1334"  id="opendoar____::1334" name="Repository@Napier"/&gt;
54
   &lt;code key="oai:roar.uel.ac.uk" value="od______1488"  id="opendoar____::1488" name="ROAR at University of East London"/&gt;
55
   &lt;code key="oai:eprints.staffs.ac.uk" value="od______2881"  id="opendoar____::2881" name="STORE - Staffordshire Online Repository"/&gt;
56
   &lt;code key="oai:ray.yorksj.ac.uk" value="od______1391"   id="opendoar____::1391" name="York St John University Repository"/&gt;
57
   &lt;code key="oai:repository.winchester.ac.uk" value="core________"   id="openaire____::d2d51e00-28b0-4f13-b541-7473d104a860" name="CORE"/&gt;
58
   &lt;code key="oai:rhinology.in" value="core________"   id="openaire____::d2d51e00-28b0-4f13-b541-7473d104a860" name="CORE"/&gt;
59
  &lt;/codes&gt;
60
 &lt;/xsl:variable&gt;
61
&lt;!-- 
62
status CORE-ID OpenDOAR-ID repo name
63
ok 136   1288    Warwick Research Archives Portal Repository
64
ok 67    206        LSE Research Online
65
ok 42    162        Enlighten
66
ok 109    2384    Sussex Research Online
67
ok 130    991        University of Salford Institutional repository  oai:usir.salford.ac.uk
68
ok 17    1731    Central Archive at the University of Reading
69
ok 86    300        Open Research Online
70
ok 103    285        SOAS Research Online
71
ok 138    936        WestminsterResearch
72
ok 686    0    !2694        ResearchSPace - Bath Spa University              http://researchspace.bathspa.ac.uk/cgi/oai2
73
ok 78    1251    NECTAR                                      http://nectar.northampton.ac.uk/cgi/oai2?verb=Identify
74
ok 253    2556    St George's Online Research Archive
75
ok 92    1334    Repository@Napier
76
ok 96    1488    ROAR at University of East London
77
ok 620    2881    STORE - Staffordshire Online Repository
78
ok ? 694    0        Winchester Research Repository                  http://repository.winchester.ac.uk/cgi/oai2 oai:repository.winchester.ac.uk
79
ok 683    0    ! 1391    York St John University Repository              http://ray.yorksj.ac.uk/cgi/oai2
80
? 294    0        Entrepo                                          http://rhinology.in/cgi/oai2 oai:rhinology.in
81
? no records so far 170    2134    LSE Theses Online                              http://etheses.lse.ac.uk/cgi/oai2
82
   &lt;code key="oai:eprints.lse.ac.uk" value="od______2134"   id="opendoar____::2134" name="LSE Theses Online"/&gt;
83

    
84
--&gt;
85
&lt;xsl:key name="kCodeByName" match="code" use="string(@key)"/&gt;
86

    
87

    
88
               &lt;xsl:template name="terminate"&gt;
89
                	&lt;xsl:message terminate="yes"&gt;
90
                             	record is not compliant, transformation is interrupted.
91
                	&lt;/xsl:message&gt;
92
               &lt;/xsl:template&gt;
93

    
94
                        &lt;xsl:template match="/"&gt;
95
                              &lt;record&gt;
96
                                  &lt;xsl:apply-templates select="//*[local-name() = 'header']" /&gt;
97
                                  &lt;metadata&gt;
98
                                    &lt;xsl:call-template name="allElements"&gt;
99
                                            &lt;xsl:with-param name="sourceElement" select="//dc:title"/&gt;
100
                                            &lt;xsl:with-param name="targetElement" select="'dc:title'"/&gt;
101
                                    &lt;/xsl:call-template&gt;
102
                                    &lt;xsl:call-template name="allElements"&gt;
103
                                            &lt;xsl:with-param name="sourceElement" select="//*[local-name()='author']"/&gt;
104
                                            &lt;xsl:with-param name="targetElement" select="'dc:creator'"/&gt;
105
                                    &lt;/xsl:call-template&gt;
106
                                    &lt;xsl:call-template name="allElements"&gt;
107
                                            &lt;xsl:with-param name="sourceElement" select="//*[local-name()='contributor']"/&gt;
108
                                            &lt;xsl:with-param name="targetElement" select="'dc:contributor'"/&gt;
109
                                    &lt;/xsl:call-template&gt;
110
                                    &lt;xsl:call-template name="allElements"&gt;
111
                                            &lt;xsl:with-param name="sourceElement" select="//dc:description"/&gt;
112
                                            &lt;xsl:with-param name="targetElement" select="'dc:description'"/&gt;
113
                                    &lt;/xsl:call-template&gt;
114
                                    &lt;xsl:call-template name="allElements"&gt;
115
                                            &lt;xsl:with-param name="sourceElement" select="//dc:format"/&gt;
116
                                            &lt;xsl:with-param name="targetElement" select="'dc:format'"/&gt;
117
                                    &lt;/xsl:call-template&gt;
118
                                    &lt;xsl:call-template name="allElements"&gt;
119
                                            &lt;xsl:with-param name="sourceElement" select="//dc:subject"/&gt;
120
                                            &lt;xsl:with-param name="targetElement" select="'dc:subject'"/&gt;
121
                                    &lt;/xsl:call-template&gt;
122
                                    &lt;xsl:call-template name="allElements"&gt;
123
                                            &lt;xsl:with-param name="sourceElement" select="//dc:publisher"/&gt;
124
                                            &lt;xsl:with-param name="targetElement" select="'dc:publisher'"/&gt;
125
                                    &lt;/xsl:call-template&gt;
126
                                    &lt;xsl:call-template name="allElements"&gt;
127
                                            &lt;xsl:with-param name="sourceElement" select="//dc:source"/&gt;
128
                                            &lt;xsl:with-param name="targetElement" select="'dc:source'"/&gt;
129
                                    &lt;/xsl:call-template&gt;
130
                                    &lt;dc:language&gt;
131
                                             &lt;xsl:value-of select="TransformationFunction:convertString($tf, //dc:language, 'Languages')"/&gt;
132
                                    &lt;/dc:language&gt;
133
                                    &lt;xsl:call-template name="allElements"&gt;
134
                                            &lt;xsl:with-param name="sourceElement" select="//dc:rights"/&gt;
135
                                            &lt;xsl:with-param name="targetElement" select="'dc:rights'"/&gt;
136
                                    &lt;/xsl:call-template&gt;
137
                                    &lt;xsl:call-template name="allElements"&gt;
138
                                            &lt;xsl:with-param name="sourceElement" select="//dc:relation"/&gt;
139
                                            &lt;xsl:with-param name="targetElement" select="'dc:relation'"/&gt;
140
                                    &lt;/xsl:call-template&gt;
141
                                    &lt;xsl:if test="not(//dc:identifier[starts-with(., 'http')])"&gt;
142
                                         &lt;xsl:call-template name="terminate"/&gt;
143
                                   &lt;/xsl:if&gt;
144
                                    &lt;xsl:call-template name="allElements"&gt;
145
                                            &lt;xsl:with-param name="sourceElement" select="//dc:identifier[starts-with(., 'http')]"/&gt;
146
                                            &lt;xsl:with-param name="targetElement" select="'dc:identifier'"/&gt;
147
                                    &lt;/xsl:call-template&gt;
148
                                    &lt;xsl:if test="//*[local-name()='version_of_record'][starts-with(., 'http://dx.doi.org/')]"&gt;
149
                                     &lt;xsl:element name="oaf:identifier"&gt; 
150
                                          &lt;xsl:attribute name="identifierType"&gt;
151
                                              &lt;xsl:text&gt;doi&lt;/xsl:text&gt;
152
                                          &lt;/xsl:attribute&gt;
153
                                            &lt;xsl:value-of select="substring-after(//*[local-name()='version_of_record'], 'http://dx.doi.org/')"/&gt;
154
                                        &lt;/xsl:element&gt;
155
                                    &lt;/xsl:if&gt;
156
         &lt;xsl:for-each select="//*[local-name()='project']"&gt;
157
            &lt;xsl:if test="(contains(@funder_name, 'EU FP7') or starts-with(@funder_name, 'Europe') or contains(@funder_id, '10.13039/501100000780') or contains(@funder_id, '10.13039/501100004963') ) and not(contains(., '531245')) and not(contains(lower-case(.), 'lifelong learning programme')) and matches(normalize-space(.), '^.*(\d\d\d\d\d\d).*$', 'i')"&gt;
158
                &lt;oaf:projectid&gt;
159
                    &lt;xsl:value-of select="concat($varFP7, replace(normalize-space(.), '^.*(\d\d\d\d\d\d).*$', '$1', 'i'))"/&gt;
160
                &lt;/oaf:projectid&gt;
161
            &lt;/xsl:if&gt;
162
            &lt;xsl:if test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', 'i')"&gt;
163
                &lt;oaf:projectid&gt;
164
                    &lt;xsl:value-of select="concat($varH2020, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/h2020/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"/&gt;
165
                &lt;/oaf:projectid&gt;
166
            &lt;/xsl:if&gt;
167
         &lt;/xsl:for-each&gt;
168

    
169

    
170
&lt;!--
171
                                    &lt;xsl:if test="not(//didl:Component/didl:Resource[@mimeType='application/pdf'])"&gt;
172
                                         &lt;xsl:call-template name="terminate"/&gt;
173
                                   &lt;/xsl:if&gt;
174
--&gt;
175
                                   &lt;xsl:choose&gt;
176
                                            &lt;xsl:when test="//*[local-name()='free_to_read']" &gt;
177
                                  &lt;oaf:accessrights&gt;
178
                                      &lt;xsl:text&gt;OPEN&lt;/xsl:text&gt;
179
                                  &lt;/oaf:accessrights&gt;
180
                                            &lt;/xsl:when&gt;
181
                                            &lt;xsl:otherwise&gt;
182
                                  &lt;oaf:accessrights&gt;
183
                                      &lt;xsl:text&gt;UNKNOWN&lt;/xsl:text&gt;
184
                                  &lt;/oaf:accessrights&gt;
185
                                            &lt;/xsl:otherwise&gt;
186
                                            &lt;/xsl:choose&gt;
187
                                    &lt;xsl:call-template name="allElements"&gt;
188
                                            &lt;xsl:with-param name="sourceElement" select="//*[local-name()='license_ref']"/&gt;
189
                                            &lt;xsl:with-param name="targetElement" select="'oaf:license'"/&gt;
190
                                    &lt;/xsl:call-template&gt;
191
                                  &lt;dr:CobjCategory&gt;
192
                                  &lt;xsl:value-of 
193
                 select="TransformationFunction:convertString($tf, //*[local-name()='type'], 'TextTypologies')" /&gt;
194
         &lt;/dr:CobjCategory&gt;
195

    
196
         &lt;oaf:dateAccepted&gt;
197
               &lt;xsl:value-of select="TransformationFunction:convertString($tf, //*[local-name()='publication_date'], 'DateISO8601')"/&gt;
198
         &lt;/oaf:dateAccepted&gt;
199

    
200

    
201
&lt;!--
202
                                    &lt;oaf:fulltext&gt;&lt;xsl:value-of select="//didl:Component/didl:Resource[@mimeType='application/pdf']/@ref"/&gt;&lt;/oaf:fulltext&gt;
203
--&gt;
204
         &lt;oaf:hostedBy&gt;
205
            &lt;xsl:attribute name="name"&gt;
206
               &lt;xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@name"/&gt;
207
            &lt;/xsl:attribute&gt;
208
            &lt;xsl:attribute name="id"&gt;
209
               &lt;xsl:value-of select="key('kCodeByName', $repoCode, $vCodes)/@id"/&gt;
210
            &lt;/xsl:attribute&gt;
211
         &lt;/oaf:hostedBy&gt;
212

    
213
&lt;!--
214
         &lt;oaf:hostedBy&gt;
215
            &lt;xsl:attribute name="name"&gt;
216
               &lt;xsl:value-of select="$varOfficialName"/&gt;
217
            &lt;/xsl:attribute&gt;
218
            &lt;xsl:attribute name="id"&gt;
219
               &lt;xsl:value-of select="$varDataSourceId"/&gt;
220
            &lt;/xsl:attribute&gt;
221
         &lt;/oaf:hostedBy&gt;
222
--&gt;
223

    
224
         &lt;oaf:collectedFrom&gt;
225
            &lt;xsl:attribute name="name"&gt;
226
               &lt;xsl:value-of select="$varOfficialName"/&gt;
227
            &lt;/xsl:attribute&gt;
228
            &lt;xsl:attribute name="id"&gt;
229
               &lt;xsl:value-of select="$varDataSourceId"/&gt;
230
            &lt;/xsl:attribute&gt;
231
         &lt;/oaf:collectedFrom&gt;
232
                                  &lt;/metadata&gt;
233
                                &lt;xsl:copy-of select="//*[local-name() = 'about']" /&gt;
234
                              &lt;/record&gt;
235

    
236
                        &lt;/xsl:template&gt;
237

    
238
         &lt;xsl:template name="allElements"&gt;
239
             &lt;xsl:param name="sourceElement"/&gt;
240
             &lt;xsl:param name="targetElement"/&gt;
241
             &lt;xsl:for-each select="$sourceElement"&gt;
242
                &lt;xsl:element name="{$targetElement}"&gt;
243
                    &lt;xsl:value-of select="normalize-space(.)"/&gt;
244
                &lt;/xsl:element&gt;
245
             &lt;/xsl:for-each&gt;
246
          &lt;/xsl:template&gt;
247

    
248

    
249
                       &lt;xsl:template match="//*[local-name() = 'header']"&gt;
250
                         &lt;xsl:copy&gt;
251
                            &lt;xsl:apply-templates  select="node()|@*"/&gt;
252
                             &lt;xsl:element name="dr:dateOfTransformation"&gt;
253
                                 &lt;xsl:value-of select="$transDate"/&gt;
254
                             &lt;/xsl:element&gt;
255
                         &lt;/xsl:copy&gt;
256
                        &lt;/xsl:template&gt;
257

    
258
&lt;!--
259
                       &lt;xsl:template match="dri:objIdentifier"&gt;
260
                         &lt;xsl:variable name="objIdentifier" select="substring-after(//*[local-name() = 'header']/*[local-name()='recordIdentifier'], ':')"/&gt;
261
                         &lt;xsl:variable name="nsPrefix" select="key('kCodeByName', $repoCode, $vCodes)/@value"/&gt;
262
                         &lt;xsl:if test="string-length($nsPrefix) = 0"&gt;
263
                                         &lt;xsl:call-template name="terminate"/&gt;
264
                         &lt;/xsl:if&gt;
265
                        &lt;xsl:copy&gt;
266
                        &lt;xsl:value-of select="concat( $nsPrefix , '::', transformExt:md5Hex(string($objIdentifier)))"/&gt;
267
                        &lt;/xsl:copy&gt;
268
                       &lt;/xsl:template&gt;
269
--&gt;
270
                       &lt;xsl:template match="node()|@*"&gt;
271
                            &lt;xsl:copy&gt;
272
                                 &lt;xsl:apply-templates select="node()|@*"/&gt;
273
                            &lt;/xsl:copy&gt;
274
                       &lt;/xsl:template&gt;
275
                    &lt;/xsl:stylesheet&gt;</CODE>
276
            </SCRIPT>
277
        </CONFIGURATION>
278
        <STATUS/>
279
        <SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
280
    </BODY>
281
</RESOURCE_PROFILE>
(84-84/84)