Project

General

Profile

« Previous | Next » 

Revision 44551

indentation

View differences:

odf2hbase.xml
14 14
            <SCRIPT>
15 15
	            <TITLE>xslt_mapping_odf2hbase</TITLE>
16 16
                <CODE>
17
	                <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">
17
<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 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)"/>
25
<xsl:output omit-xml-declaration="yes" indent="yes"/>
30 26

  
31
			                <xsl:variable name="trust" select="string('0.9')"/>
32
			                <xsl:variable name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
27
<xsl:param name="trust" select="string('0.9')"/>
28
<xsl:param name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
29
<xsl:template match="/*">
30
    <xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
31
    <xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
32
    <xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
33
    <xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
34
    <xsl:variable name="namespaceprefix">
35
        <xsl:choose>
36
            <!-- TODO check namespaceprefix length is 12 -->
37
            <xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
38
                <xsl:value-of select="//oaf:datasourceprefix"/>
39
            </xsl:when>
40
            <xsl:otherwise>
41
                <xsl:value-of select="unknown_____"/>
42
            </xsl:otherwise>
43
        </xsl:choose>
44
    </xsl:variable>
33 45

  
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>
46
    <xsl:choose>
47
        <xsl:when
48
                test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
49
            <ROWS/>
50
        </xsl:when>
51
        <xsl:otherwise>
47 52

  
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>
53
            <xsl:variable name="resultId"
54
                          select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
54 55

  
55
					                <xsl:variable name="resultId"
56
					                              select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
56
            <xsl:if test="string-length($resultId) &gt; 0">
57
                <xsl:variable name="originalids"
58
                              select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
59
                <xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
60
                <xsl:variable name="titles" select="//*[local-name() = 'title']"/>
61
                <xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
62
                <xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
63
                <xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
64
                <xsl:variable name="dates" select="//*[local-name() = 'date']"/>
65
                <xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
66
                <xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/>
67
                <xsl:variable name="formats" select="//*[local-name() = 'format']"/>
68
                <xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
69
                <xsl:variable name="rights" select="//oaf:accessrights"/>
70
                <xsl:variable name="version" select="//*[local-name() = 'version']"/>
71
                <xsl:variable name="language" select="//oaf:language"/>
72
                <xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
73
                <xsl:variable name="contributor" select="//*[local-name() = 'contributor']/*[local-name() = 'contributorName']"/>
57 74

  
58
					                <xsl:if test="string-length($resultId) &gt; 0">
59
						                <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']"/>
75
                <xsl:variable name="instanceURI">
76
	                <xsl:choose>
77
		                <xsl:when
78
				                test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']) &gt; 0">
79
			                <xsl:value-of
80
					                select="concat('http://dx.doi.org','/', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']/text())"/>
81
		                </xsl:when>
82
		                <xsl:when test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL']) &gt; 0">
83
			                <xsl:value-of select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/>
84
		                </xsl:when>
85
		                <xsl:otherwise>
86
			                <xsl:value-of select="concat('', //*[local-name() = 'resource']//*[local-name()='alternateIdentifier' and ./@alternateIdentifierType='URL'])"/>
87
		                </xsl:otherwise>
88
	                </xsl:choose>
89
                </xsl:variable>
76 90

  
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:choose>
86
										                <xsl:when test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL']) &gt; 0">
87
											                <xsl:value-of select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/>
88
										                </xsl:when>
89
										                <xsl:otherwise>
90
											                <xsl:value-of select="concat('', //*[local-name() = 'resource']//*[local-name()='alternateIdentifier' and ./@alternateIdentifierType='URL'])"/>
91
										                </xsl:otherwise>
92
									                </xsl:choose>
93
								                </xsl:otherwise>
94
							                </xsl:choose>
95
						                </xsl:variable>
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)"/>
96 98

  
97
						                <xsl:variable name="hostedbyid"
98
						                              select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
