Revision 53178
Added by Claudio Atzori about 6 years ago
modules/dnet-openaireplus-mapping-utils/trunk/src/main/resources/eu/dnetlib/actionmanager/xslt/datacite2insertActions.xslt | ||
---|---|---|
6 | 6 |
version="1.0" extension-element-prefixes="exslt" |
7 | 7 |
exclude-result-prefixes="xsl oaf dr dri dnet exslt"> |
8 | 8 |
|
9 |
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
|
9 |
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
|
10 | 10 |
|
11 |
<xsl:param name="invisible" select="false()"/>
|
|
12 |
<xsl:param name="trust" select="string('0.9')"/>
|
|
13 |
<xsl:param name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
|
|
14 |
<xsl:template match="/*">
|
|
15 |
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
|
16 |
<xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
|
|
17 |
<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
|
|
18 |
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
|
19 |
<xsl:variable name="namespaceprefix">
|
|
20 |
<xsl:choose>
|
|
21 |
<!-- TODO check namespaceprefix length is 12 -->
|
|
22 |
<xsl:when test="string-length(//oaf:datasourceprefix) > 0">
|
|
23 |
<xsl:value-of select="//oaf:datasourceprefix"/>
|
|
24 |
</xsl:when>
|
|
25 |
<xsl:otherwise>
|
|
26 |
<xsl:value-of select="unknown_____"/>
|
|
27 |
</xsl:otherwise>
|
|
28 |
</xsl:choose>
|
|
29 |
</xsl:variable>
|
|
11 |
<xsl:param name="invisible" select="false()"/>
|
|
12 |
<xsl:param name="trust" select="string('0.9')"/>
|
|
13 |
<xsl:param name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
|
|
14 |
<xsl:template match="/*">
|
|
15 |
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
|
16 |
<xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
|
|
17 |
<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
|
|
18 |
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
|
19 |
<xsl:variable name="namespaceprefix">
|
|
20 |
<xsl:choose>
|
|
21 |
<!-- TODO check namespaceprefix length is 12 -->
|
|
22 |
<xsl:when test="string-length(//oaf:datasourceprefix) > 0">
|
|
23 |
<xsl:value-of select="//oaf:datasourceprefix"/>
|
|
24 |
</xsl:when>
|
|
25 |
<xsl:otherwise>
|
|
26 |
<xsl:value-of select="unknown_____"/>
|
|
27 |
</xsl:otherwise>
|
|
28 |
</xsl:choose>
|
|
29 |
</xsl:variable>
|
|
30 | 30 |
|
31 |
<xsl:choose>
|
|
32 |
<xsl:when
|
|
33 |
test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
|
|
34 |
<ROWS/>
|
|
35 |
</xsl:when>
|
|
36 |
<xsl:otherwise>
|
|
31 |
<xsl:choose>
|
|
32 |
<xsl:when
|
|
33 |
test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
|
|
34 |
<ROWS/>
|
|
35 |
</xsl:when>
|
|
36 |
<xsl:otherwise>
|
|
37 | 37 |
|
38 |
<xsl:variable name="resultId"
|
|
39 |
select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
|
|
38 |
<xsl:variable name="resultId"
|
|
39 |
select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
|
|
40 | 40 |
|
41 |
<xsl:if test="string-length($resultId) > 0"> |
|
42 |
<xsl:variable name="originalids" |
|
43 |
select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/> |
|
44 |
<xsl:variable name="creators" select="//*[local-name() = 'creators']/*[local-name() = 'creator']"/> |
|
45 |
<xsl:variable name="titles" select="//*[local-name() = 'title']"/> |
|
46 |
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/> |
|
47 |
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/> |
|
48 |
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/> |
|
49 |
<xsl:variable name="dates" select="//*[local-name() = 'date']"/> |
|
50 |
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/> |
|
51 |
<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/> |
|
52 |
<xsl:variable name="formats" select="//*[local-name() = 'format']"/> |
|
53 |
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/> |
|
54 |
<xsl:variable name="rights" select="//oaf:accessrights"/> |
|
55 |
<xsl:variable name="license" select="//oaf:license"/> |
|
56 |
<xsl:variable name="version" select="//*[local-name() = 'version']"/> |
|
57 |
<xsl:variable name="language" select="//oaf:language"/> |
|
58 |
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/> |
|
59 |
<xsl:variable name="contributor" select="//*[local-name() = 'contributor']"/> |
|
60 |
<xsl:variable name="distributionlocation" select="//*[local-name() = 'alternateIdentifier' and @alternateIdentifierType='DistributionLocation']"/> |
|
61 |
<xsl:variable name="documentationUrl" select="//*[local-name() = 'relatedIdentifier' and @relatedIdentifierType='URL' and @relationType='IsDocumentedBy']"/> |
|
62 |
<xsl:variable name="landingPage" select="//*[local-name() = 'alternateIdentifier' and @alternateIdentifierType='LandingPage']/text()"/> |
|
41 |
<xsl:if test="string-length($resultId) > 0"> |
|
42 |
<xsl:variable name="originalids" |
|
43 |
select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/> |
|
44 |
<xsl:variable name="creators" select="//*[local-name() = 'creators']/*[local-name() = 'creator']"/> |
|
45 |
<xsl:variable name="titles" select="//*[local-name() = 'title']"/> |
|
46 |
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/> |
|
47 |
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/> |
|
48 |
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/> |
|
49 |
<xsl:variable name="dates" select="//*[local-name() = 'date']"/> |
|
50 |
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/> |
|
51 |
<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/> |
|
52 |
<xsl:variable name="formats" select="//*[local-name() = 'format']"/> |
|
53 |
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/> |
|
54 |
<xsl:variable name="rights" select="//oaf:accessrights"/> |
|
55 |
<xsl:variable name="license" select="//oaf:license"/> |
|
56 |
<xsl:variable name="version" select="//*[local-name() = 'version']"/> |
|
57 |
<xsl:variable name="language" select="//oaf:language"/> |
|
58 |
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/> |
|
59 |
<xsl:variable name="contributor" select="//*[local-name() = 'contributor']"/> |
|
60 |
<xsl:variable name="distributionlocation" |
|
61 |
select="//*[local-name() = 'alternateIdentifier' and @alternateIdentifierType='DistributionLocation']"/> |
|
62 |
<xsl:variable name="documentationUrl" |
|
63 |
select="//*[local-name() = 'relatedIdentifier' and @relatedIdentifierType='URL' and @relationType='IsDocumentedBy']"/> |
|
64 |
<xsl:variable name="landingPage" |
|
65 |
select="//*[local-name() = 'alternateIdentifier' and @alternateIdentifierType='LandingPage']/text()"/> |
|
63 | 66 |
|
64 |
<xsl:variable name="instanceURI"> |
|
65 |
<xsl:choose> |
|
66 |
<xsl:when |
|
67 |
test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']) > 0"> |
|
68 |
<xsl:value-of |
|
69 |
select="concat('http://dx.doi.org','/', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']/text())"/> |
|
70 |
</xsl:when> |
|
71 |
<xsl:when test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL']) > 0"> |
|
72 |
<xsl:value-of select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/> |
|
73 |
</xsl:when> |
|
74 |
<xsl:otherwise> |
|
75 |
<xsl:value-of select="concat('', //*[local-name() = 'resource']//*[local-name()='alternateIdentifier' and ./@alternateIdentifierType='URL'])"/> |
|
76 |
</xsl:otherwise> |
|
77 |
</xsl:choose> |
|
78 |
</xsl:variable> |
|
67 |
<xsl:variable name="instanceURI"> |
|
68 |
<xsl:choose> |
|
69 |
<xsl:when |
|
70 |
test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']) > 0"> |
|
71 |
<xsl:value-of |
|
72 |
select="concat('http://dx.doi.org','/', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']/text())"/> |
|
73 |
</xsl:when> |
|
74 |
<xsl:when |
|
75 |
test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL']) > 0"> |
|
76 |
<xsl:value-of |
|
77 |
select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/> |
|
78 |
</xsl:when> |
|
79 |
<xsl:otherwise> |
|
80 |
<xsl:value-of |
|
81 |
select="concat('', //*[local-name() = 'resource']//*[local-name()='alternateIdentifier' and ./@alternateIdentifierType='URL'])"/> |
|
82 |
</xsl:otherwise> |
|
83 |
</xsl:choose> |
|
84 |
</xsl:variable> |
|
79 | 85 |
|
80 |
<xsl:variable name="hostedby" select="//oaf:hostedBy"/>
|
|
81 |
<xsl:variable name="collectedfrom" select="//oaf:collectedFrom"/>
|
|
86 |
<xsl:variable name="hostedby" select="//oaf:hostedBy"/>
|
|
87 |
<xsl:variable name="collectedfrom" select="//oaf:collectedFrom"/>
|
|
82 | 88 |
|
83 |
<xsl:variable name="pids"
|
|
84 |
select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
|
|
89 |
<xsl:variable name="pids"
|
|
90 |
select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
|
|
85 | 91 |
|
86 |
<xsl:variable name="result"
|
|
87 |
select="dnet:odfResult($resultId, $invisible, $about, $metadata, $titles, $creators, $subjects, $publisher, $descriptions,
|
|
92 |
<xsl:variable name="result"
|
|
93 |
select="dnet:odfResult($resultId, $invisible, $about, $metadata, $titles, $creators, $subjects, $publisher, $descriptions,
|
|
88 | 94 |
$dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights, $license, |
89 | 95 |
$version, $pids, $provenance, $trust, $hostedby, $collectedfrom, $originalids, $instanceURI, $landingPage, $distributionlocation, |
90 | 96 |
$documentationUrl, $dateOfCollection, $dateoftransformation)"/> |
91 | 97 |
|
92 |
<ROWS>
|
|
93 |
<ROW key="{$resultId}" columnFamily="result">
|
|
94 |
<QUALIFIER name="body" type="base64">
|
|
95 |
<xsl:value-of select="$result"/>
|
|
96 |
</QUALIFIER>
|
|
97 |
</ROW>
|
|
98 |
<ROWS>
|
|
99 |
<ROW key="{$resultId}" columnFamily="result">
|
|
100 |
<QUALIFIER name="body" type="base64">
|
|
101 |
<xsl:value-of select="$result"/>
|
|
102 |
</QUALIFIER>
|
|
103 |
</ROW>
|
|
98 | 104 |
|
99 |
<xsl:for-each select="//*[local-name()='projectid']">
|
|
105 |
<xsl:for-each select="//*[local-name()='projectid']">
|
|
100 | 106 |
|
101 |
<xsl:variable name="projectId"
|
|
102 |
select="dnet:oafSplitId('project', normalize-space(.))"/>
|
|
107 |
<xsl:variable name="projectId"
|
|
108 |
select="dnet:oafSplitId('project', normalize-space(.))"/>
|
|
103 | 109 |
|
104 |
<xsl:variable name="resultproject"
|
|
105 |
select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy',
|
|
110 |
<xsl:variable name="resultproject"
|
|
111 |
select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy',
|
|
106 | 112 |
$collectedfrom, $provenance, $trust, $about)"/> |
107 |
<xsl:variable name="projectresult"
|
|
108 |
select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces',
|
|
113 |
<xsl:variable name="projectresult"
|
|
114 |
select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces',
|
|
109 | 115 |
$collectedfrom, $provenance, $trust, $about)"/> |
110 | 116 |
|
111 |
<xsl:if test="string-length($projectId) > 0">
|
|
112 |
<ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
|
|
113 |
<QUALIFIER name="{$projectId}" type="base64">
|
|
114 |
<xsl:value-of select="$resultproject"/>
|
|
115 |
</QUALIFIER>
|
|
116 |
</ROW>
|
|
117 |
<ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
|
|
118 |
<QUALIFIER name="{$resultId}" type="base64">
|
|
119 |
<xsl:value-of select="$projectresult"/>
|
|
120 |
</QUALIFIER>
|
|
121 |
</ROW>
|
|
122 |
</xsl:if>
|
|
123 |
</xsl:for-each>
|
|
117 |
<xsl:if test="string-length($projectId) > 0">
|
|
118 |
<ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
|
|
119 |
<QUALIFIER name="{$projectId}" type="base64">
|
|
120 |
<xsl:value-of select="$resultproject"/>
|
|
121 |
</QUALIFIER>
|
|
122 |
</ROW>
|
|
123 |
<ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
|
|
124 |
<QUALIFIER name="{$resultId}" type="base64">
|
|
125 |
<xsl:value-of select="$projectresult"/>
|
|
126 |
</QUALIFIER>
|
|
127 |
</ROW>
|
|
128 |
</xsl:if>
|
|
129 |
</xsl:for-each>
|
|
124 | 130 |
|
125 |
<xsl:for-each
|
|
126 |
select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']">
|
|
131 |
<xsl:for-each
|
|
132 |
select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']">
|
|
127 | 133 |
|
128 |
<!-- relatedDataset ids must be in the openaire format -->
|
|
129 |
<xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
|
|
134 |
<!-- relatedDataset ids must be in the openaire format -->
|
|
135 |
<xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
|
|
130 | 136 |
|
131 |
<xsl:if test="string-length($targetId) > 0">
|
|
137 |
<xsl:if test="string-length($targetId) > 0">
|
|
132 | 138 |
|
133 |
<xsl:variable name="resultDataset"
|
|
134 |
select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo',
|
|
139 |
<xsl:variable name="resultDataset"
|
|
140 |
select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo',
|
|
135 | 141 |
$collectedfrom, $provenance, $trust, $about)"/> |
136 |
<xsl:variable name="datasetResult"
|
|
137 |
select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy',
|
|
142 |
<xsl:variable name="datasetResult"
|
|
143 |
select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy',
|
|
138 | 144 |
$collectedfrom, $provenance, $trust, $about)"/> |
139 | 145 |
|
140 |
<ROW key="{$resultId}" columnFamily="resultResult_supplement_isSupplementTo">
|
|
141 |
<QUALIFIER name="{$targetId}" type="base64">
|
|
142 |
<xsl:value-of select="$resultDataset"/>
|
|
143 |
</QUALIFIER>
|
|
144 |
</ROW>
|
|
145 |
<ROW key="{$targetId}" columnFamily="resultResult_supplement_isSupplementedBy">
|
|
146 |
<QUALIFIER name="{$resultId}" type="base64">
|
|
147 |
<xsl:value-of select="$datasetResult"/>
|
|
148 |
</QUALIFIER>
|
|
149 |
</ROW>
|
|
150 |
</xsl:if>
|
|
151 |
</xsl:for-each>
|
|
146 |
<ROW key="{$resultId}" columnFamily="resultResult_supplement_isSupplementTo">
|
|
147 |
<QUALIFIER name="{$targetId}" type="base64">
|
|
148 |
<xsl:value-of select="$resultDataset"/>
|
|
149 |
</QUALIFIER>
|
|
150 |
</ROW>
|
|
151 |
<ROW key="{$targetId}" columnFamily="resultResult_supplement_isSupplementedBy">
|
|
152 |
<QUALIFIER name="{$resultId}" type="base64">
|
|
153 |
<xsl:value-of select="$datasetResult"/>
|
|
154 |
</QUALIFIER>
|
|
155 |
</ROW>
|
|
156 |
</xsl:if>
|
|
157 |
</xsl:for-each>
|
|
152 | 158 |
|
153 |
<xsl:for-each
|
|
154 |
select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
|
|
159 |
<xsl:for-each
|
|
160 |
select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
|
|
155 | 161 |
|
156 |
<!-- relatedDataset ids must be in the openaire format -->
|
|
157 |
<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
|
|
162 |
<!-- relatedDataset ids must be in the openaire format -->
|
|
163 |
<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
|
|
158 | 164 |
|
159 |
<xsl:if test="string-length($datasetId) > 0">
|
|
165 |
<xsl:if test="string-length($datasetId) > 0">
|
|
160 | 166 |
|
161 |
<xsl:variable name="childParent"
|
|
162 |
select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf',
|
|
167 |
<xsl:variable name="childParent"
|
|
168 |
select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf',
|
|
163 | 169 |
$collectedfrom, $provenance, $trust, $about)"/> |
164 |
<xsl:variable name="parentChild"
|
|
165 |
select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart',
|
|
170 |
<xsl:variable name="parentChild"
|
|
171 |
select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart',
|
|
166 | 172 |
$collectedfrom, $provenance, $trust, $about)"/> |
167 | 173 |
|
168 |
<ROW key="{$resultId}" columnFamily="resultResult_part_isPartOf">
|
|
169 |
<QUALIFIER name="{$datasetId}" type="base64">
|
|
170 |
<xsl:value-of select="$childParent"/>
|
|
171 |
</QUALIFIER>
|
|
172 |
</ROW>
|
|
173 |
<ROW key="{$datasetId}" columnFamily="resultResult_part_hasPart">
|
|
174 |
<QUALIFIER name="{$resultId}" type="base64">
|
|
175 |
<xsl:value-of select="$parentChild"/>
|
|
176 |
</QUALIFIER>
|
|
177 |
</ROW>
|
|
178 |
</xsl:if>
|
|
179 |
</xsl:for-each>
|
|
174 |
<ROW key="{$resultId}" columnFamily="resultResult_part_isPartOf">
|
|
175 |
<QUALIFIER name="{$datasetId}" type="base64">
|
|
176 |
<xsl:value-of select="$childParent"/>
|
|
177 |
</QUALIFIER>
|
|
178 |
</ROW>
|
|
179 |
<ROW key="{$datasetId}" columnFamily="resultResult_part_hasPart">
|
|
180 |
<QUALIFIER name="{$resultId}" type="base64">
|
|
181 |
<xsl:value-of select="$parentChild"/>
|
|
182 |
</QUALIFIER>
|
|
183 |
</ROW>
|
|
184 |
</xsl:if>
|
|
185 |
</xsl:for-each>
|
|
180 | 186 |
|
181 |
</ROWS>
|
|
182 |
</xsl:if>
|
|
183 |
</xsl:otherwise>
|
|
184 |
</xsl:choose>
|
|
185 |
</xsl:template>
|
|
187 |
</ROWS>
|
|
188 |
</xsl:if>
|
|
189 |
</xsl:otherwise>
|
|
190 |
</xsl:choose>
|
|
191 |
</xsl:template>
|
|
186 | 192 |
</xsl:stylesheet> |
Also available in: Unified diff
indentation