1 |
37016
|
claudio.at
|
<RESOURCE_PROFILE>
|
2 |
|
|
<HEADER>
|
3 |
40127
|
claudio.at
|
<RESOURCE_IDENTIFIER value="8b1e581c-8e02-4661-8210-4f70b4f73d97_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4 |
40061
|
alessia.ba
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5 |
|
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6 |
|
|
<RESOURCE_URI value=""/>
|
7 |
37016
|
claudio.at
|
<DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
|
8 |
|
|
</HEADER>
|
9 |
|
|
<BODY>
|
10 |
40061
|
alessia.ba
|
<CONFIGURATION>
|
11 |
|
|
<SOURCE_METADATA_FORMAT name="oaf" layout="store" interpretation="cleaned"/>
|
12 |
|
|
<SINK_METADATA_FORMAT name="oaf_hbase"/>
|
13 |
|
|
<IMPORTED/>
|
14 |
|
|
<SCRIPT>
|
15 |
40128
|
claudio.at
|
<TITLE>xslt_mapping_oaf2hbase_coAuthors</TITLE>
|
16 |
40061
|
alessia.ba
|
<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.DNetMdStoreToHbaseXsltFunctions"
|
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 |
37016
|
claudio.at
|
|
25 |
40061
|
alessia.ba
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
26 |
37016
|
claudio.at
|
|
27 |
40061
|
alessia.ba
|
<xsl:param name="mergeIdForHomonyms" select="true()"/>
|
28 |
|
|
<xsl:param name="writeCoAuthors" select="false()"/>
|
29 |
37016
|
claudio.at
|
|
30 |
40061
|
alessia.ba
|
<xsl:template match="/*">
|
31 |
|
|
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
32 |
|
|
<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
|
33 |
37016
|
claudio.at
|
|
34 |
40061
|
alessia.ba
|
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
35 |
|
|
<xsl:variable name="namespaceprefix">
|
36 |
|
|
<xsl:choose>
|
37 |
|
|
|
38 |
|
|
<!-- TODO check namespaceprefix length is 12 -->
|
39 |
|
|
<xsl:when test="string-length(//oaf:datasourceprefix) > 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 test="count($metadata) = 0 or string-length($namespaceprefix) = 0"> -->
|
50 |
|
|
<xsl:when test="count($metadata) = 0">
|
51 |
|
|
<ROWS/>
|
52 |
|
|
</xsl:when>
|
53 |
|
|
<xsl:otherwise>
|
54 |
|
|
|
55 |
|
|
<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
|
56 |
|
|
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
|
57 |
|
|
|
58 |
|
|
<xsl:if test="string-length($resultId) > 0">
|
59 |
|
|
|
60 |
|
|
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
|
61 |
|
|
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
|
62 |
|
|
|
63 |
|
|
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
|
64 |
|
|
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
|
65 |
|
|
|
66 |
|
|
<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
|
67 |
|
|
<xsl:variable name="originalid">
|
68 |
|
|
<xsl:choose>
|
69 |
|
|
<xsl:when test="contains($originalidTest, '::')">
|
70 |
|
|
<xsl:value-of select="substring-after($originalidTest, '::')"/>
|
71 |
|
|
</xsl:when>
|
72 |
|
|
<xsl:otherwise>
|
73 |
|
|
<xsl:value-of select="$originalidTest"/>
|
74 |
|
|
</xsl:otherwise>
|
75 |
|
|
</xsl:choose>
|
76 |
|
|
</xsl:variable>
|
77 |
|
|
|
78 |
|
|
<xsl:variable name="result"
|
79 |
|
|
select="dnet:oafResultFromMDStore($resultId, $about, $hostedbyid, $hostedbyname, $collectedfromid, $collectedfromname, $originalid, $dateofcollection, $metadata)"/>
|
80 |
|
|
|
81 |
|
|
<ROWS>
|
82 |
|
|
<ROW key="{$resultId}" columnFamily="result">
|
83 |
|
|
<QUALIFIER name="body" type="base64">
|
84 |
|
|
<xsl:value-of select="$result"/>
|
85 |
|
|
</QUALIFIER>
|
86 |
37016
|
claudio.at
|
</ROW>
|
87 |
|
|
|
88 |
40061
|
alessia.ba
|
<xsl:for-each select="//*[local-name()='projectid']">
|
89 |
|
|
|
90 |
|
|
<xsl:variable name="projectId" select="dnet:oafSplitId('project', normalize-space(.))"/>
|
91 |
|
|
|
92 |
|
|
<xsl:if test="string-length($projectId) > 0">
|
93 |
|
|
|
94 |
|
|
<xsl:variable name="resultproject"
|
95 |
|
|
select="dnet:oafResultProject_Outcome_FromMDStore($resultId, $projectId, 'isProducedBy', $about)"/>
|
96 |
|
|
<xsl:variable name="projectresult"
|
97 |
|
|
select="dnet:oafResultProject_Outcome_FromMDStore($projectId, $resultId, 'produces', $about)"/>
|
98 |
|
|
|
99 |
|
|
<ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
|
100 |
|
|
<QUALIFIER name="{$projectId}" type="base64">
|
101 |
|
|
<xsl:value-of select="$resultproject"/>
|
102 |
|
|
</QUALIFIER>
|
103 |
|
|
</ROW>
|
104 |
|
|
<ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
|
105 |
|
|
<QUALIFIER name="{$resultId}" type="base64">
|
106 |
|
|
<xsl:value-of select="$projectresult"/>
|
107 |
|
|
</QUALIFIER>
|
108 |
|
|
</ROW>
|
109 |
|
|
</xsl:if>
|
110 |
|
|
</xsl:for-each>
|
111 |
|
|
|
112 |
|
|
<xsl:for-each select="//*[local-name()='relatedDataset']">
|
113 |
|
|
|
114 |
|
|
<!-- relatedDataset ids must be in the openaire format -->
|
115 |
|
|
<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(./@id))"/>
|
116 |
|
|
|
117 |
|
|
<xsl:if test="string-length($datasetId) > 0">
|
118 |
|
|
|
119 |
|
|
<xsl:variable name="resultDataset"
|
120 |
|
|
select="dnet:oafResultResult_PublicationDataset_FromMDStore($resultId, $datasetId, 'isRelatedTo', $about)"/>
|
121 |
|
|
<xsl:variable name="datasetResult"
|
122 |
|
|
select="dnet:oafResultResult_PublicationDataset_FromMDStore($datasetId, $resultId, 'isRelatedTo', $about)"/>
|
123 |
|
|
|
124 |
|
|
<ROW key="{$resultId}" columnFamily="resultResult_publicationDataset_isRelatedTo">
|
125 |
|
|
<QUALIFIER name="{$datasetId}" type="base64">
|
126 |
|
|
<xsl:value-of select="$resultDataset"/>
|
127 |
|
|
</QUALIFIER>
|
128 |
|
|
</ROW>
|
129 |
|
|
<ROW key="{$datasetId}" columnFamily="resultResult_publicationDataset_isRelatedTo">
|
130 |
|
|
<QUALIFIER name="{$resultId}" type="base64">
|
131 |
|
|
<xsl:value-of select="$datasetResult"/>
|
132 |
|
|
</QUALIFIER>
|
133 |
|
|
</ROW>
|
134 |
|
|
</xsl:if>
|
135 |
|
|
</xsl:for-each>
|
136 |
|
|
|
137 |
|
|
<xsl:for-each select="//*[local-name()='creator']">
|
138 |
|
|
|
139 |
|
|
<xsl:if test="string-length(normalize-space(.)) > 0">
|
140 |
|
|
|
141 |
|
|
<xsl:variable name="personIdPart">
|
142 |
|
|
<xsl:call-template name="personIdTmpl">
|
143 |
|
|
<xsl:with-param name="objIdentifier" select="$objIdentifier"/>
|
144 |
|
|
</xsl:call-template>
|
145 |
|
|
</xsl:variable>
|
146 |
|
|
<xsl:variable name="position" select="position()"/>
|
147 |
|
|
|
148 |
|
|
<xsl:variable name="personId"
|
149 |
|
|
select="dnet:oafId('person', $namespaceprefix, normalize-space($personIdPart))"/>
|
150 |
|
|
<xsl:variable name="person"
|
151 |
|
|
select="dnet:oafPersonFromMDStore($personId, $about, $collectedfromid, $collectedfromname, $originalid, $dateofcollection, .)"/>
|
152 |
|
|
<xsl:variable name="personresult"
|
153 |
|
|
select="dnet:oafPersonResult_Authorship_FromMDStore($personId, $resultId, $position, 'isAuthorOf', $about)"/>
|
154 |
|
|
<xsl:variable name="resultperson"
|
155 |
|
|
select="dnet:oafPersonResult_Authorship_FromMDStore($resultId, $personId, $position, 'hasAuthor', $about)"/>
|
156 |
|
|
|
157 |
|
|
<xsl:if test="string-length($personId) > 0">
|
158 |
|
|
<ROW key="{$personId}" columnFamily="person">
|
159 |
|
|
<QUALIFIER name="body" type="base64">
|
160 |
|
|
<xsl:value-of select="$person"/>
|
161 |
|
|
</QUALIFIER>
|
162 |
|
|
</ROW>
|
163 |
|
|
<ROW key="{$personId}" columnFamily="personResult_authorship_isAuthorOf">
|
164 |
|
|
<QUALIFIER name="{$resultId}" type="base64">
|
165 |
|
|
<xsl:value-of select="$personresult"/>
|
166 |
|
|
</QUALIFIER>
|
167 |
|
|
</ROW>
|
168 |
|
|
<ROW key="{$resultId}" columnFamily="personResult_authorship_hasAuthor">
|
169 |
|
|
<QUALIFIER name="{$personId}" type="base64">
|
170 |
|
|
<xsl:value-of select="$resultperson"/>
|
171 |
|
|
</QUALIFIER>
|
172 |
|
|
</ROW>
|
173 |
|
|
<ROW key="{$personId}" columnFamily="result">
|
174 |
|
|
<QUALIFIER name="{$resultId}" type="base64">
|
175 |
|
|
<xsl:value-of select="$result"/>
|
176 |
|
|
</QUALIFIER>
|
177 |
|
|
</ROW>
|
178 |
|
|
</xsl:if>
|
179 |
|
|
|
180 |
|
|
<!-- COAUTHORS -->
|
181 |
|
|
<xsl:if test="$writeCoAuthors = true()">
|
182 |
|
|
<xsl:for-each select="../dc:creator">
|
183 |
|
|
<xsl:if test="$position != position()">
|
184 |
|
|
<xsl:variable name="coauthorIdPart">
|
185 |
|
|
<xsl:call-template name="personIdTmpl">
|
186 |
|
|
<xsl:with-param name="objIdentifier" select="$objIdentifier"/>
|
187 |
|
|
</xsl:call-template>
|
188 |
|
|
</xsl:variable>
|
189 |
|
|
<xsl:variable name="coauthorId"
|
190 |
|
|
select="dnet:oafId('person', $namespaceprefix, normalize-space($coauthorIdPart))"/>
|
191 |
|
|
<xsl:variable name="personperson"
|
192 |
|
|
select="dnet:oafPersonPerson_CoAuthorship_FromDMF($personId, $coauthorId, 'isCoAuthorOf', $about)"/>
|
193 |
|
|
<ROW key="{$personId}" columnFamily="personPerson_coAuthorship_isCoAuthorOf">
|
194 |
|
|
<QUALIFIER name="{$coauthorId}" type="base64">
|
195 |
|
|
<xsl:value-of select="$personperson"/>
|
196 |
|
|
</QUALIFIER>
|
197 |
|
|
</ROW>
|
198 |
|
|
</xsl:if>
|
199 |
|
|
</xsl:for-each>
|
200 |
|
|
</xsl:if>
|
201 |
|
|
<!-- / COAUTHORS -->
|
202 |
|
|
</xsl:if>
|
203 |
|
|
</xsl:for-each>
|
204 |
|
|
</ROWS>
|
205 |
|
|
</xsl:if>
|
206 |
|
|
</xsl:otherwise>
|
207 |
|
|
</xsl:choose>
|
208 |
|
|
</xsl:template>
|
209 |
|
|
|
210 |
|
|
<xsl:template name="personIdTmpl">
|
211 |
|
|
<xsl:param name="objIdentifier"/>
|
212 |
|
|
<xsl:choose>
|
213 |
|
|
<xsl:when test="$mergeIdForHomonyms = false()">
|
214 |
|
|
<xsl:value-of select="concat($objIdentifier, '::', normalize-space(.))"/>
|
215 |
|
|
</xsl:when>
|
216 |
|
|
<xsl:otherwise>
|
217 |
|
|
<xsl:value-of select="normalize-space(.)"/>
|
218 |
|
|
</xsl:otherwise>
|
219 |
|
|
</xsl:choose>
|
220 |
|
|
</xsl:template>
|
221 |
|
|
|
222 |
|
|
</xsl:stylesheet>
|
223 |
|
|
</CODE>
|
224 |
|
|
</SCRIPT>
|
225 |
|
|
</CONFIGURATION>
|
226 |
|
|
<STATUS/>
|
227 |
37016
|
claudio.at
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
228 |
|
|
</BODY>
|
229 |
|
|
</RESOURCE_PROFILE>
|