Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="b703be53-e2e9-4de3-ba94-210ea4a96b82_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2019-03-27T09:42:01+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>xslt_cleaning_ORP-biotools</TITLE>
14
				<CODE><![CDATA[
15
				 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:datacite="http://datacite.org/schema/kernel-4" xmlns:functx="http://www.functx.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy" xmlns:dr="http://www.driver-repository.eu/namespace/dr" exclude-result-prefixes="TransformationFunction" extension-element-prefixes="TransformationFunction" version="2.0">
16
                        <xsl:function as="xs:anyAtomicType*" name="functx:value-intersect">
17
                            <xsl:param as="xs:anyAtomicType*" name="arg1"/>
18
                            <xsl:param as="xs:anyAtomicType*" name="arg2"/>
19
                            <xsl:sequence select=" distinct-values($arg1[.=$arg2]) "/>
20
                        </xsl:function>
21
                        <xsl:param name="varOfficialName"/>
22
                        <xsl:param name="varDsType"/>
23
                        <xsl:param name="varDataSourceId"/>
24
                        <xsl:param name="index" select="0"/>
25
                        <xsl:param name="transDate" select="current-dateTime()"/>
26
                        <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
27
                        <xsl:template match="/">
28
                            <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
29
                            <xsl:call-template name="validRecord"/>
30
                        </xsl:template>
31
                        <xsl:template name="terminate">
32
                            <xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
33
        </xsl:message>
34
                        </xsl:template>
35
                        <xsl:template name="validRecord">
36
                            <record>
37
                                <xsl:apply-templates select="//*[local-name() = 'header']"/>
38
                                <metadata><!--
39
									<xsl:apply-templates select="//*[local-name() = 'metadata']//*[local-name() = 'list']"/>
40
									-->
41
                                    <datacite:resource>
42
                                        <datacite:resourceType>
43
                                            <xsl:attribute name="resourceTypeGeneral" select="'Software'"/>
44
                                            <xsl:value-of select="//*[local-name() = 'toolType']"/>
45
                                        </datacite:resourceType>
46
                                        <xsl:for-each select="//*[local-name() = 'language']">
47
                                            <datacite:format>
48
                                                <xsl:value-of select="."/>
49
                                            </datacite:format>
50
                                        </xsl:for-each><!-- DOE CODE does not state languages; projects/funding: funders not known to OpenAIRE
51
										-->
52
                                        <datacite:publisher>
53
                                            <xsl:value-of select="$varOfficialName"/>
54
                                        </datacite:publisher>
55
                                        <datacite:relatedIdentifiers>
56
                                            <xsl:for-each select="//*[local-name() = 'documentation'][not(./*[local-name() = 'type'] = ('Terms of use', 'Citation instructions', 'Contributions policy', 'Governance'))]">
57
                                                <datacite:relatedIdentifier>
58
                                                    <xsl:attribute name="relatedIdentifierType" select="'URL'"/>
59
                                                    <xsl:attribute name="relationType" select="'IsDocumentedBy'"/>
60
                                                    <xsl:value-of select="./*[local-name() = 'url']"/>
61
                                                </datacite:relatedIdentifier>
62
                                            </xsl:for-each><!-- paper references -->
63
                                            <xsl:call-template name="relatedPaper"/>
64
                                        </datacite:relatedIdentifiers>
65
                                        <datacite:alternateIdentifiers><!-- landing page, documentation, distribution -->
66
                                            <datacite:alternateIdentifier>
67
                                                <xsl:attribute name="alternateIdentifierType" select="'LandingPage'"/>
68
                                                <xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
69
                                            </datacite:alternateIdentifier><!--
70
											<xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[local-name() = 'link'][./*[local-name() = 'url' and starts-with(., 'https://github.com/')]]/*[local-name() = 'url']/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
71
											-->
72
                                            <xsl:for-each select="distinct-values((//*[local-name() = 'link'][./*[local-name() = 'type' and . = 'Repository']]/*[local-name() = 'url'], //*[starts-with(., 'https://github.com/') and contains(., concat('/', //*[local-name() = 'id']))]/replace(., '(https://github.com/[^/]*/[^/]*)(/.*)?', '$1')))">
73
                                                <datacite:alternateIdentifier>
74
                                                    <xsl:attribute name="alternateIdentifierType" select="'DistributionLocation'"/>
75
                                                    <xsl:value-of select="."/>
76
                                                </datacite:alternateIdentifier>
77
                                            </xsl:for-each><!-- identifier -->
78
                                            <datacite:alternateIdentifier>
79
                                                <xsl:attribute name="alternateIdentifierType" select="'local accession id'"/>
80
                                                <xsl:value-of select="//*[local-name() = 'id']"/>
81
                                            </datacite:alternateIdentifier>
82
                                        </datacite:alternateIdentifiers>
83
                                        <datacite:identifier>
84
                                            <xsl:attribute name="identifierType" select="'URL'"/>
85
                                            <xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'id'])"/>
