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) > 0">
|
45
|
<xsl:value-of select="//oaf:datasourceprefix"/>
|
46
|
</xsl:when>
|
47
|
<xsl:when test="string-length(//dri:datasourceprefix) > 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) > 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="publication" 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
|
<xsl:variable name="inverseSemantic" select="./@inverseRelationType"/>
|
93
|
|
94
|
<!-- relatedDataset ids must be in the openaire format -->
|
95
|
<xsl:variable name="datasetId"
|
96
|
select="dnet:oafSimpleId('dataset', normalize-space(.))"/>
|
97
|
|
98
|
<xsl:if test="string-length($datasetId) > 0">
|
99
|
<ROW key="dnet:relQualifier('publicationDataset', $relationSemantic, $publicationId)" columnFamily="rel">
|
100
|
<QUALIFIER name="{$datasetId}" type="base64">
|
101
|
<xsl:value-of select="dnet:rel($publicationId, 'publication', $datasetId, 'dataset', $relationSemantic, 'publicationDataset', $provenance, $trust, $about)"/>
|
102
|
</QUALIFIER>
|
103
|
</ROW>
|
104
|
<ROW key="{$datasetId}" columnFamily="rel">
|
105
|
<QUALIFIER name="dnet:relQualifier('publicationDataset', $inverseSemantic, $publicationId)" type="base64">
|
106
|
<xsl:value-of select="dnet:rel($datasetId, 'dataset', $publicationId, 'publication', $inverseSemantic, 'publicationDataset', $provenance, $trust, $about)"/>
|
107
|
</QUALIFIER>
|
108
|
</ROW>
|
109
|
|
110
|
</xsl:if>
|
111
|
</xsl:for-each>
|
112
|
|
113
|
<xsl:for-each
|
114
|
select="//*[local-name()='relatedIdentifier' and ./@entityType='publication']">
|
115
|
|
116
|
<xsl:variable name="relationSemantic" select="./@relationType"/>
|
117
|
<xsl:variable name="inverseSemantic" select="./@inverseRelationType"/>
|
118
|
|
119
|
<!-- relatedPublication ids must be in the openaire format -->
|
120
|
<xsl:variable name="targetPublication"
|
121
|
select="dnet:oafSimpleId('publication', normalize-space(.))"/>
|
122
|
|
123
|
<xsl:if test="string-length($targetPublication) > 0">
|
124
|
<ROW key="{$publicationId}" columnFamily="rel">
|
125
|
<QUALIFIER name="dnet:relQualifier('publicationPublication', $relationSemantic, $targetPublication)" type="base64">
|
126
|
<xsl:value-of select="dnet:rel($publicationId, 'publication', $targetPublication, 'publication', $relationSemantic, 'publicationPublication', $provenance, $trust, $about)"/>
|
127
|
</QUALIFIER>
|
128
|
</ROW>
|
129
|
|
130
|
<ROW key="{$targetPublication}" columnFamily="rel">
|
131
|
<QUALIFIER name="dnet:relQualifier('publicationPublication', $inverseSemantic, $publicationId)" type="base64">
|
132
|
<xsl:value-of select="dnet:rel($targetPublication, 'publication', $publicationId, 'publication', $inverseSemantic, 'publicationPublication', $provenance, $trust, $about)"/>
|
133
|
</QUALIFIER>
|
134
|
</ROW>
|
135
|
</xsl:if>
|
136
|
</xsl:for-each>
|
137
|
|
138
|
|
139
|
<!--UNKOWN RELATIONS-->
|
140
|
|
141
|
<xsl:for-each select="//*[local-name()='relatedIdentifier' and ./@entityType='unknown']">
|
142
|
|
143
|
<xsl:variable name="enityId">
|
144
|
<xsl:value-of select="dnet:createEntityId(./@relatedIdentifierType, ., $namespaceprefix)"/>
|
145
|
</xsl:variable>
|
146
|
|
147
|
<ROW key="{$enityId}" columnFamily="metadata">
|
148
|
<QUALIFIER name="body" type="base64">
|
149
|
<xsl:value-of select="dnet:createEntity(./@relatedIdentifierType, ., $namespaceprefix, $about)"/>
|
150
|
</QUALIFIER>
|
151
|
</ROW>
|
152
|
|
153
|
<xsl:variable name="relationSemantic" select="./@relationType"/>
|
154
|
<xsl:variable name="inverseSemantic" select="./@inverseRelationType"/>
|
155
|
|
156
|
<ROW key="{$publicationId}" columnFamily="rel">
|
157
|
<QUALIFIER name="dnet:relQualifier('publicationUnknown', $relationSemantic, $enityId)" type="base64">
|
158
|
<xsl:value-of select="dnet:rel($publicationId, 'publication', $enityId, 'unknown', $relationSemantic, 'publicationUnknown', $provenance, $trust, $about)"/>
|
159
|
</QUALIFIER>
|
160
|
</ROW>
|
161
|
<ROW key="{$enityId}" columnFamily="rel">
|
162
|
<QUALIFIER name="dnet:relQualifier('publicationUnknown', $inverseSemantic, $publicationId)" type="base64">
|
163
|
<xsl:value-of select="dnet:rel($enityId, 'unknown', $publicationId, 'publication', $inverseSemantic, 'publicationUnknown', $provenance, $trust, $about)"/>
|
164
|
</QUALIFIER>
|
165
|
</ROW>
|
166
|
</xsl:for-each>
|
167
|
</ROWS>
|
168
|
</xsl:if>
|
169
|
</xsl:otherwise>
|
170
|
</xsl:choose>
|
171
|
</xsl:template>
|
172
|
</xsl:stylesheet>
|
173
|
</CODE>
|
174
|
</SCRIPT>
|
175
|
</CONFIGURATION>
|
176
|
<STATUS/>
|
177
|
<SECURITY_PARAMETERS>SECURITY_PARAMETERS</SECURITY_PARAMETERS>
|
178
|
</BODY>
|
179
|
</RESOURCE_PROFILE>
|