Project

General

Profile

1
<RESOURCE_PROFILE>
2
	<HEADER>
3
		<RESOURCE_IDENTIFIER value="43108eba-4b67-4d7a-8928-55ca09f1c8ff_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="pmf" layout="store" interpretation="cleaned"/>
12
			<SINK_METADATA_FORMAT name="dngf_hbase"/>
13
			<IMPORTED/>
14
			<SCRIPT>
15
				<TITLE>xslt_mapping_pmf2hbase</TITLE>
16
				<CODE>
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
18
				xmlns:dnet="eu.dnetlib.data.transform.xml.PmfToHbaseXsltFunctions"
19
				xmlns:exslt="http://exslt.org/common"
20
				xmlns:oaf="http://namespace.dnet.eu/oaf"
21
				xmlns:dc="http://purl.org/dc/elements/1.1/"
22
				xmlns:dri="http://www.driver-repository.eu/namespace/dri"
23
				xmlns:dr="http://www.driver-repository.eu/namespace/dr"
24
				version="1.0" extension-element-prefixes="exslt"
25
				exclude-result-prefixes="xsl oaf dr dri dnet exslt">
26

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

    
29
	<xsl:param name="writeCoAuthors" select="false()"/>
30

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

    
36
		<xsl:variable name="trust" select="string('0.9')"/>
37
		<xsl:variable name="provenance" select="string('sysimport:crosswalk:repository')"/>
38

    
39
		<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
40
		<xsl:variable name="namespaceprefix">
41
			<xsl:choose>
42

    
43
				<!-- TODO check namespaceprefix length is 12 -->
44
				<xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
45
					<xsl:value-of select="//oaf:datasourceprefix"/>
46
				</xsl:when>
47
				<xsl:when test="string-length(//dri:datasourceprefix) &gt; 0">
48
					<xsl:value-of select="//dri:datasourceprefix"/>
49
				</xsl:when>
50
				<xsl:otherwise>
51
					<xsl:value-of select="unknown_"/>
52
				</xsl:otherwise>
53
			</xsl:choose>
54
		</xsl:variable>
55

    
56
		<xsl:choose>
57
			<!-- 			<xsl:when test="count($metadata) = 0 or string-length($namespaceprefix) = 0"> -->
58
			<xsl:when test="count($metadata) = 0">
59
				<ROWS/>
60
			</xsl:when>
61
			<xsl:otherwise>
62

    
63
				<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
64
				<xsl:variable name="publicationId"
65
							  select="dnet:oafSimpleId('publication', //dri:objIdentifier)"/>
66

    
67
				<xsl:if test="string-length($publicationId) &gt; 0">
68
					<xsl:variable name="originalidTest"
69
								  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
					<ROWS>
82
						<ROW key="{$publicationId}" columnFamily="metadata">
83
							<QUALIFIER name="body" type="base64">
84
								<xsl:value-of select="dnet:pmfPublication($publicationId, $provenance, $trust, $about, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
85
							</QUALIFIER>
86
						</ROW>
87

    
88
						<xsl:for-each
89
								select="//*[local-name()='relatedIdentifier' and ./@entityType='dataset']">
90

    
91
							<xsl:variable name="relationSemantic" select="./@relationType"/>
92

    
93
							<!-- relatedDataset ids must be in the openaire format  -->
94
							<xsl:variable name="datasetId"
95
										  select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
96

    
97
							<xsl:if test="string-length($datasetId) &gt; 0">
98
								<ROW key="{$publicationId}" columnFamily="rel">
99
									<QUALIFIER name="{$datasetId}" type="base64">
100
										<xsl:value-of select="dnet:createRel($publicationId, $datasetId, 'publicationDataset', 'isRelatedTo', $relationSemantic, $provenance, $trust, $about)"/>
101
									</QUALIFIER>
102
								</ROW>
103
								<ROW key="{$datasetId}" columnFamily="rel">
104
									<QUALIFIER name="{$publicationId}" type="base64">
105
										<xsl:value-of select="dnet:createRel( $datasetId, $publicationId, 'publicationDataset', 'isRelatedTo', $relationSemantic, $provenance, $trust, $about)"/>
106
									</QUALIFIER>
107
								</ROW>
108

    
109
							</xsl:if>
110
						</xsl:for-each>
111

    
112
						<xsl:for-each
113
								select="//*[local-name()='relatedIdentifier' and ./@entityType='publication']">
114

    
115
							<xsl:variable name="relationSemantic" select="./@relationType"/>
116

    
117

    
118
							<!-- relatedPublication ids must be in the openaire format  -->
119
							<xsl:variable name="targetPublication"
120
										  select="dnet:oafSimpleId('publication', normalize-space(.))"/>
121

    
122
							<xsl:if test="string-length($targetPublication) &gt; 0">
123
								<ROW key="{$publicationId}" columnFamily="rel">
124
									<QUALIFIER name="{$targetPublication}" type="base64">
125
										<xsl:value-of select="dnet:createRel($publicationId, $targetPublication, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
126
									</QUALIFIER>
127
								</ROW>
128

    
129
								<ROW key="{$targetPublication}" columnFamily="rel">
130
									<QUALIFIER name="{$publicationId}" type="base64">
131
										<xsl:value-of select="dnet:createRel($targetPublication, $publicationId, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
132
									</QUALIFIER>
133
								</ROW>
134
							</xsl:if>
135
						</xsl:for-each>
136

    
137

    
138
						<!--UNKOWN RELATIONS-->
139

    
140
						<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='unknown']">
141

    
142
							<xsl:variable name="enityId">
143
								<xsl:value-of select="dnet:createEntityId(./@relatedIdentifierType, ., $namespaceprefix)"/>
144
							</xsl:variable>
145

    
146
							<ROW key="{$enityId}" columnFamily="metadata">
147
								<QUALIFIER name="body" type="base64">
148
									<xsl:value-of select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about)"/>
149
								</QUALIFIER>
150
							</ROW>
151

    
152
							<xsl:variable name="relationSemantic" select="./@relationType"/>
153

    
154
							<ROW key="{$publicationId}" columnFamily="rel">
155
								<QUALIFIER name="{$enityId}" type="base64">
156
									<xsl:value-of select="dnet:createRel($publicationId, $enityId, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
157
								</QUALIFIER>
158
							</ROW>
159
							<ROW key="{$enityId}" columnFamily="rel">
160
								<QUALIFIER name="{$publicationId}" type="base64">
161
									<xsl:value-of select="dnet:createRel($enityId, $publicationId, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
162
								</QUALIFIER>
163
							</ROW>
164
						</xsl:for-each>
165
					</ROWS>
166
				</xsl:if>
167
			</xsl:otherwise>
168
		</xsl:choose>
169
	</xsl:template>
170
</xsl:stylesheet>
171
				</CODE>
172
			</SCRIPT>
173
		</CONFIGURATION>
174
		<STATUS/>
175
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
176
	</BODY>
177
</RESOURCE_PROFILE>
(2-2/2)