99
						                <xsl:variable name="hostedbyname" select="concat('', //oaf:hostedBy/@name)"/>
100
						                <xsl:variable name="collectedfromid"
101
						                              select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
102
						                <xsl:variable name="collectedfromname"
103
						                              select="concat('', //oaf:collectedFrom/@name)"/>
99
                <xsl:variable name="pids"
100
                              select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
104 101

  
105
						                <xsl:variable name="pids"
106
						                              select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
102
                <xsl:variable name="result"
103
                              select="dnet:odfResult($resultId, $about, $metadata, $titles, $subjects, $publisher, $descriptions,
104
                        $dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights,
105
                        $version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
106
                        $collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
107 107

  
108
						                <xsl:variable name="result"
109
						                              select="dnet:odfResult($resultId, $about, $metadata, $titles, $subjects, $publisher, $descriptions,
110
	                                            $dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights,
111
	                                            $version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
112
	                                            $collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
108
                <ROWS>
109
	                <ROW key="{$resultId}" columnFamily="result">
110
		                <QUALIFIER name="body" type="base64">
111
			                <xsl:value-of select="$result"/>
112
		                </QUALIFIER>
113
	                </ROW>
114
	                <xsl:for-each select="//*[local-name() = 'creator']">
113 115

  
114
						                <ROWS>
115
							                <ROW key="{$resultId}" columnFamily="result">
116
								                <QUALIFIER name="body" type="base64">
117
									                <xsl:value-of select="$result"/>
118
								                </QUALIFIER>
119
							                </ROW>
120
							                <xsl:for-each select="//*[local-name() = 'creator']">
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>
121 127

  
122
								                <xsl:variable name="personIdTemp">
123
									                <xsl:choose>
124
										                <xsl:when test="string-length(./*[local-name() = 'nameIdentifier']) &gt; 0">
125
											                <xsl:value-of
126
													                select="translate(normalize-space(./*[local-name() = 'nameIdentifier']),' .,','___')"/>
127
										                </xsl:when>
128
										                <xsl:otherwise>
129
											                <xsl:value-of select="translate(normalize-space(./*[local-name() = 'creatorName']),' .,','___')"/>
130
										                </xsl:otherwise>
131
									                </xsl:choose>
132
								                </xsl:variable>
128
		                <xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdTemp))"/>
133 129

  
134
								                <xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdTemp))"/>
130
		                <xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/>
135 131

  
136
								                <xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/>
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
			                <xsl:variable name="personresult"
139
			                              select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf',
140
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
141
			                <xsl:variable name="resultperson"
142
			                              select="dnet:personResult_Authorship($resultId, $personId, $position, 'hasAuthor',
143
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
137 144

  
138
								                <xsl:if test="string-length($personId) &gt; 0">
139
									                <xsl:variable name="position" select="position()"/>
140
									                <xsl:variable name="person"
141
									                              select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname,
