Project

General

Profile

1 42821 claudio.at
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="15368db9-a630-47ed-b8f4-f219ae1ebc4b_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
		<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
		<RESOURCE_KIND value="TransformationRuleDSResources"/>
6
		<RESOURCE_URI value=""/>
7
		<DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
8
	</HEADER>
9
	<BODY>
10
		<CONFIGURATION>
11
			<SOURCE_METADATA_FORMAT name="odf" layout="store" interpretation="cleaned"/>
12
			<SINK_METADATA_FORMAT name="odf_insert_action"/>
13
			<IMPORTED/>
14
			<SCRIPT>
15
				<TITLE>xslt_mapping_odf2insertAction</TITLE>
16
				<CODE>
17 42814 claudio.at
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
                xmlns:oaf="http://namespace.openaire.eu/oaf"
19
                xmlns:dnet="eu.dnetlib.data.transform.xml.OdfToHbaseXsltFunctions"
20
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
21
                xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:exslt="http://exslt.org/common"
22
                version="1.0" extension-element-prefixes="exslt"
23
                exclude-result-prefixes="xsl oaf dr dri dnet exslt">
24
25
	<xsl:output omit-xml-declaration="yes" indent="yes"/>
26
	<xsl:template match="/*">
27
		<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
28
		<xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
29
		<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
30
31
		<xsl:variable name="trust" select="string('0.9')"/>
32
		<xsl:variable name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
33
34
		<xsl:variable name="metadata"
35
		              select="exslt:node-set(//*[local-name()='metadata']/*)"/>
36
		<xsl:variable name="namespaceprefix">
37
			<xsl:choose>
38
				<!-- TODO check namespaceprefix length is 12 -->
39
				<xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
40
					<xsl:value-of select="//oaf:datasourceprefix"/>
41
				</xsl:when>
42
				<xsl:otherwise>
43
					<xsl:value-of select="unknown_____"/>
44
				</xsl:otherwise>
45
			</xsl:choose>
46
		</xsl:variable>
47
48
		<xsl:choose>
49
			<xsl:when
50
					test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
51
				<ROWS/>
52
			</xsl:when>
53
			<xsl:otherwise>
54
55 43514 claudio.at
				<xsl:variable name="datasetId"
56
				              select="dnet:oafSimpleId('dataset', //dri:objIdentifier)"/>
57 42814 claudio.at
58 43514 claudio.at
				<xsl:if test="string-length($datasetId) &gt; 0">
59 42814 claudio.at
					<xsl:variable name="originalids"
60
					              select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
61
					<xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
62
					<xsl:variable name="titles" select="//*[local-name() = 'title']"/>
63
					<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
64
					<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
65
					<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
66
					<xsl:variable name="dates" select="//*[local-name() = 'date']"/>
67
					<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
68
					<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/>
69
					<xsl:variable name="formats" select="//*[local-name() = 'format']"/>
70
					<xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
71
					<xsl:variable name="rights" select="//oaf:accessrights"/>
72
					<xsl:variable name="version" select="//*[local-name() = 'version']"/>
73
					<xsl:variable name="language" select="//oaf:language"/>
74
					<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
75
					<xsl:variable name="contributor" select="//*[local-name() = 'contributor']/*[local-name() = 'contributorName']"/>
76
77
					<xsl:variable name="instanceURI">
78
						<xsl:choose>
79
							<xsl:when
80
									test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']) &gt; 0">
81
								<xsl:value-of
82
										select="concat('http://dx.doi.org','/', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']/text())"/>
83
							</xsl:when>
84
							<xsl:otherwise>
85
								<xsl:value-of
86
										select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/>
87
							</xsl:otherwise>
88
						</xsl:choose>
89
					</xsl:variable>
90
91
					<xsl:variable name="hostedbyid"
92
					              select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
93
					<xsl:variable name="hostedbyname" select="concat('', //oaf:hostedBy/@name)"/>
94
					<xsl:variable name="collectedfromid"
95
					              select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
96
					<xsl:variable name="collectedfromname"
97
					              select="concat('', //oaf:collectedFrom/@name)"/>
