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>
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() = 'biotoolsID'])"/>
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
	                                        <!--
73
                                            <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')))">
74
                                                <datacite:alternateIdentifier>
75
                                                    <xsl:attribute name="alternateIdentifierType" select="'DistributionLocation'"/>
76
                                                    <xsl:value-of select="."/>
77
                                                </datacite:alternateIdentifier>
78

    
79
                                            </xsl:for-each>--><!-- identifier -->
80
                                            <datacite:alternateIdentifier>
81
                                                <xsl:attribute name="alternateIdentifierType" select="'biotoolsID'"/>
82
                                                <xsl:value-of select="//*[local-name() = 'biotoolsID']"/>
83
                                            </datacite:alternateIdentifier>
84
                                        </datacite:alternateIdentifiers>
85
                                        <datacite:identifier>
86
                                            <xsl:attribute name="identifierType" select="'URL'"/>
87
                                            <xsl:value-of select="concat('https://bio.tools/', //*[local-name() = 'biotoolsID'])"/>
88
                                        </datacite:identifier><!-- title -->
89
                                        <datacite:titles>
90
                                            <datacite:title>
91
                                                <xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'name']"/>
92
                                            </datacite:title>
93
                                        </datacite:titles><!-- version -->
94
                                        <xsl:if test="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]">
95
                                            <datacite:version>
96
                                                <xsl:value-of select="//*[local-name() = 'list']/*[local-name() = 'version'][not(. = 'null')]"/>
97
                                            </datacite:version>
98
                                        </xsl:if><!-- bio.tools' credit/typeRole Developer/... is not identical with statements on GitHub ??? (Scoary) -->
99
                                        <xsl:call-template name="authors"/>
100
                                        <datacite:contributors>
101
                                            <xsl:for-each select="//*[local-name() = 'contact']/*[local-name() = 'name' and not(. = 'null')]">
102
                                                <xsl:variable name="varContributorName" select="TransformationFunction:convertString($tf, ., 'Person')"/>
103
                                                <datacite:contributor>
104
                                                    <xsl:attribute name="contributorType" select="'ContactPerson'"/>
105
                                                    <datacite:contributorName>
106
                                                        <xsl:value-of select="$varContributorName"/>
107
                                                    </datacite:contributorName>
108
                                                    <datacite:givenName>
109
                                                        <xsl:value-of select="substring-after($varContributorName, ', ')"/>
110
                                                    </datacite:givenName>
111
                                                    <datacite:familyName>
112
                                                        <xsl:value-of select="substring-before($varContributorName, ', ')"/>
113
                                                    </datacite:familyName>
114
                                                </datacite:contributor>
115
                                            </xsl:for-each>
116
                                        </datacite:contributors>
117
                                        <datacite:descriptions>
118
                                            <datacite:description>
119
                                                <xsl:attribute name="descriptionType">
120
                                                    <xsl:value-of select="'Abstract'"/>
121
                                                </xsl:attribute>
122
                                                <xsl:value-of select="//*[local-name() = 'description']"/>
123
                                            </datacite:description><!--
124
											<xsl:for-each select="//*[local-name() = 'operatingSystem'], //*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
125
											-->
126
                                            <xsl:for-each select="//*[local-name() = 'function']/*[local-name() = 'comment' and not(. = 'null')]">
127
                                                <datacite:description>
128
                                                    <xsl:attribute name="descriptionType" select="'Abstract'"/>
129
                                                    <xsl:value-of select="."/>
130
                                                </datacite:description>
131
                                            </xsl:for-each>
132
                                            <xsl:for-each select="//*[local-name() = 'operatingSystem']">
133
                                                <datacite:description>
134
                                                    <xsl:attribute name="descriptionType" select="'TechnicalInfo'"/>
135
                                                    <xsl:value-of select="."/>
136
                                                </datacite:description>
137
                                            </xsl:for-each>
138
                                        </datacite:descriptions><!-- subject --><!-- dropping duplicate topics - funny that this seemingly works -->
139
                                        <datacite:subjects>
140
                                            <xsl:for-each select="//*[local-name() = 'topic'][index-of(distinct-values(//*[local-name() = 'topic']/*[local-name() = 'uri']), ./*[local-name() = 'uri'])]">
141
                                                <xsl:if test=".">
142
                                                    <datacite:subject>
143
                                                        <xsl:attribute name="subjectScheme" select="'EDAM Ontology'"/>
144
                                                        <xsl:attribute name="schemeURI" select="'http://edamontology.org'"/>
145
                                                        <xsl:attribute name="valueURI" select="./*[local-name() = 'uri']"/>
