Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="a799b5eb-6a6f-427f-b7fc-2d05778a6be3_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="oaf" layout="store" interpretation="cleaned"/>
12
			<SINK_METADATA_FORMAT name="oaf_update_action"/>
13
			<IMPORTED/>
14
			<SCRIPT>
15
				<TITLE>xslt_mapping_oaf2updateAction</TITLE>
16
				<CODE>
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
                xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
19
                xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa"
20
                xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dnet="eu.dnetlib.data.transform.xml.OafToHbaseXsltFunctions"
21
                xmlns:date="java.lang.System"
22
                xmlns:exslt="http://exslt.org/common"
23
                version="1.0"
24
                extension-element-prefixes="exslt"
25
                exclude-result-prefixes="xsl dc dr dri oaa oaf dnet exslt date">
26

    
27
	<xsl:output omit-xml-declaration="yes" indent="yes"/>
28

    
29
	<xsl:param name="trust" select="string('0.9')"/>
30
	<xsl:param name="provenance" select="string('UNKNOWN')"/>
31
	<xsl:param name="namespaceprefix" select="string('unknown_____')"/>
32

    
33
	<xsl:template match="/*">
34
		<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
35
		<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
36
		<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/>
37

    
38
		<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
39
		<xsl:variable name="collectedDatasourceid">
40
			<xsl:choose>
41
				<xsl:when test="string-length(//oaf:collectedDatasourceid) &gt; 0">
42
					<xsl:value-of select="//oaf:collectedDatasourceid"/>
43
				</xsl:when>
44
				<xsl:otherwise>
45
					<xsl:value-of select="UNKNOWN"/>
46
				</xsl:otherwise>
47
			</xsl:choose>
48
		</xsl:variable>
49

    
50
		<xsl:choose>
51
			<xsl:when test="count($metadata) = 0">
52
				<ACTIONS/>
53
			</xsl:when>
54
			<xsl:otherwise>
55

    
56
				<xsl:variable name="objidentifier" select="/record/*[local-name() = 'header']/*[local-name() = 'objIdentifier']"/>
57

    
58
				<xsl:variable name="publicationId" select="dnet:oafSimpleId('publication', $objidentifier)"/>
59

    
60
				<xsl:variable name="hostedbyid" select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
61
				<xsl:variable name="hostedbyname" select="//oaf:hostedBy/@name"/>
62

    
63
				<xsl:variable name="collectedfromid" select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
64
				<xsl:variable name="collectedfromname" select="//oaf:collectedFrom/@name"/>
65

    
66
				<!-- 				<xsl:variable name="country" select="substring(//dr:repositoryCountry,  1, 200)" /> -->
67
				<!-- 				<xsl:variable name="accessmode" select="substring(//oaf:accessrights,   1, 200)" /> -->
68

    
69
				<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
70
				<xsl:variable name="originalid">
71
					<xsl:choose>
72
						<xsl:when test="contains($originalidTest, '::')">
73
							<xsl:value-of select="substring-after($originalidTest, '::')"/>
74
						</xsl:when>
75
						<xsl:otherwise>
76
							<xsl:value-of select="$originalidTest"/>
77
						</xsl:otherwise>
78
					</xsl:choose>
79
				</xsl:variable>
80

    
81
				<xsl:variable name="publication"
82
				              select="dnet:oafPublication($publicationId, $provenance, $trust, $about, $hostedbyid, $hostedbyname,
83
	                          $collectedfromid, $collectedfromname, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
84

    
85
				<ACTIONS>
86
					<ACTION targetKey="{$publicationId}" targetColumnFamily="publication" targetColumn="{concat('update_', date:nanoTime())}">
87
						<xsl:value-of select="$publication"/>
88
					</ACTION>
89
				</ACTIONS>
90
			</xsl:otherwise>
91
		</xsl:choose>
92
	</xsl:template>
93

    
94
</xsl:stylesheet>
95
				</CODE>
96
			</SCRIPT>
97
		</CONFIGURATION>
98
		<STATUS/>
99
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
100
	</BODY>
101
</RESOURCE_PROFILE>
(54-54/73)