Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="a8258f53-3cc0-4353-879f-699883fd1d0c_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="oaf_hbase" />  
13
            <IMPORTED/>
14
            <SCRIPT>
15
	            <TITLE>xslt_mapping_odf2hbase</TITLE>
16
                <CODE>
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
            xmlns:oaf="http://namespace.openaire.eu/oaf"
19
            xmlns:dnet="eu.dnetlib.data.transform.xml.OdfToHbaseXsltFunctions"
20
            xmlns:dri="http://www.driver-repository.eu/namespace/dri"
21
            xmlns:dr="http://www.driver-repository.eu/namespace/dr" 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

    
25
<xsl:output omit-xml-declaration="yes" indent="yes"/>
26

    
27
<xsl:param name="trust" select="string('0.9')"/>
28
<xsl:param name="provenance" select="string('sysimport:crosswalk:datasetarchive')"/>
29
<xsl:template match="/*">
30
    <xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
31
    <xsl:variable name="dateOfCollection" select="concat('', //dri:dateOfCollection)"/>
32
    <xsl:variable name="dateoftransformation" select="concat('', //dr:dateOfTransformation)"/>
33
    <xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
34
    <xsl:variable name="namespaceprefix">
35
        <xsl:choose>
36
            <!-- TODO check namespaceprefix length is 12 -->
37
            <xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
38
                <xsl:value-of select="//oaf:datasourceprefix"/>
39
            </xsl:when>
40
            <xsl:otherwise>
41
                <xsl:value-of select="unknown_____"/>
42
            </xsl:otherwise>
43
        </xsl:choose>
44
    </xsl:variable>
45

    
46
    <xsl:choose>
47
        <xsl:when
48
                test="count($metadata) = 0 or normalize-space(//oaf:skipRecord)= 'true'">
49
            <ROWS/>
50
        </xsl:when>
51
        <xsl:otherwise>
52

    
53
            <xsl:variable name="resultId"
54
                          select="dnet:oafSimpleId('result', //dri:objIdentifier)"/>
55

    
56
            <xsl:if test="string-length($resultId) &gt; 0">
57
                <xsl:variable name="originalids"
58
                              select="//*[local-name() = 'resource']/*[local-name()='identifier'] | //*[local-name() = 'resource']//*[local-name()='alternateIdentifier']"/>
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="language" select="//oaf:language"/>
71
                <xsl:variable name="cobjcategory" select="//dr:CobjCategory"/>
72
                <xsl:variable name="contributor" select="//*[local-name() = 'contributor']/*[local-name() = 'contributorName']"/>
73

    
74
                <xsl:variable name="instanceURI">
75
	                <xsl:choose>
76
		                <xsl:when
77
				                test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']) &gt; 0">
78
			                <xsl:value-of
79
					                select="concat('http://dx.doi.org','/', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='DOI']/text())"/>
80
		                </xsl:when>
81
		                <xsl:when test="string-length( //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL']) &gt; 0">
82
			                <xsl:value-of select="concat('', //*[local-name() = 'resource']/*[local-name()='identifier' and ./@identifierType='URL'])"/>
83
		                </xsl:when>
84
		                <xsl:otherwise>
85
			                <xsl:value-of select="concat('', //*[local-name() = 'resource']//*[local-name()='alternateIdentifier' and ./@alternateIdentifierType='URL'])"/>
86
		                </xsl:otherwise>
87
	                </xsl:choose>
88
                </xsl:variable>
89

    
90
                <xsl:variable name="hostedbyid"
91
                              select="dnet:oafSplitId('datasource', //oaf:hostedBy/@id)"/>
92
                <xsl:variable name="hostedbyname" select="concat('', //oaf:hostedBy/@name)"/>
93
                <xsl:variable name="collectedfromid"
94
                              select="dnet:oafSplitId('datasource', //oaf:collectedFrom/@id)"/>
95
                <xsl:variable name="collectedfromname"
96
                              select="concat('', //oaf:collectedFrom/@name)"/>
97

    
98
                <xsl:variable name="pids"
99
                              select="//*[local-name() = 'resource']//*[local-name()='identifier'or local-name()='alternateIdentifier']"/>
100

    
101
                <xsl:variable name="result"
102
                              select="dnet:odfResult($resultId, $about, $metadata, $titles, $subjects, $publisher, $descriptions,
103
                        $dates, $dateaccepted, $resourceType, $formats, $sizes, $language, $cobjcategory, $contributor, $rights,
104
                        $version, $pids, $provenance, $trust, $hostedbyid, $hostedbyname, $collectedfromid,
105
                        $collectedfromname, $originalids, $instanceURI, $dateOfCollection, $dateoftransformation)"/>
106

    
107
                <ROWS>
