Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
3
							 xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dr="http://www.driver-repository.eu/namespace/dr" 
4
							 xmlns:dnet="eu.dnetlib.data.transform.xml.DNetMdStoreToHbaseXsltFunctions"
5
							xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa" 
6
							xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions">
7
	
8
	<xsl:param name="parentDatasourceId" />
9
	<xsl:param name="namespacePrefix" />
10
	
11
	<xsl:variable name="dsId" select="concat($namespacePrefix, '::', normalize-space(.//*[local-name()='identifier']))" />
12

    
13
	<xsl:template match="/">
14
		<record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
15
            xmlns:dri="http://www.driver-repository.eu/namespace/dri"
16
            xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17
            xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
18
            
19
            <xsl:copy-of select=".//*[local-name()='header']"/>
20
            <metadata>
21
            	<ROWS>
22
            		<ROW table="datasources">
23
           				<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$dsId" /></FIELD>
24
						<FIELD name="id"><xsl:value-of select="$dsId" /></FIELD>
25
						<FIELD name="officialName"><xsl:value-of select=".//*[local-name()='repositoryName']" /></FIELD>
26
						<FIELD name="englishName"><xsl:value-of select=".//*[local-name()='additionalName'][@language='eng']" /></FIELD>
27
						<FIELD name="typology"><xsl:value-of select=".//*[local-name()='software']/*[local-name()='softwareName']" /></FIELD>
28
						<FIELD name="webSiteURL"><xsl:value-of select=".//*[local-name()='repositoryURL']" /></FIELD>
29
						<FIELD name="logoURL"></FIELD>
30
						<FIELD name="contactEmail"></FIELD>
31
						<FIELD name="latitude"></FIELD>
32
						<FIELD name="longitude"></FIELD>
33
						<FIELD name="timezone"></FIELD>
34
						<FIELD name="nameSpacePrefix"><xsl:value-of select="dnet:generateNsPrefix('r3', dnet:md5(normalize-space(.//*[local-name()='identifier'])))" /></FIELD>
35
						<FIELD name="description"><xsl:value-of select="./*[local-name()='description']" /></FIELD>
36
						<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
37
						<FIELD name="datasourceClass">datarepository::unknown</FIELD>
38
						<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD>
39
						<FIELD name="releaseStartDate" type="date"><xsl:value-of select=".//*[local-name()='startDate']" /></FIELD>
40
						<FIELD name="releaseEndDate" type="date"><xsl:value-of select=".//*[local-name()='endDate']" /></FIELD>
41
						<FIELD name="missionStatementURL"><xsl:value-of select=".//*[local-name()='missionStatementURL']" /></FIELD>
42
						<xsl:choose>
43
							<xsl:when test=".//*[local-name()='providerType'] = 'dataProvider'">
44
								<FIELD name="dataProvider" type="boolean">true</FIELD>
45
							</xsl:when>
46
							<xsl:otherwise>
47
								<FIELD name="dataProvider" type="boolean">false</FIELD>
48
							</xsl:otherwise>
49
						</xsl:choose>
50
						<xsl:choose>
51
							<xsl:when test=".//*[local-name()='providerType'] = 'serviceProvider'">
52
								<FIELD name="serviceProvider" type="boolean">true</FIELD>
53
							</xsl:when>
54
							<xsl:otherwise>
55
								<FIELD name="serviceProvider" type="boolean">false</FIELD>
56
							</xsl:otherwise>
57
						</xsl:choose>
58
						<FIELD name="databaseAccessType"><xsl:value-of select=".//*[local-name()='databaseAccessType']" /></FIELD>
59
						<FIELD name="dataUploadType"><xsl:value-of select=".//*[local-name()='dataUploadType']" /></FIELD>
60
						<FIELD name="databaseAccessRestriction"><xsl:value-of select=".//*[local-name()='databaseAccessRestriction']" /></FIELD>
61
						<FIELD name="dataUploadRestriction"><xsl:value-of select=".//*[local-name()='dataUploadRestriction']" /></FIELD>
62
						<xsl:choose>
63
							<xsl:when test=".//*[local-name()='versioning'] = 'yes'">
64
								<FIELD name="serviceProvider" type="boolean">true</FIELD>
65
							</xsl:when>
66
							<xsl:otherwise>
67
								<FIELD name="serviceProvider" type="boolean">false</FIELD>
68
							</xsl:otherwise>
69
						</xsl:choose>
70
						<FIELD name="citationGuidelineURL"><xsl:value-of select=".//*[local-name()='citationGuidelineURL']" /></FIELD>
71
						<FIELD name="qualityManagementKind"><xsl:value-of select=".//*[local-name()='qualityManagement']" /></FIELD>
72
						<FIELD name="PIDsystems"><xsl:value-of select=".//*[local-name()='pidSystem']" /></FIELD>
73
						<FIELD name="certificates"><xsl:value-of select=".//*[local-name()='certificate']" /></FIELD>
74
           			</ROW>
75
           			
76
           			<xsl:for-each select="//*[local-name()='api']">
77
	           			<xsl:variable name="apiId" select="concat('api_________::', $dsId, '::', position())" />
