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="2014-01-08T23:27:01+01:00"/>
9
	</HEADER>
10
	<BODY>
11
		<CONFIGURATION>
12
			<IMPORTED/>
13
			<SCRIPT>
14
				<TITLE>xslt_opentrials_datacite</TITLE>
15
				<CODE><![CDATA[
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
17
    xmlns:oai="http://www.openarchives.org/OAI/2.0/" xmlns:oaf="http://namespace.openaire.eu/oaf"
18
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
19
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
    xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
21
    xmlns:openTrials="eu.dnetlib.miscutils.functional.xml.OpenTrialsFunctions"
22
    extension-element-prefixes="TransformationFunction openTrials"
23
    exclude-result-prefixes="xsl TransformationFunction openTrials">
24

    
25
    <xsl:param name="varOfficialName"/>
26
    <xsl:param name="varDsType"/>
27
    <xsl:param name="varDataSourceId"/>
28

    
29
    <xsl:param name="index" select="0"/>
30
    <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>
31

    
32
    <xsl:template match="/">
33
        <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
34
        <xsl:call-template name="createRecord"/>
35
    </xsl:template>
36

    
37
    <xsl:template name="createRecord">
38
        <oai:record>
39
            <oai:header>
40
                <xsl:copy-of select="//*[local-name() = 'header']/*" copy-namespaces="no"/>
41
                <dr:dateOfTransformation>
42
                    <xsl:value-of select="current-dateTime()"/>
43
                </dr:dateOfTransformation>
44
            </oai:header>
45

    
46
            <oai:metadata>
47
                <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
48
                    xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd"
49
                    xmlns="http://datacite.org/schema/kernel-3">
50

    
51
                    <!--
52
                        In order to the web URL to be properly set in the OAF final record, the main id must be an URL.
53
                        Primary and secondary ids + identifiers can be set as alternate identifiers
54
                    -->
55
                    <identifier identifierType="URL"> <xsl:value-of select="openTrials:getMainIdentifierURL(//column[@name = 'jsonProv']))"/></identifier>
56

    
57

    
58
                    <alternateIdentifiers>
59
                        <alternateIdentifier alternateIdentifierType="{//column[./@name='primary_register']/text()}">
60
                            <xsl:value-of select="//column[./@name = 'primary_id']/text()"/>
61
                        </alternateIdentifier>
62
                        <!--
63
                        TODO: handle other ids in alternateIdentifiers. For now secondary_ids are not of our concern (as said by Evgeny from OpenTrials)
64
                        But identifiers is relevant instead.
65
                        <column name="secondary_ids">{"others": null}</column>
66
                        <column name="identifiers">{NCT00972270, XXX}</column>
67
                        -->
68
                        <!-- remove '{' and '}' -->
69
                        <xsl:variable name="cleanedIds" select="replace(replace(//column[@name = 'identifiers'], '{', ''), '}', '')">
70
                        <xsl:for-each select="tokenize(cleanedIds,',')">
71
                            <alternateIdentifier><xsl:value-of select="normalize-space(.)"/></alternateIdentifier>
72
                        </xsl:for-each>
73
                    </alternateIdentifiers>
74
                    <!-- No creators available -->
75
                    <creators/>
76
                    <titles>
77
                        <xsl:variable name="scientificTitle"
78
                            select="normalize-space(//column[@name = 'scientific_title'])"/>
79
                        <xsl:variable name="publicTitle"
80
                            select="normalize-space(//column[@name = 'public_title'])"/>
81
                        <xsl:if test="string-length($scientificTitle) &gt; 0">
82
                            <title>
83
                                <xsl:value-of select="$scientificTitle"/>
84
                            </title>
85
                        </xsl:if>
86
                        <xsl:if test="string-length($publicTitle) &gt; 0">
87
                            <title>
88
                                <xsl:value-of select="$publicTitle"/>
89
                            </title>
90
                        </xsl:if>
91
                    </titles>
92
                    <publisher><xsl:value-of select="//column[./@name='primary_register']/text()"/></publisher>
93
                    <resourceType resourceTypeGeneral="Trial">Trial</resourceType>
94
                    <descriptions>
95
                        <xsl:variable name="description"
96
                            select="normalize-space(//column[@name = 'description'])"/>
97
                        <xsl:variable name="summary"
98
                            select="normalize-space(//column[@name = 'brief_summary'])"/>
99
                        <xsl:if test="string-length($description) &gt; 0">
100
                            <description descriptionType="Abstract">
101
                                <xsl:value-of select="$description"/>
102
                            </description>
103
                        </xsl:if>
104
                        <xsl:if test="string-length($summary) &gt; 0">
105
                            <description descriptionType="Abstract">
106
                                <xsl:value-of select="$summary"/>
107
                            </description>
108
                        </xsl:if>
109
                    </descriptions>
110
                    <xsl:if test="string-length(//column[@name = 'target_sample_size']) &gt; 0">
111
                        <sizes>
112
                            <size>
113
                                <xsl:value-of
114
                                    select="concat('Target sample size: ', //column[@name = 'target_sample_size'])"
115
                                />
116
                            </size>
117
                        </sizes>
118
                    </xsl:if>
119
                    <oaf:accessrights>UNKNOWN</oaf:accessrights>
120
                    <dr:CobjCategory>0021</dr:CobjCategory>
121
                    <oaf:dateAccepted>
122
                        <xsl:value-of select="//column[@name = 'registration_date']"/>
123
                    </oaf:dateAccepted>
124
                    <!-- We'll need to do something to patch it, if possible, looking at the jsonProv source name and id -->
125
                    <oaf:hostedBy id="openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18" name="Unknown Repository"/>
126
                    <oaf:collectedFrom>
127
                        <xsl:attribute name="name">
128
                            <xsl:value-of select="$varOfficialName"/>
129
                        </xsl:attribute>
130
                        <xsl:attribute name="id">
131
                            <xsl:value-of select="$varDataSourceId"/>
132
                        </xsl:attribute>
133
                    </oaf:collectedFrom>
134
                    <oaf:about>
135
                        <oaf:datainfo>
136
                            <oaf:inferred>false</oaf:inferred>
137
                            <oaf:deletedbyinference>false</oaf:deletedbyinference>
138
                            <oaf:trust>0.9</oaf:trust>
139
                            <oaf:inferenceprovenance/>
140
                            <oaf:provenanceaction classid="sysimport:crosswalk:datasetarchive"
141
                                classname="sysimport:crosswalk:datasetarchive"
142
                                schemeid="dnet:provenanceActions"
143
                                schemename="dnet:provenanceActions"/>
144
                        </oaf:datainfo>
145
                    </oaf:about>
146
                </resource>
147
            </oai:metadata>
148
            <xsl:copy-of select="//*[local-name() = 'about']"/>
149
        </oai:record>
150
    </xsl:template>
151
</xsl:stylesheet>
152

    
153
]]></CODE>
154
			</SCRIPT>
155
		</CONFIGURATION>
156
		<STATUS/>
157
		<SECURITY_PARAMETERS/>
158
	</BODY>
159
</RESOURCE_PROFILE>
160

    
(56-56/68)