Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="eab4c820-e11f-4406-8b01-d31cfcccdf5f_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2017-07-11T08:33:04+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<IMPORTED/>
12
			<SCRIPT>
13
				<TITLE>xslt_opentrials_datacite</TITLE>
14
				<CODE>
15
					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:openTrials="eu.dnetlib.data.transform.xml.OpenTrialsXsltFunctions" xmlns:dr="http://www.driver-repository.eu/namespace/dr" exclude-result-prefixes="xsl" extension-element-prefixes="openTrials date" version="2.0">
16
						<xsl:output indent="yes"/>
17
						<xsl:param name="varOfficialName"/>
18
						<xsl:param name="varDataSourceId"/>
19
						<xsl:param name="quote">"</xsl:param>
20
						<xsl:variable name="baseURL" select="string('http://explorer.opentrials.net/trials/')"/>
21
						<xsl:template match="/">
22
							<xsl:call-template name="createRecord"/>
23
						</xsl:template>
24
						<xsl:template name="createRecord">
25
							<xsl:variable name="opentrialID" select="//column[./@name = 'id']/text()"/>
26
							<oai:record>
27
								<oai:header>
28
									<xsl:copy-of copy-namespaces="no" select="//*[local-name() = 'header']/*"/>
29
									<dr:dateOfTransformation>
30
										<xsl:value-of select="date:date-time()"/>
31
									</dr:dateOfTransformation>
32
								</oai:header>
33
								<oai:metadata>
34
									<resource xmlns="http://datacite.org/schema/kernel-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"><!--
35
                        In order to the web URL to be properly set in the OAF final record, the main id must be an URL.
36
                        Primary and secondary ids + identifiers can be set as alternate identifiers.
37
                        We want the URL to be the OpenTrial URL
38
                    --><!--
39
                    <identifier identifierType="URL">
40
                        <xsl:value-of select="concat($baseURL, $opentrialID)"/>
41
                    </identifier>
42
                    --><!-- Temporary using the original URL of the trial because OpenTrials changed ids -->
43
										<identifier identifierType="URL">
44
											<xsl:value-of select="openTrials:getPrimaryRecordUrl(//column[@name = 'records']/text())"/>
45
										</identifier>
46
										<xsl:variable name="primaryId" select="openTrials:getPrimaryRecordIdentifier(//column[./@name = 'records']/text())"/>
47
										<alternateIdentifiers>
48
											<xsl:variable name="urls" select="openTrials:getNotPrimaryRecordUrl(//column[./@name = 'records']/text())"/>
49
											<xsl:for-each select="tokenize($urls,'@@')">
50
												<alternateIdentifier alternateIdentifierType="URL">
51
													<xsl:value-of select="normalize-space(translate(.,$quote,''))"/>
52
												</alternateIdentifier>
53
											</xsl:for-each><!-- remove '{' and '}' -->
54
											<xsl:variable name="cleanedIds" select="replace(replace(//column[@name = 'identifiers'], '\{', ''), '\}', '')"/>
55
											<xsl:for-each select="tokenize($cleanedIds, ',')">
56
												<xsl:variable name="pair" select="tokenize(.,':')"/>
57
												<alternateIdentifier alternateIdentifierType="{translate($pair[1],$quote,'')}">
58
													<xsl:value-of select="normalize-space(translate($pair[2],$quote,''))"/>
59
												</alternateIdentifier>
60
											</xsl:for-each>
61
										</alternateIdentifiers>
62
										<xsl:variable name="people" select="openTrials:getPrincipalInvestigators(//column[@name = 'people']/text())"/>
63
										<xsl:choose>
64
											<xsl:when test="string-length($people) &gt; 0">
65
												<creators>
66
													<xsl:for-each select="tokenize($people,'@@')">
67
														<creator>
68
															<creatorName>
69
																<xsl:value-of select="normalize-space(.)"/>
70
															</creatorName>
71
														</creator>
72
													</xsl:for-each>
73
												</creators>
74
											</xsl:when>
75
											<xsl:otherwise>
76
												<creators/>
77
											</xsl:otherwise>
78
										</xsl:choose>
79
										<xsl:variable name="organizations" select="openTrials:getTrialOrganizations(//column[@name = 'organisations']/text())"/>
80
										<xsl:if test="string-length($organizations) &gt; 0">
81
											<xsl:for-each select="tokenize($organizations,'@@')">
82
												<xsl:variable name="pair" select="tokenize(.,'@')"/>
83
												<contributor contributorType="{translate($pair[2],$quote,'')}">
84
													<contributorName>
85
														<xsl:value-of select="normalize-space(translate($pair[1],$quote,''))"/>