78
	           			<ROW table="api">
79
	           				 <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$apiId" /></FIELD>
80
	           				 <FIELD name="id"><xsl:value-of select="$apiId" /></FIELD>
81
	           				 <FIELD name="protocolclass"><xsl:value-of select="normalize-space(@apiType)" /></FIELD>
82
	           				 <FIELD name="datasource"><xsl:value-of select="$dsId" /></FIELD>
83
	           				 <FIELD name="typologyclass">datarepository::unknown</FIELD>
84
						</ROW>
85
	           			
86
	           			<ROW table="apicollections">
87
	           				 <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($apiId, '@@baseUrl')" /></FIELD>
88
	           				 <FIELD name="param">baseUrl</FIELD>
89
	           				 <FIELD name="original"><xsl:value-of select="." /></FIELD>
90
	           				 <FIELD name="api"><xsl:value-of select="$apiId" /></FIELD>
91
	           			</ROW>
92
					</xsl:for-each>
93
           			
94
           			<xsl:for-each select="//*[local-name()='policy']">
95
            			<xsl:variable name="policyURL" select="./*[local-name='policyURL']"/>
96
            			<xsl:variable name="policyId" select="concat($namespacePrefix, '::', dnet:md5($policyURL))"/>
97
            			<ROW table="policies">
98
            				 <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$policyId" /></FIELD>
99
            				 <FIELD name="id"><xsl:value-of select="$policyId" /></FIELD>
100
            				 <FIELD name="name"><xsl:value-of select="./*[local-name='policyName']" /></FIELD>
101
            				 <FIELD name="url"><xsl:value-of select="$policyURL" /></FIELD>
102
            			</ROW>
103
            			
104
            			<ROW table="datasource_policy">
105
            				 <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($dsId, '@@', $policyId)" /></FIELD>
106
            				 <FIELD name="datasource"><xsl:value-of select="$dsId" /></FIELD>
107
            				 <FIELD name="policy"><xsl:value-of select="$policyId" /></FIELD>
108
            			</ROW>
109
            		</xsl:for-each>
110
            		
111
            		<xsl:for-each select="//*[local-name()='subject']">
112
            			<xsl:variable name="subjectId" select="concat($namespacePrefix, '::DFG_',  substring-before(. , ' '))"></xsl:variable>
113
            			<xsl:variable name="subjectName" select="substring-after(., ' ')"></xsl:variable>
114
            			<ROW table="subjects">
115
            				 <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$subjectId" /></FIELD>
116
            				 <FIELD name="id"><xsl:value-of select="$subjectId" /></FIELD>
117
            				 <FIELD name="name"><xsl:value-of select="$subjectName" /></FIELD>
118
            				 <FIELD name="semanticclass">DFG</FIELD>
119
            				 <FIELD name="semanticscheme">dnet:subject_classification_typologies</FIELD>
120
            			</ROW>
121
            			
122
            			<ROW table="datasource_subject">
123
            				 <FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($dsId, '@@', $subjectId)" /></FIELD>
124
            				 <FIELD name="datasource"><xsl:value-of select="$dsId" /></FIELD>
125
            				 <FIELD name="subject"><xsl:value-of select="$subjectId" /></FIELD>
126
            			</ROW>
127
            		</xsl:for-each>
128
           			
129
           			<xsl:for-each select="//*[local-name()='institution']">
130
         				<xsl:variable name="orgId" select="concat($namespacePrefix, '::', dnet:md5(normalize-space(./*[local-name()='institutionName'])))" />
131
	           			<ROW table="organizations">
132
	           				<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$orgId" /></FIELD>
133
	           				<FIELD name="id"><xsl:value-of select="$orgId" /></FIELD>
134
	           				<FIELD name="legalname"><xsl:value-of select="./*[local-name()='institutionName']" /></FIELD>
135
	           				<FIELD name="legalshortname"><xsl:value-of select="./*[local-name()='institutionAdditionalName'][1]" /></FIELD>
136
	           				<FIELD name="websiteurl"><xsl:value-of select="./*[local-name()='institutionURL']" /></FIELD>
137
	           				<FIELD name="countryClass"><xsl:value-of select="./*[local-name()='institutionCountry']" /></FIELD>
138
	           				<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId" /></FIELD>
139
	           				<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
140
	           			</ROW>
141
	           			
142
	           			<ROW table="datasource_organization">
143
	           				<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($dsId, '@@', $orgId)" /></FIELD>
144
	           				<FIELD name="datasource"><xsl:value-of select="$dsId" /></FIELD>
145
	           				<FIELD name="organization"><xsl:value-of select="$orgId" /></FIELD>
146
	           				<FIELD name="startdate" type="date"><xsl:value-of select="./*[local-name()='responsibilityStartDate']" /></FIELD>
147
	           				<FIELD name="enddate" type="date"><xsl:value-of select="./*[local-name()='responsibilityEndDate']" /></FIELD>
148
	           			</ROW>
149
           			</xsl:for-each>
150
            		
151
            	</ROWS>
152
			</metadata>
153
        </record>
154
    </xsl:template>
155
</xsl:stylesheet>
156

    
(10-10/13)