86
                                        </datacite:identifier><!-- title -->
87
                                        <datacite:titles>
88
                                            <datacite:title>
89
                                                <xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
90
                                            </datacite:title>
91
                                        </datacite:titles><!-- version -->
92
                                        <xsl:if test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
93
                                            <datacite:version>
94
                                                <xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"/>
95
                                            </datacite:version>
96
                                        </xsl:if><!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
97
                                        <xsl:call-template name="authors"/>
98
                                        <datacite:contributors>
99
                                            <xsl:for-each select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
100
                                                <xsl:variable name="varContributorName" select="TransformationFunction:convertString($tf, ., 'Person')"/>
101
                                                <datacite:contributor>
102
                                                    <xsl:attribute name="contributorType" select="'ContactPerson'"/>
103
                                                    <datacite:contributorName>
104
                                                        <xsl:value-of select="$varContributorName"/>
105
                                                    </datacite:contributorName>
106
                                                    <datacite:givenName>
107
                                                        <xsl:value-of select="substring-after($varContributorName, ', ')"/>
108
                                                    </datacite:givenName>
109
                                                    <datacite:familyName>
110
                                                        <xsl:value-of select="substring-before($varContributorName, ', ')"/>
111
                                                    </datacite:familyName>
112
                                                </datacite:contributor>
113
                                            </xsl:for-each>
114
                                        </datacite:contributors>
115
                                        <datacite:descriptions>
116
                                            <datacite:description>
117
                                                <xsl:attribute name="descriptionType">
118
                                                    <xsl:value-of select="'Abstract'"/>
119
                                                </xsl:attribute>
120
                                                <xsl:value-of select="//*[local-name() = 'description']"/>
121
                                            </datacite:description><!--
122
											<xsl:for-each select="//*[local-name() = 'operatingSystem'], //*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
123
											-->
124
                                            <xsl:for-each select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
125
                                                <datacite:description>
126
                                                    <xsl:attribute name="descriptionType" select="'Abstract'"/>
127
                                                    <xsl:value-of select="."/>
128
                                                </datacite:description>
129
                                            </xsl:for-each>
130
                                            <xsl:for-each select="//*[local-name() = 'operatingSystem']">
131
                                                <datacite:description>
132
                                                    <xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
133
                                                    <xsl:value-of select="."/>
134
                                                </datacite:description>
135
                                            </xsl:for-each>
136
                                        </datacite:descriptions><!-- subject --><!-- dropping duplicate topics - funny that this seemingly works -->
137
                                        <datacite:subjects>
138
                                            <xsl:for-each select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
139
                                                <xsl:if test=".">
140
                                                    <datacite:subject>
141
                                                        <xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
142
                                                        <xsl:attribute name="schemeURI" select="'http://edamontology.org'"/>
143
                                                        <xsl:attribute name="valueURI" select="./*[local-name() = 'uri']"/>
144
                                                        <xsl:value-of select="./*[local-name() = 'term']"/>
