Revision 40708
Added by Claudio Atzori over 8 years ago
datacite2insertActions.xslt | ||
---|---|---|
35 | 35 |
<xsl:variable name="originalId" select="/record/metadata/*[local-name() = 'identifier' and ./@identifierType='DOI']"/> |
36 | 36 |
<xsl:variable name="resultId" select="dnet:oafSimpleId('result', //dri:objIdentifier)"/> |
37 | 37 |
|
38 |
<xsl:variable name="creators" select="//*[local-name() = 'creator']"/> |
|
39 |
<xsl:variable name="titles" select="//*[local-name() = 'title']"/> |
|
40 |
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/> |
|
41 |
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/> |
|
42 |
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/> |
|
43 |
<xsl:variable name="dates" select="//*[local-name() = 'date']"/> |
|
44 |
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/> |
|
45 |
<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/> |
|
46 |
<xsl:variable name="formats" select="//*[local-name() = 'format']"/> |
|
47 |
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/> |
|
48 |
<xsl:variable name="rights" select="//oaf:accessrights"/> |
|
49 |
<xsl:variable name="version" select="//*[local-name() = 'version']"/> |
|
50 |
<xsl:variable name="instanceURI" select="concat('http://dx.doi.org', '/', //*[local-name() = 'resource']/*[local-name() = 'identifier'])"/> |
|
51 |
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/> |
|
52 |
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/> |
|
53 |
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/> |
|
54 |
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/> |
|
55 |
<xsl:variable name="dateOfCollection" select="//dr:dateOfCollection"/> |
|
56 |
<xsl:variable name="language" select="//oaf:language"/> |
|
57 |
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/> |
|
58 |
<xsl:variable name="pids" select="//*[local-name() = 'resource']/*[local-name()='identifier']"/> |
|
38 |
<xsl:if test="string-length($resultId) > 0"> |
|
39 |
<xsl:variable name="originalids" |
|
40 |
select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/> |
|
59 | 41 |
|
60 |
<xsl:variable name="result" |
|
61 |
select="dnet:odfResult($resultId, $about, $metadata, $titles, $subjects, $publisher, $descriptions, |
|
62 |
$dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $rights, |
|
63 |
$version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid, |
|
64 |
$collectedfromname, $originalId, $instanceURI, $dateOfCollection)"/> |
|
42 |
<xsl:variable name="creators" select="//*[local-name() = 'creator']"/> |
|
43 |
<xsl:variable name="titles" select="//*[local-name() = 'title']"/> |
|
44 |
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/> |
|
45 |
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/> |
|
46 |
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/> |
|
47 |
<xsl:variable name="dates" select="//*[local-name() = 'date']"/> |
|
48 |
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/> |
|
49 |
<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/> |
|
50 |
<xsl:variable name="formats" select="//*[local-name() = 'format']"/> |
|
51 |
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/> |
|
52 |
<xsl:variable name="rights" select="//oaf:accessrights"/> |
|
53 |
<xsl:variable name="version" select="//*[local-name() = 'version']"/> |
|
54 |
<xsl:variable name="instanceURI" select="concat('http://dx.doi.org', '/', //*[local-name() = 'resource']/*[local-name() = 'identifier'])"/> |
|
55 |
<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/> |
|
56 |
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/> |
|
57 |
<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/> |
|
58 |
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/> |
|
59 |
<xsl:variable name="dateOfCollection" select="//dr:dateOfCollection"/> |
|
60 |
<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/> |
|
61 |
<xsl:variable name="language" select="//oaf:language"/> |
|
62 |
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/> |
|
63 |
<xsl:variable name="pids" select="//*[local-name() = 'resource']/*[local-name()='identifier']"/> |
|
65 | 64 |
|
66 |
<ACTIONS> |
|
67 |
<ACTION targetKey="{$resultId}" targetColumnFamily="result" targetColumn="body"> |
|
68 |
<xsl:value-of select="$result"/> |
|
69 |
</ACTION> |
|
65 |
<xsl:variable name="result" |
|
66 |
select="dnet:odfResult($resultId, $about, $metadata, $titles, $subjects, $publisher, $descriptions, |
|
67 |
$dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $rights, |
|
68 |
$version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid, |
|
69 |
$collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/> |
|
70 | 70 |
|
71 |
<xsl:for-each select="//*[local-name() = 'creator']"> |
|
72 |
<xsl:variable name="personIdTemp"> |
|
73 |
<xsl:choose> |
|
74 |
<xsl:when test="string-length(./*[local-name() = 'nameIdentifier']) > 0"> |
|
75 |
<xsl:value-of |
|
76 |
select="translate(normalize-space(./*[local-name() = 'nameIdentifier']),' .,','___')" |
|
77 |
/> |
|
78 |
</xsl:when> |
|
79 |
<xsl:otherwise> |
|
80 |
<xsl:value-of |
|
81 |
select="translate(normalize-space(./*[local-name() = 'creatorName']),' .,','___')" |
|
82 |
/> |
|
83 |
</xsl:otherwise> |
|
84 |
</xsl:choose> |
|
71 |
<ACTIONS> |
|
72 |
<ACTION targetKey="{$resultId}" targetColumnFamily="result" targetColumn="body"> |
|
73 |
<xsl:value-of select="$result"/> |
|
74 |
</ACTION> |
|
85 | 75 |
|
86 |
</xsl:variable> |
|
76 |
<xsl:for-each select="//*[local-name() = 'creator']"> |
|
77 |
<xsl:variable name="personIdTemp"> |
|
78 |
<xsl:choose> |
|
79 |
<xsl:when test="string-length(./*[local-name() = 'nameIdentifier']) > 0"> |
|
80 |
<xsl:value-of |
|
81 |
select="translate(normalize-space(./*[local-name() = 'nameIdentifier']),' .,','___')" |
|
82 |
/> |
|
83 |
</xsl:when> |
|
84 |
<xsl:otherwise> |
|
85 |
<xsl:value-of |
|
86 |
select="translate(normalize-space(./*[local-name() = 'creatorName']),' .,','___')" |
|
87 |
/> |
|
88 |
</xsl:otherwise> |
|
89 |
</xsl:choose> |
|
87 | 90 |
|
88 |
<xsl:variable name="personId" |
|
89 |
select="dnet:oafId('person', $namespaceprefix, concat($originalId, '::', normalize-space($personIdTemp)))"/> |
|
91 |
</xsl:variable> |
|
90 | 92 |
|
91 |
<xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/> |
|
92 |
<xsl:if test="string-length($personId) > 0"> |
|
93 |
<xsl:variable name="position" select="position()"/> |
|
94 |
<xsl:variable name="person" |
|
95 |
select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname, $originalPersonId, $dateOfCollection, normalize-space(./*[local-name() = 'creatorName']))"/> |
|
96 |
<xsl:variable name="personresult" |
|
97 |
select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf', $provenance, $trust, $about)"/> |
|
98 |
<xsl:variable name="resultperson" |
|
99 |
select="dnet:personResult_Authorship($resultId, $personId, $position, 'hasAuthor', $provenance, $trust, $about)"/> |
|
93 |
<xsl:variable name="personId" |
|
94 |
select="dnet:oafId('person', $namespaceprefix, concat($originalId, '::', normalize-space($personIdTemp)))"/> |
|
100 | 95 |
|
101 |
<ACTION targetKey="{$personId}" targetColumnFamily="person" targetColumn="body"> |
|
102 |
<xsl:value-of select="$person"/> |
|
103 |
</ACTION> |
|
104 |
<ACTION targetKey="{$personId}" targetColumnFamily="personResult_authorship_isAuthorOf" targetColumn="{$resultId}"> |
|
105 |
<xsl:value-of select="$personresult"/> |
|
106 |
</ACTION> |
|
107 |
<ACTION targetKey="{$resultId}" targetColumnFamily="personResult_authorship_hasAuthor" targetColumn="{$personId}"> |
|
108 |
<xsl:value-of select="$resultperson"/> |
|
109 |
</ACTION> |
|
110 |
</xsl:if> |
|
111 |
</xsl:for-each> |
|
112 |
<xsl:for-each select="//*[local-name()='relatedPublication']"> |
|
96 |
<xsl:variable name="originalPersonId" select="./*[local-name() = 'nameIdentifier']"/> |
|
97 |
<xsl:if test="string-length($personId) > 0"> |
|
98 |
<xsl:variable name="position" select="position()"/> |
|
99 |
<xsl:variable name="person" |
|
100 |
select="dnet:person($personId, $about, $provenance, $trust, $collectedfromid, $collectedfromname, |
|
101 |
$originalPersonId, $dateOfCollection, $dateoftransformation, normalize-space(./*[local-name() = 'creatorName']), |
|
102 |
./*[local-name() = 'nameIdentifier'], ./*[local-name() = 'nameIdentifier']/@nameIdentifierScheme)"/> |
|
103 |
<xsl:variable name="personresult" |
|
104 |
select="dnet:personResult_Authorship($personId, $resultId, $position, 'isAuthorOf', $provenance, $trust, $about)"/> |
|
105 |
<xsl:variable name="resultperson" |
|
106 |
select="dnet:personResult_Authorship($resultId, $personId, $position, 'hasAuthor', $provenance, $trust, $about)"/> |
|
113 | 107 |
|
114 |
<!-- relatedDataset ids must be in the openaire format --> |
|
115 |
<xsl:variable name="publicationId" select="dnet:oafSimpleId('result', normalize-space(./@id))"/> |
|
108 |
<ACTION targetKey="{$personId}" targetColumnFamily="person" targetColumn="body"> |
|
109 |
<xsl:value-of select="$person"/> |
|
110 |
</ACTION> |
|
111 |
<ACTION targetKey="{$personId}" targetColumnFamily="personResult_authorship_isAuthorOf" targetColumn="{$resultId}"> |
|
112 |
<xsl:value-of select="$personresult"/> |
|
113 |
</ACTION> |
|
114 |
<ACTION targetKey="{$resultId}" targetColumnFamily="personResult_authorship_hasAuthor" targetColumn="{$personId}"> |
|
115 |
<xsl:value-of select="$resultperson"/> |
|
116 |
</ACTION> |
|
117 |
</xsl:if> |
|
118 |
</xsl:for-each> |
|
119 |
<xsl:for-each select="//*[local-name()='relatedPublication']"> |
|
116 | 120 |
|
117 |
<xsl:if test="string-length($publicationId) > 0"> |
|
121 |
<!-- relatedDataset ids must be in the openaire format --> |
|
122 |
<xsl:variable name="publicationId" select="dnet:oafSimpleId('result', normalize-space(./@id))"/> |
|
118 | 123 |
|
119 |
<xsl:variable name="resultDataset" |
|
120 |
select="dnet:rel($resultId, $publicationId, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/> |
|
121 |
<xsl:variable name="datasetResult" |
|
122 |
select="dnet:rel($publicationId, $resultId, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/> |
|
124 |
<xsl:if test="string-length($publicationId) > 0"> |
|
123 | 125 |
|
124 |
<ACTION targetKey="{$resultId}" targetColumnFamily="resultResult_publicationDataset_isRelatedTo" targetColumn="{$publicationId}"> |
|
125 |
<xsl:value-of select="$resultDataset"/> |
|
126 |
</ACTION> |
|
127 |
<ACTION targetKey="{$publicationId}" targetColumnFamily="resultResult_publicationDataset_isRelatedTo" targetColumn="{$resultId}"> |
|
128 |
<xsl:value-of select="$datasetResult"/> |
|
129 |
</ACTION> |
|
130 |
</xsl:if> |
|
131 |
</xsl:for-each> |
|
126 |
<xsl:variable name="resultDataset" |
|
127 |
select="dnet:rel($resultId, $publicationId, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/> |
|
128 |
<xsl:variable name="datasetResult" |
|
129 |
select="dnet:rel($publicationId, $resultId, 'resultResult', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/> |
|
132 | 130 |
|
133 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']"> |
|
131 |
<ACTION targetKey="{$resultId}" targetColumnFamily="resultResult_publicationDataset_isRelatedTo" targetColumn="{$publicationId}"> |
|
132 |
<xsl:value-of select="$resultDataset"/> |
|
133 |
</ACTION> |
|
134 |
<ACTION targetKey="{$publicationId}" targetColumnFamily="resultResult_publicationDataset_isRelatedTo" targetColumn="{$resultId}"> |
|
135 |
<xsl:value-of select="$datasetResult"/> |
|
136 |
</ACTION> |
|
137 |
</xsl:if> |
|
138 |
</xsl:for-each> |
|
134 | 139 |
|
135 |
<!-- relatedDataset ids must be in the openaire format --> |
|
136 |
<xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/> |
|
140 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']"> |
|
137 | 141 |
|
138 |
<xsl:if test="string-length($targetId) > 0"> |
|
142 |
<!-- relatedDataset ids must be in the openaire format --> |
|
143 |
<xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/> |
|
139 | 144 |
|
140 |
<xsl:variable name="resultDataset" |
|
141 |
select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo', $provenance, $trust, $about)"/> |
|
142 |
<xsl:variable name="datasetResult" |
|
143 |
select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy', $provenance, $trust, $about)"/> |
|
145 |
<xsl:if test="string-length($targetId) > 0"> |
|
144 | 146 |
|
145 |
<ACTION targetKey="{$resultId}" targetColumnFamily="resultResult_supplement_isSupplementTo" targetColumn="$targetId"> |
|
146 |
<xsl:value-of select="$resultDataset"/> |
|
147 |
</ACTION> |
|
148 |
<ACTION targetKey="{$targetId}" targetColumnFamily="resultResult_supplement_isSupplementedBy" targetColumn="$resultId"> |
|
149 |
<xsl:value-of select="$datasetResult"/> |
|
150 |
</ACTION> |
|
151 |
</xsl:if> |
|
152 |
</xsl:for-each> |
|
153 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']"> |
|
147 |
<xsl:variable name="resultDataset" |
|
148 |
select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo', $provenance, $trust, $about)"/> |
|
149 |
<xsl:variable name="datasetResult" |
|
150 |
select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy', $provenance, $trust, $about)"/> |
|
154 | 151 |
|
155 |
<!-- relatedDataset ids must be in the openaire format --> |
|
156 |
<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/> |
|
152 |
<ACTION targetKey="{$resultId}" targetColumnFamily="resultResult_supplement_isSupplementTo" targetColumn="$targetId"> |
|
153 |
<xsl:value-of select="$resultDataset"/> |
|
154 |
</ACTION> |
|
155 |
<ACTION targetKey="{$targetId}" targetColumnFamily="resultResult_supplement_isSupplementedBy" targetColumn="$resultId"> |
|
156 |
<xsl:value-of select="$datasetResult"/> |
|
157 |
</ACTION> |
|
158 |
</xsl:if> |
|
159 |
</xsl:for-each> |
|
160 |
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']"> |
|
157 | 161 |
|
158 |
<xsl:if test="string-length($datasetId) > 0"> |
|
162 |
<!-- relatedDataset ids must be in the openaire format --> |
|
163 |
<xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/> |
|
159 | 164 |
|
160 |
<xsl:variable name="childParent" |
|
161 |
select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf', $provenance, $trust, $about)"/> |
|
162 |
<xsl:variable name="parentChild" |
|
163 |
select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart', $provenance, $trust, $about)"/> |
|
165 |
<xsl:if test="string-length($datasetId) > 0"> |
|
164 | 166 |
|
165 |
<ACTION targetKey="{$resultId}" targetColumnFamily="resultResult_part_isPartOf" targetColumn="$datasetId"> |
|
166 |
<xsl:value-of select="$childParent"/> |
|
167 |
</ACTION> |
|
168 |
<ACTION targetKey="{$datasetId}" targetColumnFamily="resultResult_part_hasPart" targetColumn="$resultId"> |
|
169 |
<xsl:value-of select="$parentChild"/> |
|
170 |
</ACTION> |
|
171 |
</xsl:if> |
|
172 |
</xsl:for-each> |
|
167 |
<xsl:variable name="childParent" |
|
168 |
select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf', $provenance, $trust, $about)"/> |
|
169 |
<xsl:variable name="parentChild" |
|
170 |
select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart', $provenance, $trust, $about)"/> |
|
173 | 171 |
|
174 |
</ACTIONS> |
|
172 |
<ACTION targetKey="{$resultId}" targetColumnFamily="resultResult_part_isPartOf" targetColumn="$datasetId"> |
|
173 |
<xsl:value-of select="$childParent"/> |
|
174 |
</ACTION> |
|
175 |
<ACTION targetKey="{$datasetId}" targetColumnFamily="resultResult_part_hasPart" targetColumn="$resultId"> |
|
176 |
<xsl:value-of select="$parentChild"/> |
|
177 |
</ACTION> |
|
178 |
</xsl:if> |
|
179 |
</xsl:for-each> |
|
180 |
|
|
181 |
</ACTIONS> |
|
182 |
</xsl:if> |
|
175 | 183 |
</xsl:otherwise> |
176 | 184 |
</xsl:choose> |
177 | 185 |
</xsl:template> |
Also available in: Unified diff
unit test: classpath xslts updated to latest changes