108
	                <ROW key="{$resultId}" columnFamily="result">
109
		                <QUALIFIER name="body" type="base64">
110
			                <xsl:value-of select="$result"/>
111
		                </QUALIFIER>
112
	                </ROW>
113

    
114
	                <xsl:for-each select="//*[local-name()='projectid']">
115

    
116
		                <xsl:variable name="projectId"
117
		                              select="dnet:oafSplitId('project', normalize-space(.))"/>
118

    
119
		                <xsl:variable name="resultproject"
120
		                              select="dnet:rel($resultId, $projectId, 'resultProject', 'outcome', 'isProducedBy',
121
		                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
122
		                <xsl:variable name="projectresult"
123
		                              select="dnet:rel($projectId, $resultId, 'resultProject', 'outcome', 'produces',
124
		                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
125

    
126
		                <xsl:if test="string-length($projectId) &gt; 0">
127
			                <ROW key="{$resultId}" columnFamily="resultProject_outcome_isProducedBy">
128
				                <QUALIFIER name="{$projectId}" type="base64">
129
					                <xsl:value-of select="$resultproject"/>
130
				                </QUALIFIER>
131
			                </ROW>
132
			                <ROW key="{$projectId}" columnFamily="resultProject_outcome_produces">
133
				                <QUALIFIER name="{$resultId}" type="base64">
134
					                <xsl:value-of select="$projectresult"/>
135
				                </QUALIFIER>
136
			                </ROW>
137
		                </xsl:if>
138
	                </xsl:for-each>
139

    
140
	                <xsl:for-each
141
			                select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsSupplementTo']">
142

    
143
		                <!-- relatedDataset ids must be in the openaire format  -->
144
		                <xsl:variable name="targetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
145

    
146
		                <xsl:if test="string-length($targetId) &gt; 0">
147

    
148
			                <xsl:variable name="resultDataset"
149
			                              select="dnet:rel($resultId, $targetId, 'resultResult', 'supplement', 'isSupplementTo',
150
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
151
			                <xsl:variable name="datasetResult"
152
			                              select="dnet:rel($targetId, $resultId, 'resultResult', 'supplement', 'isSupplementedBy',
153
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
154

    
155
			                <ROW key="{$resultId}" columnFamily="resultResult_supplement_isSupplementTo">
156
				                <QUALIFIER name="{$targetId}" type="base64">
157
					                <xsl:value-of select="$resultDataset"/>
158
				                </QUALIFIER>
159
			                </ROW>
160
			                <ROW key="{$targetId}" columnFamily="resultResult_supplement_isSupplementedBy">
161
				                <QUALIFIER name="{$resultId}" type="base64">
162
					                <xsl:value-of select="$datasetResult"/>
163
				                </QUALIFIER>
164
			                </ROW>
165
		                </xsl:if>
166
	                </xsl:for-each>
167

    
168
	                <xsl:for-each
169
			                select="//*[local-name()='relatedIdentifier' and ./@relatedIdentifierType='OPENAIRE' and ./@relationType='IsPartOf']">
170

    
171
		                <!-- relatedDataset ids must be in the openaire format  -->
172
		                <xsl:variable name="datasetId" select="dnet:oafSimpleId('result', normalize-space(.))"/>
173

    
174
		                <xsl:if test="string-length($datasetId) &gt; 0">
175

    
176
			                <xsl:variable name="childParent"
177
			                              select="dnet:rel($resultId, $datasetId, 'resultResult', 'part', 'isPartOf',
178
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
179
			                <xsl:variable name="parentChild"
180
			                              select="dnet:rel($datasetId, $resultId, 'resultResult', 'part', 'hasPart',
181
			                              $collectedfromid, $collectedfromname, $provenance, $trust, $about)"/>
182

    
183
			                <ROW key="{$resultId}" columnFamily="resultResult_part_isPartOf">
184
				                <QUALIFIER name="{$datasetId}" type="base64">
185
					                <xsl:value-of select="$childParent"/>
186
				                </QUALIFIER>
187
			                </ROW>
188
			                <ROW key="{$datasetId}" columnFamily="resultResult_part_hasPart">
189
				                <QUALIFIER name="{$resultId}" type="base64">
190
					                <xsl:value-of select="$parentChild"/>
191
				                </QUALIFIER>
192
			                </ROW>
193
		                </xsl:if>
194
	                </xsl:for-each>
195

    
196
                </ROWS>
197
            </xsl:if>
198
        </xsl:otherwise>
199
    </xsl:choose>
200
</xsl:template>
201
</xsl:stylesheet>
202
	</CODE>
203
            </SCRIPT>
204
        </CONFIGURATION>
205
		<STATUS />
206
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
207
	</BODY>
208
</RESOURCE_PROFILE>
(67-67/82)