98
99
					<xsl:variable name="pids"
100
					              select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
101
102 43514 claudio.at
					<xsl:variable name="dataset"
103
					              select="dnet:odfDataset($datasetId, $about, $metadata, $titles, $subjects, $publisher, $descriptions,
104 42814 claudio.at
	                                            $dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights,
105
	                                            $version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
106
	                                            $collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
107
108
					<ROWS>
109 43514 claudio.at
						<ROW key="{$datasetId}" columnFamily="dataset">
110 42814 claudio.at
							<QUALIFIER name="body" type="base64">
111 43514 claudio.at
								<xsl:value-of select="$dataset"/>
112 42814 claudio.at
							</QUALIFIER>
113
						</ROW>
114
						<xsl:for-each select="//*[local-name() = 'creator']">
115
116
							<xsl:variable name="personIdTemp">
117
								<xsl:choose>
118
									<xsl:when test="string-length(./*[local-name() = 'nameIdentifier']) &gt; 0">
119
										<xsl:value-of
120
												select="translate(normalize-space(./*[local-name() = 'nameIdentifier']),' .,','___')"/>
121
									</xsl:when>
122
									<xsl:otherwise>
123
										<xsl:value-of select="translate(normalize-space(./*[local-name() = 'creatorName']),' .,','___')"/>
124
									</xsl:otherwise>
125
								</xsl:choose>
126
							</xsl:variable>
127
128
							<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdTemp))"/>
129
130
							<xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/>
131
132
							<xsl:if test="string-length($personId) &gt; 0">
133
								<xsl:variable name="position" select="position()"/>
134
								<xsl:variable name="person"
135
								              select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