146
                                                        <xsl:value-of select="./*[local-name() = 'term']"/>
147
                                                    </datacite:subject>
148
                                                </xsl:if>
149
                                            </xsl:for-each>
150
                                        </datacite:subjects>
151
                                    </datacite:resource><!--
152
									CobjCategory, SuperType
153
									-->
154
                                    <xsl:variable name="varCobjCategory" select="'0029'"/>
155
                                    <xsl:variable name="varSuperType" select="TransformationFunction:convertString($tf, $varCobjCategory, 'SuperTypes')"/>
156
                                    <dr:CobjCategory>
157
                                        <xsl:attribute name="type" select="$varSuperType"/>
158
                                        <xsl:value-of select="$varCobjCategory"/>
159
                                    </dr:CobjCategory><!--
160
									access rights, licenses
161
									-->
162
                                    <xsl:for-each select="//*[local-name() = ('license', 'accessibility') and not(. = 'null')]">
163
                                        <oaf:accessrights>
164
                                            <xsl:variable name="varAccessRights" select="TransformationFunction:convertString($tf, ., 'AccessRights')"/>
165
                                            <xsl:choose>
166
                                                <xsl:when test="$varAccessRights = ('OPEN', 'OPEN SOURCE') and $varSuperType = 'software'">
167
                                                    <xsl:value-of select="'OPEN SOURCE'"/>
168
                                                </xsl:when>
169
                                                <xsl:otherwise>
170
                                                    <xsl:value-of select="$varAccessRights"/>
171
                                                </xsl:otherwise>
172
                                            </xsl:choose>
173
                                        </oaf:accessrights>
174
                                    </xsl:for-each>
175
                                    <xsl:for-each select="//*[local-name() = 'license' and not(. = 'null')]">
176
                                        <oaf:license>
177
                                            <xsl:value-of select="."/>
178
                                        </oaf:license>
179
                                    </xsl:for-each>
180
                                    <oaf:hostedBy>
181
                                        <xsl:attribute name="name" select="$varOfficialName"/>
182
                                        <xsl:attribute name="id" select="$varDataSourceId"/>
183
                                    </oaf:hostedBy>
184
                                    <oaf:collectedFrom>
185
                                        <xsl:attribute name="name" select="$varOfficialName"/>
186
                                        <xsl:attribute name="id" select="$varDataSourceId"/>
187
                                    </oaf:collectedFrom><!--
188
									<oaf:identifier>
189
									<xsl:value-of select="//*[local-name() = 'id']"/>
190
									</oaf:identifier>
191
									-->
192
                                    <xsl:variable name="elixirGRAuthorMails" select="()"/>
193
                                    <xsl:variable name="elixirGRTools" select="('3DMem-enzyme','ACT','Align Paths','AMYL-PRED 2','ANASTASIA','BioTextQuest(+)','BioTranslator','BiP finder','BPM','BUFET','CHRONOS','DEsubs','DIANA-LNCBase','DIANA-microT','DIANA-mirExTra','DIANA-mirExTra v2.0','DIANA-miRGen','DIANA-miRGen v3.0','DIANA-mirPath','DIANA-miRPath v3','DruGeVar','easyFRAP','ePGA','FINDbase','g-Class','G-Class','GprotPRED','GWAR','GWAS Training','haplotypeAnalysisPipeline','M-IOLITE','MESBL GC-MS metabolite peak database','METAGEN','metaseqR','Micro-CTvlab','microTSS','MiGA','mirPub','MR-microT','MR-microT','Mutations-Meta-Analyser','Mutations-Meta-Analyser ','MXM','Network Analyzer','OMPdb','PICKLE','PRED-LIPO','PRED-SIGNAL','PRED-TAT','PRED-TMBB2','Proteosign','recoup','RNEA','SCENERY','SymCurv','TRES','Variant Ranker')"/>
194
                                    <xsl:variable name="authorMails" select="//credit/email"/>
195
                                    <xsl:if test="//elixirNode/text() = 'Greece' or $elixirGRTools=/list/name/text() or count(functx:value-intersect($authorMails, $elixirGRAuthorMails)) &gt; 0">
196
                                        <oaf:concept>
197
                                            <xsl:attribute name="id" select="'elixir-gr'"/>
198
                                        </oaf:concept>
199
                                    </xsl:if><!-- date -->
200
                                    <oaf:dateAccepted>
201
                                        <xsl:value-of select="//*[local-name() = 'additionDate']/substring-before(., 'T')"/>
202
                                    </oaf:dateAccepted>
203
                                </metadata>
204
                                <xsl:copy-of select="//*[local-name() = 'about']"/>
