Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="43108eba-4b67-4d7a-8928-55ca09f1c8ff_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="oaf" layout="store" interpretation="cleaned"/>
12
			<SINK_METADATA_FORMAT name="oaf_hbase"/>
13
			<IMPORTED/>
14
			<SCRIPT>
15
				<TITLE>xslt_mapping_oaf2hbase</TITLE>
16
				<CODE>
17
					<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
					                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dc="http://purl.org/dc/elements/1.1/"
19
					                xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
20
					                xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
21
					                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

    
27
						<xsl:param name="writeCoAuthors" select="false()"/>
28

    
29
						<xsl:template match="/*">
30
							<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
31
							<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
32
							<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/>
33

    
34
							<xsl:variable name="trust" select="string('0.9')"/>
35
							<xsl:variable name="provenance" select="string('sysimport:crosswalk:repository')"/>
36

    
37
							<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
38
							<xsl:variable name="namespaceprefix">
39
								<xsl:choose>
40

    
41
									<!-- TODO check namespaceprefix length is 12 -->
42
									<xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
43
										<xsl:value-of select="//oaf:datasourceprefix"/>
44
									</xsl:when>
45
									<xsl:otherwise>
46
										<xsl:value-of select="unknown_"/>
47
									</xsl:otherwise>
48
								</xsl:choose>
49
							</xsl:variable>
50

    
51
							<xsl:choose>
52
								<!-- 			<xsl:when test="count($metadata) = 0 or string-length($namespaceprefix) = 0"> -->
53
								<xsl:when test="count($metadata) = 0">
54
									<ROWS/>
55
								</xsl:when>
56
								<xsl:otherwise>
57

    
58
									<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
59
									<xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
60

    
61
									<xsl:if test="string-length($resultId) &gt; 0">
62

    
63
										<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
64
										<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
65

    
66
										<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
67
										<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
68

    
69
										<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
70
										<xsl:variable name="originalid">
71
											<xsl:choose>
72
												<xsl:when test="contains($originalidTest, '::')">
73
													<xsl:value-of select="substring-after($originalidTest, '::')"/>
74
												</xsl:when>
75
												<xsl:otherwise>
76
													<xsl:value-of select="$originalidTest"/>
77
												</xsl:otherwise>
78
											</xsl:choose>
79
										</xsl:variable>
80

    
81
										<xsl:variable name="result"
82
										              select="dnet:oafResult($resultId, $provenance, $trust, $about, $hostedbyid, $hostedbyname, $collectedfromid,
83
										              $collectedfromname, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
84

    
85
										<ROWS>
86
											<ROW key="{$resultId}" columnFamily="result">
87
												<QUALIFIER name="body" type="base64">
88
													<xsl:value-of select="$result"/>
89
												</QUALIFIER>
90
											</ROW>
91

    
92
											<xsl:for-each select="//*[local-name()='projectid']">
93

    
94
												<xsl:variable name="projectId" select="dnet:oafSplitId('project', normalize-space(.))"/>
95

    
96
												<xsl:if test="string-length($projectId) &gt; 0">
97

    
98
													<xsl:variable name="resultproject"
99
													              select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy', $provenance, $trust, $about)"/>
100
													<xsl:variable name="projectresult"
101
													              select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces', $provenance, $trust, $about)"/>
102

    
103
													<ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
104
														<QUALIFIER name="{$projectId}" type="base64">
105
															<xsl:value-of select="$resultproject"/>
106
														</QUALIFIER>
107
													</ROW>
108
													<ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
109
														<QUALIFIER name="{$resultId}" type="base64">
110
															<xsl:value-of select="$projectresult"/>
111
														</QUALIFIER>
112
													</ROW>
113
												</xsl:if>
114
											</xsl:for-each>
115

    
116
											<xsl:for-each select="//*[local-name()='relatedDataset']">
117

    
118
												<!-- relatedDataset ids must be in the openaire format  -->
119
												<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(./@id))"/>
120

    
121
												<xsl:if test="string-length($datasetId) &gt; 0">
122

    
123
													<xsl:variable name="resultDataset"
124
													              select="dnet:rel($resultId, $datasetId, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/>
125
													<xsl:variable name="datasetResult"
126
													              select="dnet:rel($datasetId, $resultId, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/>
127

    
128
													<ROW key="{$resultId}" columnFamily="resultResult_publicationDataset_isRelatedTo">
129
														<QUALIFIER name="{$datasetId}" type="base64">
