Project

General

Profile

1 44298 sandro.lab
<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 44352 sandro.lab
					<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
					                version="1.0" extension-element-prefixes="exslt"
21
					                exclude-result-prefixes="xsl oaf dr dri dnet exslt">
22 44298 sandro.lab
23 44303 claudio.at
	<xsl:output omit-xml-declaration="yes" indent="yes"/>
24 44298 sandro.lab
25 44303 claudio.at
	<xsl:param name="writeCoAuthors" select="false()"/>
26 44298 sandro.lab
27 44303 claudio.at
	<xsl:template match="/*">
28
		<xsl:variable name="about" select="/*[local-name() = 'record']/*[local-name() = 'about']"/>
29
		<xsl:variable name="dateofcollection" select="//dr:dateOfCollection"/>
30
		<xsl:variable name="dateoftransformation" select="//dr:dateOfTransformation"/>
31 44298 sandro.lab
32 44303 claudio.at
		<xsl:variable name="trust" select="string('0.9')"/>
33
		<xsl:variable name="provenance" select="string('sysimport:crosswalk:repository')"/>
34 44298 sandro.lab
35 44303 claudio.at
		<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
36
		<xsl:variable name="namespaceprefix">
37
			<xsl:choose>
38 44298 sandro.lab
39 44303 claudio.at
				<!-- TODO check namespaceprefix length is 12 -->
40
				<xsl:when test="string-length(//oaf:datasourceprefix) &gt; 0">
41
					<xsl:value-of select="//oaf:datasourceprefix"/>
42
				</xsl:when>
43 44352 sandro.lab
				<xsl:when test="string-length(//dri:datasourceprefix) &gt; 0">
44
					<xsl:value-of select="//dri:datasourceprefix"/>
45
				</xsl:when>
46 44303 claudio.at
				<xsl:otherwise>
47
					<xsl:value-of select="unknown_"/>
48
				</xsl:otherwise>
49
			</xsl:choose>
50
		</xsl:variable>
51 44298 sandro.lab
52 44303 claudio.at
		<xsl:choose>
53
			<!-- 			<xsl:when test="count($metadata) = 0 or string-length($namespaceprefix) = 0"> -->
54
			<xsl:when test="count($metadata) = 0">
55
				<ROWS/>
56
			</xsl:when>
57
			<xsl:otherwise>
58 44298 sandro.lab
59 44303 claudio.at
				<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
60
				<xsl:variable name="publicationId" select="dnet:oafSimpleId('publication', //dri:objIdentifier)"/>
61 44298 sandro.lab
62 44303 claudio.at
				<xsl:if test="string-length($publicationId) &gt; 0">
63
					<xsl:variable name="originalidTest" select="/record/*[local-name() = 'header']/*[local-name() = 'recordIdentifier']"/>
64
					<xsl:variable name="originalid">
65
						<xsl:choose>
66
							<xsl:when test="contains($originalidTest, '::')">
67
								<xsl:value-of select="substring-after($originalidTest, '::')"/>
68
							</xsl:when>
69
							<xsl:otherwise>
70
								<xsl:value-of select="$originalidTest"/>
71
							</xsl:otherwise>
72
						</xsl:choose>
73
					</xsl:variable>
74 44298 sandro.lab
75 44303 claudio.at
					<xsl:variable name="publication"
76 44352 sandro.lab
					              select="dnet:pmfPublication($publicationId, $provenance, $trust, $about, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
77 44298 sandro.lab
78 44303 claudio.at
					<ROWS>
79
						<ROW key="{$publicationId}" columnFamily="publication">
80
							<QUALIFIER name="body" type="base64">
81
								<xsl:value-of select="$publication"/>
82
							</QUALIFIER>
83
						</ROW>
84 44298 sandro.lab
85 44352 sandro.lab
						<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='dataset']">
86 44298 sandro.lab
87 44352 sandro.lab
							<xsl:variable name="relationSemantic">
88
								<xsl:value-of select="./@relationType"/>
89
							</xsl:variable>
90 44298 sandro.lab
91
92 44352 sandro.lab
							<!-- relatedDataset ids must be in the openaire format  -->
93
							<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
94 44298 sandro.lab
95 44352 sandro.lab
							<xsl:if test="string-length($datasetId) &gt; 0">
96
								<xsl:variable name="publicationDataset" select="dnet:createRel($publicationId, $datasetId, 'publicationDataset',  'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
97
								<xsl:variable name="datasetPublication" select="dnet:createRel( $datasetId, $publicationId, 'publicationDataset',  'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
98
99
								<ROW key="{$publicationId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo">
100
									<QUALIFIER name="{$datasetId}" type="base64">
101
										<xsl:value-of select="$publicationDataset"/>
