Revision 44352
Added by Sandro La Bruzzo over 7 years ago
pmfdli2hbase.xml | ||
---|---|---|
14 | 14 |
<SCRIPT> |
15 | 15 |
<TITLE>xslt_mapping_pmf2hbase</TITLE> |
16 | 16 |
<CODE> |
17 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
18 |
xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
|
|
19 |
xmlns:exslt="http://exslt.org/common" |
|
20 |
version="1.0" extension-element-prefixes="exslt" |
|
21 |
exclude-result-prefixes="xsl oaf dr dri dnet exslt"> |
|
17 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
18 |
xmlns:dnet="eu.dnetlib.data.transform.xml.PmfToHbaseXsltFunctions"
|
|
19 |
xmlns:exslt="http://exslt.org/common"
|
|
20 |
version="1.0" extension-element-prefixes="exslt"
|
|
21 |
exclude-result-prefixes="xsl oaf dr dri dnet exslt">
|
|
22 | 22 |
|
23 | 23 |
<xsl:output omit-xml-declaration="yes" indent="yes"/> |
24 | 24 |
|
... | ... | |
40 | 40 |
<xsl:when test="string-length(//oaf:datasourceprefix) > 0"> |
41 | 41 |
<xsl:value-of select="//oaf:datasourceprefix"/> |
42 | 42 |
</xsl:when> |
43 |
<xsl:when test="string-length(//dri:datasourceprefix) > 0"> |
|
44 |
<xsl:value-of select="//dri:datasourceprefix"/> |
|
45 |
</xsl:when> |
|
43 | 46 |
<xsl:otherwise> |
44 | 47 |
<xsl:value-of select="unknown_"/> |
45 | 48 |
</xsl:otherwise> |
... | ... | |
70 | 73 |
</xsl:variable> |
71 | 74 |
|
72 | 75 |
<xsl:variable name="publication" |
73 |
select="dnet:oafPublication($publicationId, $provenance, $trust, $about, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
|
|
76 |
select="dnet:pmfPublication($publicationId, $provenance, $trust, $about, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
|
|
74 | 77 |
|
75 | 78 |
<ROWS> |
76 | 79 |
<ROW key="{$publicationId}" columnFamily="publication"> |
... | ... | |
79 | 82 |
</QUALIFIER> |
80 | 83 |
</ROW> |
81 | 84 |
|
82 |
<xsl:for-each select="//*[local-name()='projectid']">
|
|
85 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='dataset']">
|
|
83 | 86 |
|
84 |
<xsl:variable name="projectId" select="dnet:oafSplitId('project', normalize-space(.))"/> |
|
87 |
<xsl:variable name="relationSemantic"> |
|
88 |
<xsl:value-of select="./@relationType"/> |
|
89 |
</xsl:variable> |
|
85 | 90 |
|
86 |
<xsl:if test="string-length($projectId) > 0"> |
|
87 | 91 |
|
88 |
<xsl:variable name="publicationProject" |
|
89 |
select="dnet:rel($publicationId, $projectId, 'publicationProject', 'outcome', 'isProducedBy', $provenance, $trust, $about)"/> |
|
90 |
<xsl:variable name="projectPublication" |
|
91 |
select="dnet:rel($projectId, $publicationId, 'publicationProject', 'outcome', 'produces', $provenance, $trust, $about)"/> |
|
92 |
<!-- relatedDataset ids must be in the openaire format --> |
|
93 |
<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', normalize-space(.))"/> |
|
92 | 94 |
|
93 |
<ROW key="{$publicationId}" columnFamily="publicationProject_outcome_isProducedBy"> |
|
94 |
<QUALIFIER name="{$projectId}" type="base64"> |
|
95 |
<xsl:value-of select="$publicationProject"/> |
|
95 |
<xsl:if test="string-length($datasetId) > 0"> |
|
96 |
<xsl:variable name="publicationDataset" select="dnet:createRel($publicationId, $datasetId, 'publicationDataset', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/> |
|
97 |
<xsl:variable name="datasetPublication" select="dnet:createRel( $datasetId, $publicationId, 'publicationDataset', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/> |
|
98 |
|
|
99 |
<ROW key="{$publicationId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo"> |
|
100 |
<QUALIFIER name="{$datasetId}" type="base64"> |
|
101 |
<xsl:value-of select="$publicationDataset"/> |
|
96 | 102 |
</QUALIFIER> |
97 | 103 |
</ROW> |
98 |
<ROW key="{$projectId}" columnFamily="publicationProject_outcome_produces">
|
|
104 |
<ROW key="{$datasetId}" columnFamily="DatasetPublication_isRelatedTo_isRelatedTo">
|
|
99 | 105 |
<QUALIFIER name="{$publicationId}" type="base64"> |
100 |
<xsl:value-of select="$projectPublication"/>
|
|
106 |
<xsl:value-of select="$datasetPublication"/>
|
|
101 | 107 |
</QUALIFIER> |
102 | 108 |
</ROW> |
109 |
|
|
103 | 110 |
</xsl:if> |
104 | 111 |
</xsl:for-each> |
105 | 112 |
|
106 |
<xsl:for-each select="//*[local-name()='relatedDataset']">
|
|
113 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='publication']">
|
|
107 | 114 |
|
108 |
<!-- relatedDataset ids must be in the openaire format --> |
|
109 |
<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', normalize-space(./@id))"/> |
|
115 |
<xsl:variable name="relationSemantic"> |
|
116 |
<xsl:value-of select="./@relationType"/> |
|
117 |
</xsl:variable> |
|
110 | 118 |
|
111 |
<xsl:if test="string-length($datasetId) > 0"> |
|
112 | 119 |
|
113 |
<xsl:variable name="publicationDataset" |
|
114 |
select="dnet:rel($publicationId, $datasetId, 'publicationDataset', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/> |
|
115 |
<xsl:variable name="datasetPublication" |
|
116 |
select="dnet:rel($datasetId, $publicationId, 'publicationDataset', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/> |
|
120 |
<!-- relatedPublication ids must be in the openaire format --> |
|
121 |
<xsl:variable name="targetPublication" select="dnet:oafSimpleId('publication', normalize-space(.))"/> |
|
117 | 122 |
|
118 |
<ROW key="{$publicationId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo"> |
|
119 |
<QUALIFIER name="{$datasetId}" type="base64"> |
|
120 |
<xsl:value-of select="$publicationDataset"/> |
|
123 |
<xsl:if test="string-length($targetPublication) > 0"> |
|
124 |
<xsl:variable name="publicationPublication" select="dnet:createRel($publicationId, $targetPublication, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/> |
|
125 |
<xsl:variable name="publicationPublicationInverse" select="dnet:createRel( $targetPublication,$publicationId, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/> |
|
126 |
|
|
127 |
<ROW key="{$publicationId}" columnFamily="publicationPublication_isRelatedTo_isRelatedTo"> |
|
128 |
<QUALIFIER name="{$targetPublication}" type="base64"> |
|
129 |
<xsl:value-of select="$publicationPublication"/> |
|
121 | 130 |
</QUALIFIER> |
122 | 131 |
</ROW> |
123 |
<ROW key="{$datasetId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo"> |
|
132 |
|
|
133 |
<ROW key="{$targetPublication}" columnFamily="publicationPublication_isRelatedTo_isRelatedTo"> |
|
124 | 134 |
<QUALIFIER name="{$publicationId}" type="base64"> |
125 |
<xsl:value-of select="$datasetPublication"/>
|
|
135 |
<xsl:value-of select="$publicationPublicationInverse"/>
|
|
126 | 136 |
</QUALIFIER> |
127 | 137 |
</ROW> |
128 | 138 |
</xsl:if> |
129 | 139 |
</xsl:for-each> |
130 | 140 |
|
131 |
<xsl:for-each select="//*[local-name()='creator']"> |
|
132 | 141 |
|
133 |
<xsl:if test="string-length(normalize-space(.)) > 0"> |
|
134 |
<xsl:variable name="originalPersonId"> |
|
135 |
<xsl:choose> |
|
136 |
<xsl:when test="string-length(@nameIdentifier) > 0"> |
|
137 |
<xsl:value-of select="normalize-space(@nameIdentifier)"/> |
|
138 |
</xsl:when> |
|
139 |
<xsl:otherwise> |
|
140 |
<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/> |
|
141 |
</xsl:otherwise> |
|
142 |
</xsl:choose> |
|
143 |
</xsl:variable> |
|
142 |
<!--UNKOWN RELATIONS--> |
|
144 | 143 |
|
145 |
<xsl:variable name="personId" select="dnet:oafId('person', $namespaceprefix, $originalPersonId)"/> |
|
146 |
<xsl:variable name="position" select="position()"/> |
|
144 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='unknown']"> |
|
147 | 145 |
|
148 |
<xsl:variable name="person" |
|
149 |
select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname, |
|
150 |
$originalPersonId, $dateofcollection, $dateoftransformation, normalize-space(.), @nameIdentifier, @nameIdentifierScheme)"/> |
|
151 |
<xsl:variable name="personPublication" |
|
152 |
select="dnet:personPublication_Authorship($personId, $publicationId, $position, 'isAuthorOf', $provenance, $trust, $about)"/> |
|
153 |
<xsl:variable name="publicaitonPerson" |
|
154 |
select="dnet:personPublication_Authorship($publicationId, $personId, $position, 'hasAuthor', $provenance, $trust, $about)"/> |
|
146 |
<xsl:variable name="enity"> |
|
147 |
<xsl:value-of select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about)"/> |
|
148 |
</xsl:variable> |
|
155 | 149 |
|
156 |
<xsl:if test="string-length($personId) > 0"> |
|
157 |
<ROW key="{$personId}" columnFamily="person"> |
|
158 |
<QUALIFIER name="body" type="base64"> |
|
159 |
<xsl:value-of select="$person"/> |
|
160 |
</QUALIFIER> |
|
161 |
</ROW> |
|
162 |
<ROW key="{$personId}" columnFamily="personPublication_authorship_isAuthorOf"> |
|
163 |
<QUALIFIER name="{$publicationId}" type="base64"> |
|
164 |
<xsl:value-of select="$personPublication"/> |
|
165 |
</QUALIFIER> |
|
166 |
</ROW> |
|
167 |
<ROW key="{$publicationId}" columnFamily="personPublication_authorship_hasAuthor"> |
|
168 |
<QUALIFIER name="{$personId}" type="base64"> |
|
169 |
<xsl:value-of select="$publicaitonPerson"/> |
|
170 |
</QUALIFIER> |
|
171 |
</ROW> |
|
172 |
</xsl:if> |
|
173 | 150 |
|
174 |
<!-- COAUTHORS -->
|
|
175 |
<xsl:if test="$writeCoAuthors = true()">
|
|
176 |
<xsl:for-each select="../dc:creator">
|
|
177 |
<xsl:if test="$position != position()">
|
|
151 |
<ROW>
|
|
152 |
<xsl:value-of select="$enity"/>
|
|
153 |
</ROW>
|
|
154 |
</xsl:for-each>
|
|
178 | 155 |
|
179 |
<xsl:variable name="originalCoauthorId"> |
|
180 |
<xsl:choose> |
|
181 |
<xsl:when test="string-length(@nameIdentifier) > 0"> |
|
182 |
<xsl:value-of select="normalize-space(@nameIdentifier)"/> |
|
183 |
</xsl:when> |
|
184 |
<xsl:otherwise> |
|
185 |
<xsl:value-of select="concat($originalid, '::', normalize-space(.))"/> |
|
186 |
</xsl:otherwise> |
|
187 |
</xsl:choose> |
|
188 |
</xsl:variable> |
|
189 | 156 |
|
190 |
<xsl:variable name="coauthorId" |
|
191 |
select="dnet:oafId('person', $namespaceprefix, $originalCoauthorId)"/> |
|
157 |
<!--<xsl:variable name="publicationDataset"--> |
|
158 |
<!--select="dnet:rel($publicationId, $datasetId, 'publicationDataset', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/>--> |
|
159 |
<!--<xsl:variable name="datasetPublication"--> |
|
160 |
<!--select="dnet:rel($datasetId, $publicationId, 'publicationDataset', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/>--> |
|
192 | 161 |
|
193 |
<xsl:variable name="personperson" |
|
194 |
select="dnet:rel($personId, $coauthorId, 'personPerson', 'coauthorship', 'isCoAuthorOf', $provenance, $trust, $about)"/> |
|
162 |
<!--<ROW key="{$publicationId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo">--> |
|
163 |
<!--<QUALIFIER name="{$datasetId}" type="base64">--> |
|
164 |
<!--<xsl:value-of select="$publicationDataset"/>--> |
|
165 |
<!--</QUALIFIER>--> |
|
166 |
<!--</ROW>--> |
|
167 |
<!--<ROW key="{$datasetId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo">--> |
|
168 |
<!--<QUALIFIER name="{$publicationId}" type="base64">--> |
|
169 |
<!--<xsl:value-of select="$datasetPublication"/>--> |
|
170 |
<!--</QUALIFIER>--> |
|
171 |
<!--</ROW>--> |
|
172 |
<!--</xsl:if>--> |
|
173 |
<!--</xsl:for-each>--> |
|
195 | 174 |
|
196 |
<ROW key="{$personId}" columnFamily="personPerson_coAuthorship_isCoAuthorOf"> |
|
197 |
<QUALIFIER name="{$coauthorId}" type="base64"> |
|
198 |
<xsl:value-of select="$personperson"/> |
|
199 |
</QUALIFIER> |
|
200 |
</ROW> |
|
201 |
</xsl:if> |
|
202 |
</xsl:for-each> |
|
203 |
</xsl:if> |
|
204 |
<!-- / COAUTHORS --> |
|
205 |
</xsl:if> |
|
206 |
</xsl:for-each> |
|
207 | 175 |
|
208 | 176 |
</ROWS> |
209 | 177 |
</xsl:if> |
Also available in: Unified diff
fixed bug