130
															<xsl:value-of select="$resultDataset"/>
131
														</QUALIFIER>
132
													</ROW>
133
													<ROW key="{$datasetId}" columnFamily="resultResult_publicationDataset_isRelatedTo">
134
														<QUALIFIER name="{$resultId}" type="base64">
135
															<xsl:value-of select="$datasetResult"/>
136
														</QUALIFIER>
137
													</ROW>
138
												</xsl:if>
139
											</xsl:for-each>
140

    
141
											<xsl:for-each select="//*[local-name()='creator']">
142

    
143
												<xsl:if test="string-length(normalize-space(.)) &gt; 0">
144
													<xsl:variable name="originalPersonId">
145
														<xsl:choose>
146
															<xsl:when test="string-length(@nameIdentifier) &gt; 0">
147
																<xsl:value-of select="normalize-space(@nameIdentifier)"/>
148
															</xsl:when>
149
															<xsl:otherwise>
150
																<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/>
151
															</xsl:otherwise>
152
														</xsl:choose>
153
													</xsl:variable>
154

    
155
													<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, $originalPersonId)"/>
156
													<xsl:variable name="position" select="position()"/>
157

    
158
													<xsl:variable name="person"
159
													              select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
160
								              $originalPersonId, $dateofcollection, $dateoftransformation, normalize-space(.), @nameIdentifier, @nameIdentifierScheme)"/>
161
													<xsl:variable name="personresult"
162
													              select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf', $provenance, $trust, $about)"/>
163
													<xsl:variable name="resultperson"
164
													              select="dnet:personResult_Authorship($resultId, $personId, $position, 'hasAuthor', $provenance, $trust, $about)"/>
165

    
166
													<xsl:if test="string-length($personId) &gt; 0">
167
														<ROW key="{$personId}" columnFamily="person">
168
															<QUALIFIER name="body" type="base64">
169
																<xsl:value-of select="$person"/>
170
															</QUALIFIER>
171
														</ROW>
172
														<ROW key="{$personId}" columnFamily="personResult_authorship_isAuthorOf">
173
															<QUALIFIER name="{$resultId}" type="base64">
174
																<xsl:value-of select="$personresult"/>
175
															</QUALIFIER>
176
														</ROW>
177
														<ROW key="{$resultId}" columnFamily="personResult_authorship_hasAuthor">
178
															<QUALIFIER name="{$personId}" type="base64">
179
																<xsl:value-of select="$resultperson"/>
180
															</QUALIFIER>
181
														</ROW>
182
													</xsl:if>
183

    
184
													<!-- COAUTHORS -->
185
													<xsl:if test="$writeCoAuthors = true()">
186
														<xsl:for-each select="../dc:creator">
187
															<xsl:if test="$position != position()">
188

    
189
																<xsl:variable name="originalCoauthorId">
190
																	<xsl:choose>
191
																		<xsl:when test="string-length(@nameIdentifier) &gt; 0">
192
																			<xsl:value-of select="normalize-space(@nameIdentifier)"/>
193
																		</xsl:when>
194
																		<xsl:otherwise>
195
																			<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/>
196
																		</xsl:otherwise>
197
																	</xsl:choose>
198
																</xsl:variable>
199

    
200
																<xsl:variable name="coauthorId"
201
																              select="dnet:oafId('person', $namespaceprefix, $originalCoauthorId)"/>
202

    
203
																<xsl:variable name="personperson"
204
																              select="dnet:rel($personId, $coauthorId, 'personPerson', 'coauthorship', 'isCoAuthorOf', $provenance, $trust, $about)"/>
205

    
206
																<ROW key="{$personId}" columnFamily="personPerson_coAuthorship_isCoAuthorOf">
207
																	<QUALIFIER name="{$coauthorId}" type="base64">
208
																		<xsl:value-of select="$personperson"/>
209
																	</QUALIFIER>
210
																</ROW>
211
															</xsl:if>
212
														</xsl:for-each>
213
													</xsl:if>
214
													<!-- / COAUTHORS -->
215
												</xsl:if>
216
											</xsl:for-each>
217

    
218
										</ROWS>
219
									</xsl:if>
220
								</xsl:otherwise>
221
							</xsl:choose>
222
						</xsl:template>
223
					</xsl:stylesheet>
224
				</CODE>
225
			</SCRIPT>
226
		</CONFIGURATION>
227
		<STATUS/>
228
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
229
	</BODY>
230
</RESOURCE_PROFILE>
(48-48/73)