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
|
version="1.0" extension-element-prefixes="exslt"
|
21
|
exclude-result-prefixes="xsl oaf dr dri dnet exslt">
|
22
|
|
23
|
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
24
|
|
25
|
<xsl:param name="writeCoAuthors" select="false()"/>
|
26
|
|
27
|
<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
|
|
32
|
<xsl:variable name="trust" select="string('0.9')"/>
|
33
|
<xsl:variable name="provenance" select="string('sysimport:crosswalk:repository')"/>
|
34
|
|
35
|
<xsl:variable name="metadata" select="exslt:node-set(//*[local-name()='metadata']/*)"/>
|
36
|
<xsl:variable name="namespaceprefix">
|
37
|
<xsl:choose>
|
38
|
|
39
|
<!-- TODO check namespaceprefix length is 12 -->
|
40
|
<xsl:when test="string-length(//oaf:datasourceprefix) > 0">
|
41
|
<xsl:value-of select="//oaf:datasourceprefix"/>
|
42
|
</xsl:when>
|
43
|
<xsl:when test="string-length(//dri:datasourceprefix) > 0">
|
44
|
<xsl:value-of select="//dri:datasourceprefix"/>
|
45
|
</xsl:when>
|
46
|
<xsl:otherwise>
|
47
|
<xsl:value-of select="unknown_"/>
|
48
|
</xsl:otherwise>
|
49
|
</xsl:choose>
|
50
|
</xsl:variable>
|
51
|
|
52
|
<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
|
|
59
|
<xsl:variable name="objIdentifier" select="//dri:objIdentifier"/>
|
60
|
<xsl:variable name="publicationId" select="dnet:oafSimpleId('publication', //dri:objIdentifier)"/>
|
61
|
|
62
|
<xsl:if test="string-length($publicationId) > 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
|
|
75
|
<xsl:variable name="publication"
|
76
|
select="dnet:pmfPublication($publicationId, $provenance, $trust, $about, $originalid, $dateofcollection, $dateoftransformation, $metadata)"/>
|
77
|
|
78
|
<ROWS>
|
79
|
<ROW key="{$publicationId}" columnFamily="publication">
|
80
|
<QUALIFIER name="body" type="base64">
|
81
|
<xsl:value-of select="$publication"/>
|
82
|
</QUALIFIER>
|
83
|
</ROW>
|
84
|
|
85
|
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='dataset']">
|
86
|
|
87
|
<xsl:variable name="relationSemantic">
|
88
|
<xsl:value-of select="./@relationType"/>
|
89
|
</xsl:variable>
|
90
|
|
91
|
|
92
|
<!-- relatedDataset ids must be in the openaire format -->
|
93
|
<xsl:variable name="datasetId" select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
|
94
|
|
95
|
<xsl:if test="string-length($datasetId) > 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
|
</QUALIFIER>
|
103
|
</ROW>
|
104
|
<ROW key="{$datasetId}" columnFamily="DatasetPublication_isRelatedTo_isRelatedTo">
|
105
|
<QUALIFIER name="{$publicationId}" type="base64">
|
106
|
<xsl:value-of select="$datasetPublication"/>
|
107
|
</QUALIFIER>
|
108
|
</ROW>
|
109
|
|
110
|
</xsl:if>
|
111
|
</xsl:for-each>
|
112
|
|
113
|
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='publication']">
|
114
|
|
115
|
<xsl:variable name="relationSemantic">
|
116
|
<xsl:value-of select="./@relationType"/>
|
117
|
</xsl:variable>
|
118
|
|
119
|
|
120
|
<!-- relatedPublication ids must be in the openaire format -->
|
121
|
<xsl:variable name="targetPublication" select="dnet:oafSimpleId('publication', normalize-space(.))"/>
|
122
|
|
123
|
<xsl:if test="string-length($targetPublication) > 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
|
</QUALIFIER>
|
131
|
</ROW>
|
132
|
|
133
|
<ROW key="{$targetPublication}" columnFamily="publicationPublication_isRelatedTo_isRelatedTo">
|
134
|
<QUALIFIER name="{$publicationId}" type="base64">
|
135
|
<xsl:value-of select="$publicationPublicationInverse"/>
|
136
|
</QUALIFIER>
|
137
|
</ROW>
|
138
|
</xsl:if>
|
139
|
</xsl:for-each>
|
140
|
|
141
|
|
142
|
<!--UNKOWN RELATIONS-->
|
143
|
|
144
|
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='unknown']">
|
145
|
|
146
|
<xsl:variable name="enity">
|
147
|
<xsl:value-of select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about)"/>
|
148
|
</xsl:variable>
|
149
|
|
150
|
|
151
|
<ROW>
|
152
|
<xsl:value-of select="$enity"/>
|
153
|
</ROW>
|
154
|
</xsl:for-each>
|
155
|
|
156
|
|
157
|
<!--<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
|
|
162
|
<!--<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
|
|
175
|
|
176
|
</ROWS>
|
177
|
</xsl:if>
|
178
|
</xsl:otherwise>
|
179
|
</xsl:choose>
|
180
|
</xsl:template>
|
181
|
</xsl:stylesheet>
|
182
|
</CODE>
|
183
|
</SCRIPT>
|
184
|
</CONFIGURATION>
|
185
|
<STATUS/>
|
186
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
187
|
</BODY>
|
188
|
</RESOURCE_PROFILE>
|