145
                                                    </datacite:subject>
146
                                                </xsl:if>
147
                                            </xsl:for-each>
148
                                        </datacite:subjects>
149
                                    </datacite:resource><!--
150
									CobjCategory, SuperType
151
									-->
152
                                    <xsl:variable name="varCobjCategory" select="'0029'"/>
153
                                    <xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
154
                                    <dr:CobjCategory>
155
                                        <xsl:attribute name="type" select="$varSuperType"/>
156
                                        <xsl:value-of select="$varCobjCategory"/>
157
                                    </dr:CobjCategory><!--
158
									access rights, licenses
159
									-->
160
                                    <xsl:for-each select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
161
                                        <oaf:accessrights>
162
                                            <xsl:variable name="varAccessRights" select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
163
                                            <xsl:choose>
164
                                                <xsl:when test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
165
                                                    <xsl:value-of select="'OPEN SOURCE'"/>
166
                                                </xsl:when>
167
                                                <xsl:otherwise>
168
                                                    <xsl:value-of select="$varAccessRights"/>
169
                                                </xsl:otherwise>
170
                                            </xsl:choose>
171
                                        </oaf:accessrights>
172
                                    </xsl:for-each>
173
                                    <xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
174
                                        <oaf:license>
175
                                            <xsl:value-of select="."/>
176
                                        </oaf:license>
177
                                    </xsl:for-each>
178
                                    <oaf:hostedBy>
179
                                        <xsl:attribute name="name" select="$varOfficialName"/>
180
                                        <xsl:attribute name="id" select="$varDataSourceId"/>
181
                                    </oaf:hostedBy>
182
                                    <oaf:collectedFrom>
183
                                        <xsl:attribute name="name" select="$varOfficialName"/>
184
                                        <xsl:attribute name="id" select="$varDataSourceId"/>
185
                                    </oaf:collectedFrom><!--
186
									<oaf:identifier>
187
									<xsl:value-of select="//*[local-name() = 'id']"/>
188
									</oaf:identifier>
189
									-->
190
                                    <xsl:variable name="elixirGRAuthorMails" select="()"/>
191
                                    <xsl:variable name="elixirGRTools" select="('FINDbase','DruGeVar','ePGA','easyFRAP','CHRONOS','DEsubs','PICKLE','ANASTASIA','BioTranslator','metaseqR','recoup','ACT','Proteosign','BioTextQuest(+)','SCENERY','MXM','PRED-TMBB2','PRED-TAT','PRED-SIGNAL','PRED-LIPO','OMPdb','GWAR','METAGEN','DIANA-mirExTra','DIANA-mirPath','DIANA-microT','microTSS','DIANA-miRGen','DIANA-LNCBase','Network Analyzer','Variant Ranker','','GWAS Training','GprotPRED','AMYL-PRED 2','SymCurv','RNEA','BUFET','BiP finder','MR-microT&#160;','M-IOLITE','PICKLE','MESBL GC-MS metabolite peak database','3DMem-enzyme','Micro-CTvlab','g-Class','Align Paths','BPM','haplotypeAnalysisPipeline','Mutations-Meta-Analyser ','TRES','MiGA')"/>
192
                                    <xsl:variable name="authorMails" select="//credit/email"/>
193
                                    <xsl:if test="//elixirNode/text() = 'Greece' or $elixirGRTools=/list/name/text() or count(functx:value-intersect($authorMails, $elixirGRAuthorMails)) &gt; 0">
194
                                        <oaf:concept>
195
                                            <xsl:attribute name="id" select="'elixir-gr'"/>
196
                                        </oaf:concept>
197
                                    </xsl:if><!-- date -->
198
                                    <oaf:dateAccepted>
199
                                        <xsl:value-of select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
200
                                    </oaf:dateAccepted>
201
                                </metadata>
202
                                <xsl:copy-of select="//*[local-name() = 'about']"/>
203
                            </record>
204
                        </xsl:template>