102 44303 claudio.at
									</QUALIFIER>
103
								</ROW>
104 44352 sandro.lab
								<ROW key="{$datasetId}" columnFamily="DatasetPublication_isRelatedTo_isRelatedTo">
105 44303 claudio.at
									<QUALIFIER name="{$publicationId}" type="base64">
106 44352 sandro.lab
										<xsl:value-of select="$datasetPublication"/>
107 44303 claudio.at
									</QUALIFIER>
108
								</ROW>
109 44352 sandro.lab
110 44303 claudio.at
							</xsl:if>
111
						</xsl:for-each>
112 44298 sandro.lab
113 44352 sandro.lab
						<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='publication']">
114 44298 sandro.lab
115 44352 sandro.lab
							<xsl:variable name="relationSemantic">
116
								<xsl:value-of select="./@relationType"/>
117
							</xsl:variable>
118 44298 sandro.lab
119
120 44352 sandro.lab
							<!-- relatedPublication ids must be in the openaire format  -->
121
							<xsl:variable name="targetPublication" select="dnet:oafSimpleId('publication', normalize-space(.))"/>
122 44298 sandro.lab
123 44352 sandro.lab
							<xsl:if test="string-length($targetPublication) &gt; 0">
124
								<xsl:variable name="publicationPublication" select="dnet:createRel($publicationId, $targetPublication, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
125
								<xsl:variable name="publicationPublicationInverse" select="dnet:createRel( $targetPublication,$publicationId, 'publicationPublication', 'isRelatedTo',$relationSemantic, $provenance, $trust, $about)"/>
126
127
								<ROW key="{$publicationId}" columnFamily="publicationPublication_isRelatedTo_isRelatedTo">
128
									<QUALIFIER name="{$targetPublication}" type="base64">
129
										<xsl:value-of select="$publicationPublication"/>
130 44303 claudio.at
									</QUALIFIER>
131
								</ROW>
132 44352 sandro.lab
133
								<ROW key="{$targetPublication}" columnFamily="publicationPublication_isRelatedTo_isRelatedTo">
134 44303 claudio.at
									<QUALIFIER name="{$publicationId}" type="base64">
135 44352 sandro.lab
										<xsl:value-of select="$publicationPublicationInverse"/>
136 44303 claudio.at
									</QUALIFIER>
137
								</ROW>
138
							</xsl:if>
139
						</xsl:for-each>
140 44298 sandro.lab
141
142 44352 sandro.lab
						<!--UNKOWN RELATIONS-->
143 44298 sandro.lab
144 44352 sandro.lab
						<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='unknown']">
145 44298 sandro.lab
146 44352 sandro.lab
							<xsl:variable name="enity">
147
								<xsl:value-of select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about)"/>
148
							</xsl:variable>
149 44298 sandro.lab
150
151 44352 sandro.lab
							<ROW>
152
								<xsl:value-of select="$enity"/>
153
							</ROW>
154
						</xsl:for-each>
155 44298 sandro.lab
156
157 44352 sandro.lab
						<!--<xsl:variable name="publicationDataset"-->
158
						<!--select="dnet:rel($publicationId, $datasetId, 'publicationDataset', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/>-->
159
						<!--<xsl:variable name="datasetPublication"-->
160
						<!--select="dnet:rel($datasetId, $publicationId, 'publicationDataset', 'publicationDataset', 'isRelatedTo', $provenance, $trust, $about)"/>-->
161 44298 sandro.lab
162 44352 sandro.lab
						<!--<ROW key="{$publicationId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo">-->
163
						<!--<QUALIFIER name="{$datasetId}" type="base64">-->
164
						<!--<xsl:value-of select="$publicationDataset"/>-->
165
						<!--</QUALIFIER>-->
166
						<!--</ROW>-->
167
						<!--<ROW key="{$datasetId}" columnFamily="publicationDataset_isRelatedTo_isRelatedTo">-->
168
						<!--<QUALIFIER name="{$publicationId}" type="base64">-->
169
						<!--<xsl:value-of select="$datasetPublication"/>-->
170
						<!--</QUALIFIER>-->
171
						<!--</ROW>-->
172
						<!--</xsl:if>-->
173
						<!--</xsl:for-each>-->
174 44298 sandro.lab
175
176 44303 claudio.at
					</ROWS>
177
				</xsl:if>
178
			</xsl:otherwise>
179
		</xsl:choose>
180
	</xsl:template>
181
</xsl:stylesheet>
182 44298 sandro.lab
				</CODE>
183
			</SCRIPT>
184
		</CONFIGURATION>
185
		<STATUS/>
186
		<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
187
	</BODY>
188
</RESOURCE_PROFILE>