Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<RESOURCE_PROFILE>
3
	<HEADER>
4
		<RESOURCE_IDENTIFIER value="eab4c820-e11f-4406-8b01-d31cfcccdf5f_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
5
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
6
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
7
		<RESOURCE_URI value=""/>
8
		<DATE_OF_CREATION value="2016-05-08T23:27:01+01:00"/>
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<IMPORTED/>
13
			<SCRIPT>
14
				<TITLE>xslt_opentrials_datacite</TITLE>
15
				<CODE>
16
					<![CDATA[
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
18
    xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:oaf="http://namespace.openaire.eu/oaf"
19
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
20
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
21
    xmlns:openTrials="eu.dnetlib.data.transform.xml.OpenTrialsXsltFunctions"
22
    xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="openTrials date"
23
    exclude-result-prefixes="xsl">
24

    
25
    <xsl:output indent="yes"/>
26
    <xsl:param name="varOfficialName"/>
27
    <xsl:param name="varDataSourceId"/>
28

    
29
    <xsl:template match="/">
30
        <xsl:call-template name="createRecord"/>
31
    </xsl:template>
32

    
33
    <xsl:template name="createRecord">
34
        <oai:record>
35
            <oai:header>
36
                <xsl:copy-of select="//*[local-name() = 'header']/*" copy-namespaces="no"/>
37
                <dr:dateOfTransformation>
38
                    <xsl:value-of select="date:date-time()"/>
39
                </dr:dateOfTransformation>
40
            </oai:header>
41
            <oai:metadata>
42
                <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
43
                    xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
44
                    xmlns="http://datacite.org/schema/kernel-3">
45
                    <!--
46
                        In order to the web URL to be properly set in the OAF final record, the main id must be an URL.
47
                        Primary and secondary ids + identifiers can be set as alternate identifiers
48
                    -->
49
                    <identifier identifierType="URL">
50
                        <xsl:value-of
51
                            select="openTrials:getMainIdentifierURL(//column[@name = 'jsonprov']/text())"/>
52
                    </identifier>
53
                    <xsl:variable name="primaryId" select="//column[./@name = 'primary_id']/text()"/>
54
                    <alternateIdentifiers>
55
                        <alternateIdentifier
56
                            alternateIdentifierType="{//column[./@name='primary_register']/text()}">
57
                            <xsl:value-of select="$primaryId"/>
58
                        </alternateIdentifier>
59
                        <!--
60
                        TODO: handle other ids in alternateIdentifiers. For now secondary_ids are not of our concern (as said by Evgeny from OpenTrials)
61
                        But identifiers is relevant instead.
62
                        <column name="secondary_ids">{"others": null}</column>
63
                        <column name="identifiers">{NCT00972270, XXX}</column>
64
                        -->
65
                        <!-- remove '{' and '}' -->
66
                        <xsl:variable name="cleanedIds"
67
                            select="replace(replace(//column[@name = 'identifiers'], '\{', ''), '\}', '')"/>
68
                        <xsl:for-each select="tokenize($cleanedIds, ',')">
69
                            <xsl:if test="not(. = $primaryId)">
70
                            <alternateIdentifier>
71
                                <xsl:value-of select="normalize-space(.)"/>
72
                            </alternateIdentifier>
73
                            </xsl:if>
74
                        </xsl:for-each>
75
                    </alternateIdentifiers>
76
                    <!-- No creators available -->
77
                    <creators/>
78
                    <titles>
79
                        <xsl:variable name="scientificTitle"
80
                            select="normalize-space(//column[@name = 'scientific_title'])"/>
81
                        <xsl:variable name="publicTitle"
82
                            select="normalize-space(//column[@name = 'public_title'])"/>
83
                        <xsl:if test="string-length($scientificTitle) &gt; 0">
84
                            <title>
85
                                <xsl:value-of select="$scientificTitle"/>
86
                            </title>
87
                        </xsl:if>
88
                        <xsl:if test="string-length($publicTitle) &gt; 0">
89
                            <title>
90
                                <xsl:value-of select="$publicTitle"/>
91
                            </title>
92
                        </xsl:if>
93
                    </titles>
94
                    <publisher>
95
                        <xsl:value-of select="//column[./@name = 'primary_register']/text()"/>
96
                    </publisher>
97
                    <resourceType resourceTypeGeneral="Trial">Trial</resourceType>
98
                    <descriptions>
99
                        <xsl:variable name="description"
100
                            select="normalize-space(//column[@name = 'description'])"/>
101
                        <xsl:variable name="summary"
102
                            select="normalize-space(//column[@name = 'brief_summary'])"/>
103
                        <xsl:if test="string-length($description) &gt; 0">
104
                            <description descriptionType="Abstract">
105
                                <xsl:value-of select="$description"/>
106
                            </description>
107
                        </xsl:if>
108
                        <xsl:if test="string-length($summary) &gt; 0">
109
                            <description descriptionType="Abstract">
110
                                <xsl:value-of select="$summary"/>
111
                            </description>
112
                        </xsl:if>
113
                    </descriptions>
114
                    <xsl:if test="string-length(//column[@name = 'target_sample_size']) &gt; 0">
115
                        <sizes>
116
                            <size>
117
                                <xsl:value-of
118
                                    select="concat('Target sample size: ', //column[@name = 'target_sample_size'])"
119
                                />
120
                            </size>
121
                        </sizes>
122
                    </xsl:if>
123
                    <oaf:accessrights>UNKNOWN</oaf:accessrights>
124
                    <dr:CobjCategory>0021</dr:CobjCategory>
125
                    <oaf:dateAccepted>
126
                        <xsl:value-of select="//column[@name = 'registration_date']"/>
127
                    </oaf:dateAccepted>
128
                    <!-- We'll need to do something to patch it, if possible, looking at the jsonProv source name and id -->
129
                    <oaf:hostedBy id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18"
130
                        name="Unknown Repository"/>
131
                    <oaf:collectedFrom>
132
                        <xsl:attribute name="name">
133
                            <xsl:value-of select="$varOfficialName"/>
134
                        </xsl:attribute>
135
                        <xsl:attribute name="id">
136
                            <xsl:value-of select="$varDataSourceId"/>
137
                        </xsl:attribute>
138
                    </oaf:collectedFrom>
139
                    <oaf:about>
140
                        <oaf:datainfo>
141
                            <oaf:inferred>false</oaf:inferred>
142
                            <oaf:deletedbyinference>false</oaf:deletedbyinference>
143
                            <oaf:trust>0.9</oaf:trust>
144
                            <oaf:inferenceprovenance/>
145
                            <oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
146
                                classname="sysimport:crosswalk:datasetarchive"
147
                                schemeid="dnet:provenanceActions"
148
                                schemename="dnet:provenanceActions"/>
149
                        </oaf:datainfo>
150
                    </oaf:about>
151
                </resource>
152
            </oai:metadata>
153
            <xsl:copy-of select="//*[local-name() = 'about']"/>
154
        </oai:record>
155
    </xsl:template>
156
</xsl:stylesheet>
157

    
158
]]>
159
</CODE>
160
			</SCRIPT>
161
		</CONFIGURATION>
162
		<STATUS/>
163
		<SECURITY_PARAMETERS/>
164
	</BODY>
165
</RESOURCE_PROFILE>
166

    
(57-57/69)