205
                            </record>
206
                        </xsl:template>
207
                        <xsl:template match="node() | @*">
208
                            <xsl:copy>
209
                                <xsl:apply-templates select="node() | @*"/>
210
                            </xsl:copy>
211
                        </xsl:template>
212
                        <xsl:template match="//*[local-name() = 'metadata']//*[local-name() = 'resource']">
213
                            <xsl:copy>
214
                                <xsl:apply-templates select="node() | @*"/>
215
                            </xsl:copy>
216
                        </xsl:template>
217
                        <xsl:template match="//*[local-name() = 'header']">
218
                            <xsl:copy>
219
                                <xsl:apply-templates select="node() | @*"/>
220
                                <xsl:element name="dr:dateOfTransformation">
221
                                    <xsl:value-of select="$transDate"/>
222
                                </xsl:element>
223
                            </xsl:copy>
224
                        </xsl:template>
225
                        <xsl:template name="authors"><!-- Allowed roles :
226
            Developer
227
            Maintainer
228
            Provider
229
            Documentor
230
            Contributor
231
            Support
232
            Primary contact
233
            We'll consider Developer and Primary Contact as authors.
234
        -->
235
                            <xsl:choose>
236
                                <xsl:when test="not(//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]][./*[local-name() = 'name' and not(. = 'null')]])">
237
                                    <xsl:call-template name="terminate"/>
238
                                </xsl:when>
239
                                <xsl:otherwise>
240
                                    <creators>
241
                                        <xsl:for-each select="//*[local-name() = 'credit'][./*[local-name() = 'typeRole' and (. = 'Developer' or . = 'Primary contact')]]/*[local-name() = 'name' and not(. = 'null')]">
242
                                            <xsl:for-each select="tokenize(., ', ')">
243
                                                <xsl:variable name="varDeveloperName" select="TransformationFunction:convertString($tf, normalize-space(.), 'Person')"/>
244
                                                <creator>
245
                                                    <creatorName>
246
                                                        <xsl:value-of select="$varDeveloperName"/>
247
                                                    </creatorName>
248
                                                    <givenName>
249
                                                        <xsl:value-of select="substring-after($varDeveloperName, ', ')"/>
250
                                                    </givenName>
251
                                                    <familyName>
252
                                                        <xsl:value-of select="substring-before($varDeveloperName, ', ')"/>
253
                                                    </familyName>
254
                                                </creator>
255
                                            </xsl:for-each>
256
                                        </xsl:for-each>
257
                                    </creators>
258
                                </xsl:otherwise>
259
                            </xsl:choose>
260
                        </xsl:template><!--
261
						<xsl:template match="//*[local-name() = 'DOI']">
262
						-->
263
                        <xsl:template name="relatedPaper">
264
                            <xsl:for-each select="//*[local-name() = 'publication']/*[local-name() = ('doi', 'pmid', 'pmcid') and not(. = 'null')]">
265
                                <xsl:element name="datacite:relatedIdentifier">
266
                                    <xsl:attribute name="relatedIdentifierType" select="upper-case(local-name())"/>
267
                                    <xsl:attribute name="relationType">
268
                                        <xsl:choose>
269
                                            <xsl:when test="../*[local-name() = 'type'] = 'Primary'">
270
                                                <xsl:value-of select="'isSupplementTo'"/>
271
                                            </xsl:when>
272
                                            <xsl:when test="../*[local-name() = 'type'] = ('Review', 'Benchmark', 'Comparison')">
273
                                                <xsl:value-of select="'isReviewedBy'"/>
274
                                            </xsl:when>
275
                                            <xsl:when test="../*[local-name() = 'type'] = 'Usage'">
276
                                                <xsl:value-of select="'isReferencedBy'"/>
277
                                            </xsl:when>
278
                                            <xsl:when test="../*[local-name() = 'type'] = 'Method'">
279
                                                <xsl:value-of select="'references'"/>
280
                                            </xsl:when>
281
                                            <xsl:otherwise>
282
                                                <xsl:value-of select="'isReferencedBy'"/>
283
                                            </xsl:otherwise>
284
                                        </xsl:choose>
285
                                    </xsl:attribute>
286
                                    <xsl:value-of select="."/>
287
                                </xsl:element>
288
                            </xsl:for-each>
289
                        </xsl:template>
290
                    </xsl:stylesheet>
291
				</CODE>
292
			</SCRIPT>
293
		</CONFIGURATION>
294
		<STATUS/>
295
		<SECURITY_PARAMETERS/>
296
	</BODY>
297
</RESOURCE_PROFILE>
(52-52/56)