142
									                              $originalPersonId, $dateOfCollection, $dateoftransformation, normalize-space(./*[local-name() = 'creatorName']),
143
									                              ./*[local-name() = 'nameIdentifier'], ./*[local-name() = 'nameIdentifier']/@nameIdentifierScheme)"/>
144
									                <xsl:variable name="personresult"
145
									                              select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf',
146
									                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
147
									                <xsl:variable name="resultperson"
148
									                              select="dnet:personResult_Authorship($resultId, $personId, $position, 'hasAuthor',
149
									                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
145
			                <ROW key="{$personId}" columnFamily="person">
146
				                <QUALIFIER name="body" type="base64">
147
					                <xsl:value-of select="$person"/>
148
				                </QUALIFIER>
149
			                </ROW>
150
			                <ROW key="{$personId}" columnFamily="personResult_authorship_isAuthorOf">
151
				                <QUALIFIER name="{$resultId}" type="base64">
152
					                <xsl:value-of select="$personresult"/>
153
				                </QUALIFIER>
154
			                </ROW>
155
			                <ROW key="{$resultId}" columnFamily="personResult_authorship_hasAuthor">
156
				                <QUALIFIER name="{$personId}" type="base64">
157
					                <xsl:value-of select="$resultperson"/>
158
				                </QUALIFIER>
159
			                </ROW>
160
		                </xsl:if>
161
	                </xsl:for-each>
150 162

  
151
									                <ROW key="{$personId}" columnFamily="person">
152
										                <QUALIFIER name="body" type="base64">
153
											                <xsl:value-of select="$person"/>
154
										                </QUALIFIER>
155
									                </ROW>
156
									                <ROW key="{$personId}" columnFamily="personResult_authorship_isAuthorOf">
157
										                <QUALIFIER name="{$resultId}" type="base64">
158
											                <xsl:value-of select="$personresult"/>
159
										                </QUALIFIER>
160
									                </ROW>
161
									                <ROW key="{$resultId}" columnFamily="personResult_authorship_hasAuthor">
162
										                <QUALIFIER name="{$personId}" type="base64">
163
											                <xsl:value-of select="$resultperson"/>
164
										                </QUALIFIER>
165
									                </ROW>
166
								                </xsl:if>
167
							                </xsl:for-each>
163
	                <xsl:for-each select="//*[local-name()='projectid']">
168 164

  
169
							                <xsl:for-each select="//*[local-name()='projectid']">
165
		                <xsl:variable name="projectId"
166
		                              select="dnet:oafSplitId('project', normalize-space(.))"/>
170 167

  
171
								                <xsl:variable name="projectId"
172
								                              select="dnet:oafSplitId('project', normalize-space(.))"/>
168
		                <xsl:variable name="resultproject"
169
		                              select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy',
170
		                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
171
		                <xsl:variable name="projectresult"
172
		                              select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces',
173
		                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
173 174

  
174
								                <xsl:variable name="resultproject"
175
								                              select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy',
176
								                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
177
								                <xsl:variable name="projectresult"
178
								                              select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces',
179
								                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
175
		                <xsl:if test="string-length($projectId) &gt; 0">
176
			                <ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
177
				                <QUALIFIER name="{$projectId}" type="base64">
178
					                <xsl:value-of select="$resultproject"/>
179
				                </QUALIFIER>
180
			                </ROW>
181
			                <ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
182
				                <QUALIFIER name="{$resultId}" type="base64">
183
					                <xsl:value-of select="$projectresult"/>
184
				                </QUALIFIER>
185
			                </ROW>
186
		                </xsl:if>
187
	                </xsl:for-each>
180 188

  
181
								                <xsl:if test="string-length($projectId) &gt; 0">
182
									                <ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
183
										                <QUALIFIER name="{$projectId}" type="base64">
184
											                <xsl:value-of select="$resultproject"/>
185
										                </QUALIFIER>
186
									                </ROW>
187
									                <ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
188
										                <QUALIFIER name="{$resultId}" type="base64">
189
											                <xsl:value-of select="$projectresult"/>
190
										                </QUALIFIER>
191
									                </ROW>
192
								                </xsl:if>
193
							                </xsl:for-each>
189
	                <xsl:for-each
190
			                select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']">
194 191

  
195
							                <xsl:for-each
196
									                select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']">
192
		                <!-- relatedDataset ids must be in the openaire format  -->
193
		                <xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
197 194

  
198
								                <!-- relatedDataset ids must be in the openaire format  -->
199
								                <xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
195
		                <xsl:if test="string-length($targetId) &gt; 0">
200 196

  
201
								                <xsl:if test="string-length($targetId) &gt; 0">
197
			                <xsl:variable name="resultDataset"
198
			                              select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo',
199
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
200
			                <xsl:variable name="datasetResult"
201
			                              select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy',
202
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
202 203

  
203
									                <xsl:variable name="resultDataset"
204
									                              select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo',
205
									                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
206
									                <xsl:variable name="datasetResult"
207
									                              select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy',
208
									                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
204
			                <ROW key="{$resultId}" columnFamily="resultResult_supplement_isSupplementTo">
205
				                <QUALIFIER name="{$targetId}" type="base64">
206
					                <xsl:value-of select="$resultDataset"/>
207
				                </QUALIFIER>
208
			                </ROW>
209
			                <ROW key="{$targetId}" columnFamily="resultResult_supplement_isSupplementedBy">
210
				                <QUALIFIER name="{$resultId}" type="base64">
211
					                <xsl:value-of select="$datasetResult"/>
212
				                </QUALIFIER>
213
			                </ROW>
214
		                </xsl:if>
215
	                </xsl:for-each>
209 216

  
210
									                <ROW key="{$resultId}" columnFamily="resultResult_supplement_isSupplementTo">
211
										                <QUALIFIER name="{$targetId}" type="base64">
212
											                <xsl:value-of select="$resultDataset"/>
213
										                </QUALIFIER>
214
									                </ROW>
215
									                <ROW key="{$targetId}" columnFamily="resultResult_supplement_isSupplementedBy">
216
										                <QUALIFIER name="{$resultId}" type="base64">
217
											                <xsl:value-of select="$datasetResult"/>
218
										                </QUALIFIER>
219
									                </ROW>
220
								                </xsl:if>
221
							                </xsl:for-each>
217
	                <xsl:for-each
218
			                select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
222 219

  
223
							                <xsl:for-each
224
									                select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
220
		                <!-- relatedDataset ids must be in the openaire format  -->
221
		                <xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
225 222

  
226
								                <!-- relatedDataset ids must be in the openaire format  -->
227
								                <xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
223
		                <xsl:if test="string-length($datasetId) &gt; 0">
228 224

  
229
								                <xsl:if test="string-length($datasetId) &gt; 0">
225
			                <xsl:variable name="childParent"
226
			                              select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf',
227
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
228
			                <xsl:variable name="parentChild"
229
			                              select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart',
230
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
230 231

  
231
									                <xsl:variable name="childParent"
232
									                              select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf',
233
									                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
234
									                <xsl:variable name="parentChild"
235
									                              select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart',
236
									                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
232
			                <ROW key="{$resultId}" columnFamily="resultResult_part_isPartOf">
233
				                <QUALIFIER name="{$datasetId}" type="base64">
234
					                <xsl:value-of select="$childParent"/>
235
				                </QUALIFIER>
236
			                </ROW>
237
			                <ROW key="{$datasetId}" columnFamily="resultResult_part_hasPart">
238
				                <QUALIFIER name="{$resultId}" type="base64">
239
					                <xsl:value-of select="$parentChild"/>
240
				                </QUALIFIER>
241
			                </ROW>
242
		                </xsl:if>
243
	                </xsl:for-each>
237 244

  
238
									                <ROW key="{$resultId}" columnFamily="resultResult_part_isPartOf">
239
										                <QUALIFIER name="{$datasetId}" type="base64">
240
											                <xsl:value-of select="$childParent"/>
241
										                </QUALIFIER>
242
									                </ROW>
243
									                <ROW key="{$datasetId}" columnFamily="resultResult_part_hasPart">
244
										                <QUALIFIER name="{$resultId}" type="base64">
245
											                <xsl:value-of select="$parentChild"/>
246
										                </QUALIFIER>
247
									                </ROW>
248
								                </xsl:if>
249
							                </xsl:for-each>
250

  
251
						                </ROWS>
252
					                </xsl:if>
253
				                </xsl:otherwise>
254
			                </xsl:choose>
255
		                </xsl:template>
245
                </ROWS>
246
            </xsl:if>
247
        </xsl:otherwise>
248
    </xsl:choose>
249
</xsl:template>
256 250
</xsl:stylesheet>
257 251
	</CODE>
258 252
            </SCRIPT>

Also available in: Unified diff