1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/"
|
3
|
xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
4
|
xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf"
|
5
|
xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:dnet="eu.dnetlib.data.transform.xml.DNetMdStoreToHbaseXsltFunctions">
|
6
|
|
7
|
<xsl:param name="parentDatasourceId" />
|
8
|
<xsl:param name="namespacePrefix" />
|
9
|
|
10
|
<xsl:template match="/">
|
11
|
<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
|
12
|
xmlns:dri="http://www.driver-repository.eu/namespace/dri"
|
13
|
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
14
|
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
|
15
|
|
16
|
<xsl:copy-of select=".//*[local-name()='header']"/>
|
17
|
<metadata>
|
18
|
<xsl:variable name="rid" select="normalize-space(//repository/@rID)" />
|
19
|
<xsl:variable name="datasourceId" select="concat($namespacePrefix, '::', $rid)" />
|
20
|
<xsl:variable name="oUrl" select="normalize-space(//oUrl)" />
|
21
|
<xsl:variable name="oName" select="normalize-space(//oName)" />
|
22
|
<xsl:variable name="organizationId" select="translate(concat($namespacePrefix, '::', $oName), ' ', '_')" />
|
23
|
|
24
|
<xsl:variable name="contenttypes">
|
25
|
<xsl:for-each select=".//contentType">
|
26
|
<xsl:if test="position() > 1"> - </xsl:if>
|
27
|
<xsl:value-of select="."/>
|
28
|
</xsl:for-each>
|
29
|
</xsl:variable>
|
30
|
<xsl:variable name="languages">
|
31
|
<xsl:for-each select=".//lName">
|
32
|
<xsl:if test="position() > 1">, </xsl:if>
|
33
|
<xsl:value-of select="."/>
|
34
|
</xsl:for-each>
|
35
|
</xsl:variable>
|
36
|
<ROWS>
|
37
|
<ROW table="datasources">
|
38
|
<FIELD name="id"><xsl:value-of select="$datasourceId" /></FIELD>
|
39
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$datasourceId" /></FIELD>
|
40
|
<FIELD name="officialname"><xsl:value-of select="normalize-space(//rName)" /></FIELD>
|
41
|
<FIELD name="englishname"><xsl:value-of select="normalize-space(//rAcronym)" /></FIELD>
|
42
|
<FIELD name="od_contenttypes"><xsl:value-of select="normalize-space($contenttypes)" /></FIELD>
|
43
|
<FIELD name="od_languages"><xsl:value-of select="normalize-space($languages)" /></FIELD>
|
44
|
<FIELD name="od_numberofitems"><xsl:value-of select="normalize-space(//rNumOfItems)" /></FIELD>
|
45
|
<FIELD name="od_numberofitemsdate"><xsl:value-of select="normalize-space(//rDateHarvested)" /></FIELD>
|
46
|
<FIELD name="description"><xsl:value-of select="normalize-space(//rDescription)" /></FIELD>
|
47
|
<FIELD name="contactEmail"><xsl:value-of select="normalize-space(//pEmail)" /></FIELD>
|
48
|
<FIELD name="latitude" type="float"><xsl:value-of select="normalize-space(//paLatitude)" /></FIELD>
|
49
|
<FIELD name="longitude" type="float"><xsl:value-of select="normalize-space(//paLongitude)" /></FIELD>
|
50
|
<FIELD name="websiteurl"><xsl:value-of select="normalize-space(//rUrl)" /></FIELD>
|
51
|
<FIELD name="logourl"></FIELD>
|
52
|
<FIELD name="namespaceprefix"><xsl:value-of select="dnet:generateNsPrefix('od', $rid)"/></FIELD>
|
53
|
<FIELD name="datasourceclass">pubsrepository::unknown</FIELD>
|
54
|
<FIELD name="datasourcescheme">dnet:datasource_typologies</FIELD>
|
55
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
56
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
57
|
<FIELD name="typology"><xsl:value-of select="normalize-space(//rSoftWareName)" /></FIELD>
|
58
|
<FIELD name="optional1"></FIELD>
|
59
|
<FIELD name="optional2"></FIELD>
|
60
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
61
|
</ROW>
|
62
|
|
63
|
<xsl:for-each select=".//class">
|
64
|
<xsl:variable name="subjectId" select="normalize-space(concat($parentDatasourceId, '::', ./clCode))"/>
|
65
|
<xsl:variable name="subjectValue" select="normalize-space(./clTitle)"/>
|
66
|
<ROW table="subjects">
|
67
|
<FIELD name="id"><xsl:value-of select="$subjectId" /></FIELD>
|
68
|
<FIELD name="name"><xsl:value-of select="$subjectValue" /></FIELD>
|
69
|
<FIELD name="semanticclass">dnet:od_subjects</FIELD>
|
70
|
<FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
|
71
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$subjectId" /></FIELD>
|
72
|
</ROW>
|
73
|
<ROW table="datasource_subject">
|
74
|
<FIELD name="datasource"><xsl:value-of select="$datasourceId" /></FIELD>
|
75
|
<FIELD name="subject"><xsl:value-of select="$subjectId" /></FIELD>
|
76
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($datasourceId, '@@', $subjectId)" /></FIELD>
|
77
|
</ROW>
|
78
|
</xsl:for-each>
|
79
|
|
80
|
<xsl:variable name="apiId" select="concat('api_________::', $datasourceId, '::0')" />
|
81
|
<ROW table="api">
|
82
|
<FIELD name="id"><xsl:value-of select="$apiId" /></FIELD>
|
83
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$apiId" /></FIELD>
|
84
|
<FIELD name="protocolclass">oai</FIELD>
|
85
|
<FIELD name="datasource"><xsl:value-of select="$datasourceId" /></FIELD>
|
86
|
<FIELD name="contentdescriptionclass">metadata</FIELD>
|
87
|
<FIELD name="typologyclass">pubsrepository::unknown</FIELD>
|
88
|
</ROW>
|
89
|
|
90
|
<ROW table="apicollections">
|
91
|
<FIELD name="api"><xsl:value-of select="$apiId" /></FIELD>
|
92
|
<FIELD name="param">baseUrl</FIELD>
|
93
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($apiId, '@@baseUrl')" /></FIELD>
|
94
|
<xsl:if test="string-length(normalize-space(//rOaiBaseUrl)) > 0">
|
95
|
<FIELD name="original"><xsl:value-of select="normalize-space(//rOaiBaseUrl)" /></FIELD>
|
96
|
</xsl:if>
|
97
|
</ROW>
|
98
|
|
99
|
<ROW table="apicollections">
|
100
|
<FIELD name="api"><xsl:value-of select="$apiId" /></FIELD>
|
101
|
<FIELD name="param">format</FIELD>
|
102
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($apiId, '@@format')" /></FIELD>
|
103
|
<FIELD name="original">oai_dc</FIELD>
|
104
|
</ROW>
|
105
|
|
106
|
<ROW table="apicollections">
|
107
|
<FIELD name="api"><xsl:value-of select="$apiId" /></FIELD>
|
108
|
<FIELD name="param">metadata_identifier_path</FIELD>
|
109
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($apiId, '@@metadata_identifier_path')" /></FIELD>
|
110
|
<FIELD name="original">//*[local-name()='header']/*[local-name()='identifier']</FIELD>
|
111
|
<FIELD name="accessparam" type="boolean">false</FIELD>
|
112
|
</ROW>
|
113
|
|
114
|
<ROW table="organizations">
|
115
|
<FIELD name="id"><xsl:value-of select="$organizationId" /></FIELD>
|
116
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$organizationId" /></FIELD>
|
117
|
<FIELD name="legalname"><xsl:value-of select="$oName" /></FIELD>
|
118
|
<FIELD name="legalshortname"><xsl:value-of select="normalize-space(//oAcronym)" /></FIELD>
|
119
|
<FIELD name="websiteurl"><xsl:value-of select="normalize-space(//oUrl)" /></FIELD>
|
120
|
<FIELD name="countryClass">
|
121
|
<xsl:choose>
|
122
|
<xsl:when test="normalize-space(//cIsoCode) = 'GB'">UK</xsl:when>
|
123
|
<xsl:otherwise><xsl:value-of select="normalize-space(//cIsoCode)"></xsl:value-of></xsl:otherwise>
|
124
|
</xsl:choose>
|
125
|
</FIELD>
|
126
|
<FIELD name="countryScheme">dnet:countries</FIELD>
|
127
|
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
|
128
|
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
|
129
|
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD>
|
130
|
<FIELD name="trust" type="float">0.8</FIELD>
|
131
|
</ROW>
|
132
|
|
133
|
<ROW table="datasource_organization">
|
134
|
<FIELD name="datasource"><xsl:value-of select="$datasourceId" /></FIELD>
|
135
|
<FIELD name="organization"><xsl:value-of select="$organizationId" /></FIELD>
|
136
|
<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($datasourceId,'@@',$organizationId)" /></FIELD>
|
137
|
</ROW>
|
138
|
|
139
|
</ROWS>
|
140
|
</metadata>
|
141
|
</record>
|
142
|
</xsl:template>
|
143
|
|
144
|
</xsl:stylesheet>
|