205
                        <xsl:template match="node() | @*">
206
                            <xsl:copy>
207
                                <xsl:apply-templates select="node() | @*"/>
208
                            </xsl:copy>
209
                        </xsl:template>
210
                        <xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
211
                            <xsl:copy>
212
                                <xsl:apply-templates select="node() | @*"/>
213
                            </xsl:copy>
214
                        </xsl:template>
215
                        <xsl:template match="//*[local-name() = 'header']">
216
                            <xsl:copy>
217
                                <xsl:apply-templates select="node() | @*"/>
218
                                <xsl:element name="dr:dateOfTransformation">
219
                                    <xsl:value-of select="$transDate"/>
220
                                </xsl:element>
221
                            </xsl:copy>
222
                        </xsl:template>
223
                        <xsl:template name="authors"><!-- Allowed roles :
224
            Developer
225
            Maintainer
226
            Provider
227
            Documentor
228
            Contributor
229
            Support
230
            Primary contact
231
            We'll consider Developer and Primary Contact as authors.
232
        -->
233
                            <xsl:choose>
234
                                <xsl:when test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]][./*[local-name() = 'name' and not(. = 'null')]])">
235
                                    <xsl:call-template name="terminate"/>
236
                                </xsl:when>
237
                                <xsl:otherwise>
238
                                    <creators>
239
                                        <xsl:for-each select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]]/*[local-name() = 'name' and not(. = 'null')]">
240
                                            <xsl:for-each select="tokenize(., ', ')">
241
                                                <xsl:variable name="varDeveloperName" select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
242
                                                <creator>
243
                                                    <creatorName>
244
                                                        <xsl:value-of select="$varDeveloperName"/>
245
                                                    </creatorName>
246
                                                    <givenName>
247
                                                        <xsl:value-of select="substring-after($varDeveloperName, ', ')"/>
248
                                                    </givenName>
249
                                                    <familyName>
250
                                                        <xsl:value-of select="substring-before($varDeveloperName, ', ')"/>
251
                                                    </familyName>
252
                                                </creator>
253
                                            </xsl:for-each>
254
                                        </xsl:for-each>
255
                                    </creators>
256
                                </xsl:otherwise>
257
                            </xsl:choose>
258
                        </xsl:template><!--
259
						<xsl:template match="//*[local-name() = 'DOI']">
260
						-->
261
                        <xsl:template name="relatedPaper">
262
                            <xsl:for-each select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
263
                                <xsl:element name="datacite:relatedIdentifier">
264
                                    <xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
265
                                    <xsl:attribute name="relationType">
266
                                        <xsl:choose>
267
                                            <xsl:when test="../*[local-name() = 'type'] = 'Primary'">
268
                                                <xsl:value-of select="'isSupplementTo'"/>
269
                                            </xsl:when>
270
                                            <xsl:when test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
271
                                                <xsl:value-of select="'isReviewedBy'"/>
272
                                            </xsl:when>
273
                                            <xsl:when test="../*[local-name() = 'type'] = 'Usage'">
274
                                                <xsl:value-of select="'isReferencedBy'"/>
275
                                            </xsl:when>
276
                                            <xsl:when test="../*[local-name() = 'type'] = 'Method'">
277
                                                <xsl:value-of select="'references'"/>
278
                                            </xsl:when>
279
                                            <xsl:otherwise>
280
                                                <xsl:value-of select="'isReferencedBy'"/>
281
                                            </xsl:otherwise>
282
                                        </xsl:choose>
283
                                    </xsl:attribute>
284
                                    <xsl:value-of select="."/>
285
                                </xsl:element>
286
                            </xsl:for-each>
287
                        </xsl:template>
288
                    </xsl:stylesheet>
289
]]>
290
				</CODE>
291
			</SCRIPT>
292
		</CONFIGURATION>
293
		<STATUS/>
294
		<SECURITY_PARAMETERS/>
295
	</BODY>
296
</RESOURCE_PROFILE>
(51-51/54)