1
|
<RESOURCE_PROFILE>
|
2
|
<HEADER>
|
3
|
<RESOURCE_IDENTIFIER value="4d85a2b2-c97e-4369-ac18-bb7b4ba43c2b_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
|
4
|
<RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
|
5
|
<RESOURCE_KIND value="TransformationRuleDSResources"/>
|
6
|
<RESOURCE_URI value=""/>
|
7
|
<DATE_OF_CREATION value="2015-02-27T17:15:30+00:00"/>
|
8
|
</HEADER>
|
9
|
<BODY>
|
10
|
<CONFIGURATION>
|
11
|
<SOURCE_METADATA_FORMAT name="odf" layout="store" interpretation="cleaned"/>
|
12
|
<SINK_METADATA_FORMAT name="odf_update_action"/>
|
13
|
<IMPORTED/>
|
14
|
<SCRIPT>
|
15
|
<TITLE>xslt_mapping_odf2updateAction</TITLE>
|
16
|
<CODE>
|
17
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
18
|
xmlns:dnet="eu.dnetlib.data.transform.xml.OdfToHbaseXsltFunctions"
|
19
|
xmlns:oaf="http://namespace.openaire.eu/oaf"
|
20
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
21
|
xmlns:date="java.lang.System"
|
22
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
23
|
xmlns:exslt="http://exslt.org/common" version="1.0"
|
24
|
extension-element-prefixes="exslt" exclude-result-prefixes="xsl dnet exslt oaf dr dri date">
|
25
|
|
26
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
27
|
|
28
|
<xsl:param name="trust" select="string('0.9')"/>
|
29
|
<xsl:param name="provenance" select="string('UNKNOWN')"/>
|
30
|
<xsl:param name="namespaceprefix" select="string('datacite____')"/>
|
31
|
|
32
|
<xsl:template match="/*">
|
33
|
<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
|
34
|
<xsl:variable name="metadata" select="exslt:node-set(/*[local-name()='record']/*[local-name()='metadata']/*[local-name()='resource'])"/>
|
35
|
<xsl:variable name="rightNSPrefix">
|
36
|
<xsl:choose>
|
37
|
<xsl:when test="not($namespaceprefix)">
|
38
|
<xsl:value-of select="//oaf:datasourceprefix"/>
|
39
|
</xsl:when>
|
40
|
<xsl:otherwise>
|
41
|
<xsl:value-of select="$namespaceprefix"/>
|
42
|
</xsl:otherwise>
|
43
|
</xsl:choose>
|
44
|
</xsl:variable>
|
45
|
|
46
|
<xsl:choose>
|
47
|
<xsl:when test="count($metadata) = 0">
|
48
|
<ACTIONS/>
|
49
|
</xsl:when>
|
50
|
<xsl:otherwise>
|
51
|
<xsl:variable name="originalId" select="//*[local-name() = 'identifier' and ./@identifierType='DOI']"/>
|
52
|
<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', //dri:objIdentifier)"/>
|
53
|
|
54
|
<xsl:if test="string-length($datasetId) > 0">
|
55
|
<xsl:variable name="originalids"
|
56
|
select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
|
57
|
|
58
|
<xsl:variable name="creators" select="//*[local-name() = 'creator']"/>
|
59
|
<xsl:variable name="titles" select="//*[local-name() = 'title']"/>
|
60
|
<xsl:variable name="subjects" select="//*[local-name() = 'subject']"/>
|
61
|
<xsl:variable name="publisher" select="//*[local-name() = 'publisher']"/>
|
62
|
<xsl:variable name="descriptions" select="//*[local-name() = 'description']"/>
|
63
|
<xsl:variable name="dates" select="//*[local-name() = 'date']"/>
|
64
|
<xsl:variable name="dateaccepted" select="//oaf:dateAccepted"/>
|
65
|
<xsl:variable name="resourceType" select="//*[local-name() = 'resourceType']"/>
|
66
|
<xsl:variable name="formats" select="//*[local-name() = 'format']"/>
|
67
|
<xsl:variable name="sizes" select="//*[local-name() = 'size']"/>
|
68
|
<xsl:variable name="rights" select="//oaf:accessrights"/>
|
69
|
<xsl:variable name="version" select="//*[local-name() = 'version']"/>
|
70
|
<xsl:variable name="instanceURI"
|
71
|
select="concat('http://dx.doi.org','/',//*[local-name() = 'resource']/*[local-name() = 'identifier'])"/>
|
72
|
<xsl:variable name="hostedbyid"
|
73
|
select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
|
74
|
<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
|
75
|
<xsl:variable name="collectedfromid"
|
76
|
select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
|
77
|
<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
|
78
|
<xsl:variable name="dateOfCollection" select="//dr:dateOfCollection"/>
|
79
|
<xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
|
80
|
<xsl:variable name="language" select="//oaf:language"/>
|
81
|
<xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
|
82
|
<xsl:variable name="contributors" select="//*[local-name() = 'contributorName']"/>
|
83
|
<xsl:variable name="pids" select="//*[local-name() = 'resource']/*[local-name()='identifier']"/>
|
84
|
|
85
|
<xsl:variable name="dataset"
|
86
|
select="dnet:odfDataset($datasetId, $about, $metadata, $titles, $subjects, $publisher, $descriptions,
|
87
|
$dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributors, $rights,
|
88
|
$version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
|
89
|
$collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
|
90
|
<ACTIONS>
|
91
|
<ACTION targetKey="{$datasetId}" targetColumnFamily="dataset" targetColumn="{concat('update_', date:nanoTime())}">
|
92
|
<xsl:value-of select="$dataset"/>
|
93
|
</ACTION>
|
94
|
</ACTIONS>
|
95
|
</xsl:if>
|
96
|
</xsl:otherwise>
|
97
|
</xsl:choose>
|
98
|
</xsl:template>
|
99
|
</xsl:stylesheet>
|
100
|
</CODE>
|
101
|
</SCRIPT>
|
102
|
</CONFIGURATION>
|
103
|
<STATUS/>
|
104
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
105
|
</BODY>
|
106
|
</RESOURCE_PROFILE>
|