86
													</contributorName>
87
												</contributor>
88
											</xsl:for-each>
89
										</xsl:if>
90
										<titles>
91
											<xsl:variable name="scientificTitle" select="normalize-space(//column[@name = 'scientific_title'])"/>
92
											<xsl:variable name="publicTitle" select="normalize-space(//column[@name = 'public_title'])"/>
93
											<xsl:if test="string-length($scientificTitle) &gt; 0">
94
												<title>
95
													<xsl:value-of select="$scientificTitle"/>
96
												</title>
97
											</xsl:if>
98
											<xsl:if test="(string-length($publicTitle) &gt; 0) and (normalize-space($scientificTitle) != normalize-space($publicTitle))">
99
												<title>
100
													<xsl:value-of select="$publicTitle"/>
101
												</title>
102
											</xsl:if>
103
										</titles>
104
										<publisher>
105
											<xsl:value-of select="$primaryId"/>
106
										</publisher>
107
										<xsl:variable name="locations" select="openTrials:getTrialLocations(//column[@name = 'locations']/text())"/>
108
										<xsl:if test="string-length($locations) &gt; 0">
109
											<geoLocations>
110
												<xsl:for-each select="tokenize($locations,'@@')">
111
													<geoLocationPlace>
112
														<xsl:value-of select="normalize-space(translate(.,$quote,''))"/>
113
													</geoLocationPlace>
114
												</xsl:for-each>
115
											</geoLocations>
116
										</xsl:if>
117
										<resourceType resourceTypeGeneral="clinicalTrial">0037</resourceType>
118
										<descriptions>
119
											<xsl:variable name="description" select="normalize-space(//column[@name = 'description'])"/>
120
											<xsl:variable name="summary" select="normalize-space(//column[@name = 'brief_summary'])"/>
121
											<xsl:if test="string-length($description) &gt; 0">
122
												<description descriptionType="Abstract">
123
													<xsl:value-of select="$description"/>
124
												</description>
125
											</xsl:if>
126
											<xsl:if test="string-length($summary) &gt; 0">
127
												<description descriptionType="Abstract">
128
													<xsl:value-of select="$summary"/>
129
												</description>
130
											</xsl:if>
131
										</descriptions><!--     <xsl:if test="string-length(//column[@name = 'target_sample_size']) > 0">
132
                                            <sizes>
133
                                                <size>
134
                                                    <xsl:value-of select="concat('Target sample size: ', //column[@name = 'target_sample_size'])"/>
135
                                                </size>
136
                                            </sizes>
137
                                        </xsl:if>-->
138

    
139
									</resource>
140
									<oaf:accessrights>OPEN</oaf:accessrights>
141
									<dr:CobjCategory type="dataset">0037</dr:CobjCategory>
142
									<oaf:dateAccepted>
143
										<xsl:value-of select="//column[@name = 'registration_date']"/>
144
									</oaf:dateAccepted><!-- We'll need to do something to patch it, if possible, looking at the jsonProv source name and id -->
145
									<oaf:hostedBy>
146
										<xsl:attribute name="name">
147
											<xsl:value-of select="$varOfficialName"/>
148
										</xsl:attribute>
149
										<xsl:attribute name="id">
150
											<xsl:value-of select="$varDataSourceId"/>
151
										</xsl:attribute>
152
									</oaf:hostedBy>
153
									<oaf:collectedFrom>
154
										<xsl:attribute name="name">
155
											<xsl:value-of select="$varOfficialName"/>
156
										</xsl:attribute>
157
										<xsl:attribute name="id">
158
											<xsl:value-of select="$varDataSourceId"/>
159
										</xsl:attribute>
160
									</oaf:collectedFrom>
161
									<oaf:about>
162
										<oaf:datainfo>
163
											<oaf:inferred>false</oaf:inferred>
164
											<oaf:deletedbyinference>false</oaf:deletedbyinference>
165
											<oaf:trust>0.9</oaf:trust>
166
											<oaf:inferenceprovenance/>
167
											<oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive" classname="sysimport:crosswalk:datasetarchive" schemeid="dnet:provenanceActions" schemename="dnet:provenanceActions"/>
168
										</oaf:datainfo>
169
									</oaf:about>
170
								</oai:metadata>
171
								<xsl:copy-of select="//*[local-name() = 'about']"/>
172
							</oai:record>
173
						</xsl:template>
174
					</xsl:stylesheet>
175
				</CODE>
176
			</SCRIPT>
177
		</CONFIGURATION>
178
		<STATUS/>
179
		<SECURITY_PARAMETERS/>
180
	</BODY>
181
</RESOURCE_PROFILE>
(5-5/8)