136
									                              $originalPersonId, $dateOfCollection, $dateoftransformation, normalize-space(./*[local-name() = 'creatorName']),
137
									                              ./*[local-name() = 'nameIdentifier'], ./*[local-name() = 'nameIdentifier']/@nameIdentifierScheme)"/>
138 43514 claudio.at
								<xsl:variable name="persondataset"
139
								              select="dnet:personDataset_Authorship($personId, $datasetId, $position, 'isAuthorOf', $provenance, $trust, $about)"/>
140
								<xsl:variable name="datasetperson"
141
								              select="dnet:personDataset_Authorship($datasetId, $personId, $position, 'hasAuthor', $provenance, $trust, $about)"/>
142 42814 claudio.at
143
								<ROW key="{$personId}" columnFamily="person">
144
									<QUALIFIER name="body" type="base64">
145
										<xsl:value-of select="$person"/>
146
									</QUALIFIER>
147
								</ROW>
148 43514 claudio.at
								<ROW key="{$personId}" columnFamily="personDataset_authorship_isAuthorOf">
149
									<QUALIFIER name="{$datasetId}" type="base64">
150
										<xsl:value-of select="$persondataset"/>
151 42814 claudio.at
									</QUALIFIER>
152
								</ROW>
153 43514 claudio.at
								<ROW key="{$datasetId}" columnFamily="personDataset_authorship_hasAuthor">
154 42814 claudio.at
									<QUALIFIER name="{$personId}" type="base64">
155 43514 claudio.at
										<xsl:value-of select="$datasetperson"/>
156 42814 claudio.at
									</QUALIFIER>
157
								</ROW>
158
							</xsl:if>
159
						</xsl:for-each>
160
161
						<xsl:for-each select="//*[local-name()='projectid']">
162
163
							<xsl:variable name="projectId"
164
							              select="dnet:oafSplitId('project', normalize-space(.))"/>
165
166 43514 claudio.at
							<xsl:variable name="datasetproject"
167
							              select="dnet:rel($datasetId, $projectId, 'datasetProject', 'outcome', 'isProducedBy', $provenance, $trust, $about)"/>
168
							<xsl:variable name="projectdataset"
169
							              select="dnet:rel($projectId, $datasetId, 'datasetProject', 'outcome', 'produces', $provenance, $trust, $about)"/>
170 42814 claudio.at
171
							<xsl:if test="string-length($projectId) &gt; 0">
172 43514 claudio.at
								<ROW key="{$datasetId}" columnFamily="datasetProject_outcome_isProducedBy">
173 42814 claudio.at
									<QUALIFIER name="{$projectId}" type="base64">
174 43514 claudio.at
										<xsl:value-of select="$datasetproject"/>
175 42814 claudio.at
									</QUALIFIER>
176
								</ROW>
177 43514 claudio.at
								<ROW key="{$projectId}" columnFamily="datasetProject_outcome_produces">
178
									<QUALIFIER name="{$datasetId}" type="base64">
179
										<xsl:value-of select="$projectdataset"/>
180 42814 claudio.at
									</QUALIFIER>
181
								</ROW>
182
							</xsl:if>
183
						</xsl:for-each>
184
185
						<xsl:for-each
186
								select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']">
187
188
							<!-- relatedDataset ids must be in the openaire format  -->
189 43514 claudio.at
							<xsl:variable name="targetId" select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
190 42814 claudio.at
191
							<xsl:if test="string-length($targetId) &gt; 0">
192
193 43514 claudio.at
								<xsl:variable name="datasetDataset"
194
								              select="dnet:rel($datasetId, $targetId, 'datasetDataset', 'supplement', 'isSupplementTo', $provenance, $trust, $about)"/>
195
								<xsl:variable name="datasetDataset"
196
								              select="dnet:rel($targetId, $datasetId, 'datasetDataset', 'supplement', 'isSupplementedBy', $provenance, $trust, $about)"/>
197 42814 claudio.at
198 43514 claudio.at
								<ROW key="{$datasetId}" columnFamily="datasetDataset_supplement_isSupplementTo">
199 42814 claudio.at
									<QUALIFIER name="{$targetId}" type="base64">
200 43514 claudio.at
										<xsl:value-of select="$datasetDataset"/>
201 42814 claudio.at
									</QUALIFIER>
202
								</ROW>
203 43514 claudio.at
								<ROW key="{$targetId}" columnFamily="datasetDataset_supplement_isSupplementedBy">
204
									<QUALIFIER name="{$datasetId}" type="base64">
205
										<xsl:value-of select="$datasetDataset"/>
206 42814 claudio.at
									</QUALIFIER>
207
								</ROW>
208
							</xsl:if>
209
						</xsl:for-each>
210
211
						<xsl:for-each
212
								select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
213
214
							<!-- relatedDataset ids must be in the openaire format  -->
215 43514 claudio.at
							<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
216 42814 claudio.at
217
							<xsl:if test="string-length($datasetId) &gt; 0">
218
219
								<xsl:variable name="childParent"
220 43514 claudio.at
								              select="dnet:rel($datasetId, $datasetId, 'datasetDataset', 'part', 'isPartOf', $provenance, $trust, $about)"/>
221 42814 claudio.at
								<xsl:variable name="parentChild"
222 43514 claudio.at
								              select="dnet:rel($datasetId, $datasetId, 'datasetDataset', 'part', 'hasPart', $provenance, $trust, $about)"/>
223 42814 claudio.at
224 43514 claudio.at
								<ROW key="{$datasetId}" columnFamily="datasetDataset_part_isPartOf">
225 42814 claudio.at
									<QUALIFIER name="{$datasetId}" type="base64">
226
										<xsl:value-of select="$childParent"/>
227
									</QUALIFIER>
228
								</ROW>
229 43514 claudio.at
								<ROW key="{$datasetId}" columnFamily="datasetDataset_part_hasPart">
230
									<QUALIFIER name="{$datasetId}" type="base64">
231 42814 claudio.at
										<xsl:value-of select="$parentChild"/>
232
									</QUALIFIER>
233
								</ROW>
234
							</xsl:if>
235
						</xsl:for-each>
236
237
					</ROWS>
238
				</xsl:if>
239
			</xsl:otherwise>
240
		</xsl:choose>
241
	</xsl:template>
242
</xsl:stylesheet>
243 42821 claudio.at
				</CODE>
244
			</SCRIPT>
245
		</CONFIGURATION>
246
		<STATUS/>
247
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
248
	</BODY>
249
</RESOURCE_PROFILE>