Revision 48139
Added by Alessia Bardi over 6 years ago
rcuk_2_db.xsl | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
3 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
4 |
xmlns:dr="http://www.driver-repository.eu/namespace/dr" xmlns:dri="http://www.driver-repository.eu/namespace/dri" |
|
5 |
xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions" |
|
6 |
exclude-result-prefixes="xs" version="1.0"> |
|
3 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
|
4 |
exclude-result-prefixes="xs" version="1.0"> |
|
7 | 5 |
|
8 |
<xsl:param name="parentDatasourceId" />
|
|
9 |
<xsl:param name="namespacePrefix" />
|
|
6 |
<xsl:param name="parentDatasourceId"/> |
|
7 |
<xsl:param name="namespacePrefix"/> |
|
10 | 8 |
|
11 | 9 |
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/> |
12 | 10 |
<xsl:variable name="funderID" select="concat($namespacePrefix, '::RCUK')"/> |
... | ... | |
14 | 12 |
<xsl:template match="/"> |
15 | 13 |
|
16 | 14 |
|
17 |
<record xmlns:dr="http://www.driver-repository.eu/namespace/dr" |
|
18 |
xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
19 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oaf="http://namespace.openaire.eu/oaf" |
|
20 |
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"> |
|
15 |
<record |
|
16 |
> |
|
21 | 17 |
|
22 |
<xsl:copy-of select=".//*[local-name()='header']" />
|
|
18 |
<xsl:copy-of select=".//*[local-name()='header']"/> |
|
23 | 19 |
|
24 | 20 |
<metadata> |
25 | 21 |
<ROWS> |
26 | 22 |
<xsl:variable name="projectCode" |
27 |
select="//*[local-name()='identifier' and ./@*[local-name()='type' and .='RCUK']]" />
|
|
23 |
select="//*[local-name()='identifier' and ./@*[local-name()='type' and .='RCUK']]"/>
|
|
28 | 24 |
<xsl:variable name="projectId" |
29 |
select="concat($namespacePrefix, '::', $projectCode)" />
|
|
25 |
select="concat($namespacePrefix, '::', $projectCode)"/>
|
|
30 | 26 |
|
31 | 27 |
<xsl:variable name="sDate" select=".//*[local-name()='fund']/*[local-name()='start']"/> |
32 | 28 |
<xsl:variable name="eDate" select=".//*[local-name()='fund']/*[local-name()='end']"/> |
... | ... | |
58 | 54 |
</xsl:variable> |
59 | 55 |
|
60 | 56 |
<xsl:variable name="personCode" |
61 |
select=".//*[local-name()='person']/@*[local-name()='id']" />
|
|
57 |
select=".//*[local-name()='person']/@*[local-name()='id']"/>
|
|
62 | 58 |
<xsl:variable name="personId" |
63 |
select="concat($namespacePrefix,'::',$personCode)" />
|
|
64 |
<xsl:variable name="personSurname" select=".//*[local-name()='surname']" />
|
|
65 |
<xsl:variable name="personFirstName" select=".//*[local-name()='firstName']" />
|
|
59 |
select="concat($namespacePrefix,'::',$personCode)"/>
|
|
60 |
<xsl:variable name="personSurname" select=".//*[local-name()='surname']"/> |
|
61 |
<xsl:variable name="personFirstName" select=".//*[local-name()='firstName']"/> |
|
66 | 62 |
<xsl:variable name="fundingId" |
67 |
select="concat($funderID ,'::' , .//*[local-name()='funder']/name)" />
|
|
63 |
select="concat($funderID ,'::' , .//*[local-name()='funder']/name)"/>
|
|
68 | 64 |
|
69 | 65 |
<ROW table="projects"> |
70 | 66 |
<FIELD name="_dnet_resource_identifier_"> |
71 |
<xsl:value-of select="$projectId" />
|
|
67 |
<xsl:value-of select="$projectId"/> |
|
72 | 68 |
</FIELD> |
73 | 69 |
<FIELD name="id"> |
74 |
<xsl:value-of select="$projectId" />
|
|
70 |
<xsl:value-of select="$projectId"/> |
|
75 | 71 |
</FIELD> |
76 | 72 |
<FIELD name="code"> |
77 |
<xsl:value-of select="$projectCode" />
|
|
73 |
<xsl:value-of select="$projectCode"/> |
|
78 | 74 |
</FIELD> |
79 | 75 |
<FIELD name="title"> |
80 |
<xsl:value-of select=".//*[local-name()='title']" />
|
|
76 |
<xsl:value-of select=".//*[local-name()='title']"/> |
|
81 | 77 |
</FIELD> |
82 | 78 |
<FIELD name="startdate" type="date" format="{$dateFormat}"> |
83 |
<xsl:value-of select="$startDate" />
|
|
79 |
<xsl:value-of select="$startDate"/> |
|
84 | 80 |
</FIELD> |
85 | 81 |
<FIELD name="enddate" type="date" format="{$dateFormat}"> |
86 |
<xsl:value-of select="$endDate" />
|
|
82 |
<xsl:value-of select="$endDate"/> |
|
87 | 83 |
</FIELD> |
88 | 84 |
<FIELD name="collectedfrom"> |
89 |
<xsl:value-of select="$parentDatasourceId" />
|
|
85 |
<xsl:value-of select="$parentDatasourceId"/> |
|
90 | 86 |
</FIELD> |
91 | 87 |
<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD> |
92 | 88 |
<FIELD name="optional1"> |
93 | 89 |
<xsl:value-of |
94 |
select="concat(.//*[local-name()='valuePounds']/@*[local-name()='amount'], ' ', .//*[local-name()='valuePounds']/@*[local-name()='currencyCode'])" />
|
|
90 |
select="concat(.//*[local-name()='valuePounds']/@*[local-name()='amount'], ' ', .//*[local-name()='valuePounds']/@*[local-name()='currencyCode'])"/>
|
|
95 | 91 |
</FIELD> |
96 | 92 |
</ROW> |
97 | 93 |
|
98 | 94 |
<ROW table="project_fundingpath"> |
99 | 95 |
<FIELD name="_dnet_resource_identifier_"> |
100 |
<xsl:value-of select="concat($fundingId, '@@', $projectId)" />
|
|
96 |
<xsl:value-of select="concat($fundingId, '@@', $projectId)"/> |
|
101 | 97 |
</FIELD> |
102 | 98 |
<FIELD name="funding"> |
103 |
<xsl:value-of select="$fundingId" />
|
|
99 |
<xsl:value-of select="$fundingId"/> |
|
104 | 100 |
</FIELD> |
105 | 101 |
<FIELD name="project"> |
106 |
<xsl:value-of select="$projectId" />
|
|
102 |
<xsl:value-of select="$projectId"/> |
|
107 | 103 |
</FIELD> |
108 | 104 |
<FIELD name="startdate" type="date" format="{$dateFormat}"> |
109 |
<xsl:value-of select="$startDate" />
|
|
105 |
<xsl:value-of select="$startDate"/> |
|
110 | 106 |
</FIELD> |
111 | 107 |
<FIELD name="enddate" type="date" format="{$dateFormat}"> |
112 |
<xsl:value-of select="$endDate" />
|
|
108 |
<xsl:value-of select="$endDate"/> |
|
113 | 109 |
</FIELD> |
114 | 110 |
</ROW> |
115 | 111 |
|
116 | 112 |
<xsl:for-each select=".//pp-org"> |
117 |
<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(./id))" />
|
|
118 |
<xsl:variable name="country" select="./country" />
|
|
113 |
<xsl:variable name="organizationId" select="concat($namespacePrefix, '::', normalize-space(./id))"/> |
|
114 |
<xsl:variable name="country" select="./country"/> |
|
119 | 115 |
<ROW table="organizations"> |
120 | 116 |
<FIELD name="_dnet_resource_identifier_"> |
121 |
<xsl:value-of select="$organizationId" />
|
|
117 |
<xsl:value-of select="$organizationId"/> |
|
122 | 118 |
</FIELD> |
123 | 119 |
<FIELD name="id"> |
124 |
<xsl:value-of select="$organizationId" />
|
|
120 |
<xsl:value-of select="$organizationId"/> |
|
125 | 121 |
</FIELD> |
126 | 122 |
<FIELD name="legalname"> |
127 |
<xsl:value-of select="./name" />
|
|
123 |
<xsl:value-of select="./name"/> |
|
128 | 124 |
</FIELD> |
129 |
|
|
125 |
|
|
130 | 126 |
<xsl:if test="string-length($country) > 0"> |
131 |
<FIELD name="countryclass"><xsl:value-of select="$country" /></FIELD> |
|
127 |
<FIELD name="countryclass"> |
|
128 |
<xsl:value-of select="$country"/> |
|
129 |
</FIELD> |
|
132 | 130 |
<FIELD name="countryscheme">dnet:countries</FIELD> |
133 | 131 |
</xsl:if> |
134 |
|
|
132 |
|
|
135 | 133 |
<FIELD name="collectedfrom"> |
136 |
<xsl:value-of select="$parentDatasourceId" />
|
|
134 |
<xsl:value-of select="$parentDatasourceId"/> |
|
137 | 135 |
</FIELD> |
138 | 136 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
139 | 137 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
140 | 138 |
</ROW> |
141 | 139 |
<ROW table="project_organization"> |
142 | 140 |
<FIELD name="_dnet_resource_identifier_"> |
143 |
<xsl:value-of select='concat($projectId, "@@", $organizationId)' />
|
|
141 |
<xsl:value-of select='concat($projectId, "@@", $organizationId)'/> |
|
144 | 142 |
</FIELD> |
145 | 143 |
<FIELD name="project"> |
146 |
<xsl:value-of select="$projectId" />
|
|
144 |
<xsl:value-of select="$projectId"/> |
|
147 | 145 |
</FIELD> |
148 | 146 |
<FIELD name="resporganization"> |
149 |
<xsl:value-of select="$organizationId" />
|
|
147 |
<xsl:value-of select="$organizationId"/> |
|
150 | 148 |
</FIELD> |
149 |
|
|
151 | 150 |
<FIELD name="semanticclass">participant</FIELD> |
152 | 151 |
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD> |
153 | 152 |
</ROW> |
... | ... | |
155 | 154 |
</xsl:for-each> |
156 | 155 |
|
157 | 156 |
<xsl:variable name="leadOrgId" |
158 |
select="concat($namespacePrefix, '::', normalize-space(.//ld-org/id))" />
|
|
157 |
select="concat($namespacePrefix, '::', normalize-space(.//ld-org/id))"/> |
|
159 | 158 |
<ROW table="organizations"> |
160 | 159 |
<FIELD name="_dnet_resource_identifier_"> |
161 |
<xsl:value-of select="$leadOrgId" />
|
|
160 |
<xsl:value-of select="$leadOrgId"/> |
|
162 | 161 |
</FIELD> |
163 | 162 |
<FIELD name="id"> |
164 |
<xsl:value-of select="$leadOrgId" />
|
|
163 |
<xsl:value-of select="$leadOrgId"/> |
|
165 | 164 |
</FIELD> |
166 | 165 |
<FIELD name="legalname"> |
167 |
<xsl:value-of select=".//ld-org/name" />
|
|
166 |
<xsl:value-of select=".//ld-org/name"/> |
|
168 | 167 |
</FIELD> |
169 | 168 |
<xsl:variable name="country" select=".//ld-org/country"/> |
170 | 169 |
<xsl:if test="string-length($country) > 0"> |
171 |
<FIELD name="countryclass"><xsl:value-of select="$country" /></FIELD> |
|
172 |
<FIELD name="countryscheme">dnet:countries</FIELD> |
|
170 |
<FIELD name="countryclass"> |
|
171 |
<xsl:value-of select="$country"/> |
|
172 |
</FIELD> |
|
173 |
<FIELD name="countryscheme">dnet:countries</FIELD> |
|
173 | 174 |
</xsl:if> |
174 |
|
|
175 |
|
|
175 | 176 |
<FIELD name="collectedfrom"> |
176 |
<xsl:value-of select="$parentDatasourceId" />
|
|
177 |
<xsl:value-of select="$parentDatasourceId"/> |
|
177 | 178 |
</FIELD> |
178 | 179 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
179 | 180 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
180 | 181 |
</ROW> |
182 |
|
|
181 | 183 |
<xsl:if test="string-length($personFirstName) > 0"> |
182 | 184 |
<ROW table="persons"> |
183 | 185 |
<FIELD name="_dnet_resource_identifier_"> |
184 |
<xsl:value-of select="$personId" />
|
|
186 |
<xsl:value-of select="$personId"/> |
|
185 | 187 |
</FIELD> |
186 | 188 |
<FIELD name="id"> |
187 |
<xsl:value-of select="$personId" />
|
|
189 |
<xsl:value-of select="$personId"/> |
|
188 | 190 |
</FIELD> |
189 | 191 |
<FIELD name="firstname"> |
190 |
<xsl:value-of select="$personFirstName" />
|
|
192 |
<xsl:value-of select="$personFirstName"/> |
|
191 | 193 |
</FIELD> |
192 | 194 |
<FIELD name="secondnames"> |
193 |
<xsl:value-of select="$personSurname" />
|
|
195 |
<xsl:value-of select="$personSurname"/> |
|
194 | 196 |
</FIELD> |
195 | 197 |
<FIELD name="collectedfrom"> |
196 |
<xsl:value-of select="$parentDatasourceId" />
|
|
198 |
<xsl:value-of select="$parentDatasourceId"/> |
|
197 | 199 |
</FIELD> |
198 | 200 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
199 | 201 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
... | ... | |
201 | 203 |
</xsl:if> |
202 | 204 |
<ROW table="project_organization"> |
203 | 205 |
<FIELD name="_dnet_resource_identifier_"> |
204 |
<xsl:value-of select='concat($projectId, "@@", $leadOrgId)' />
|
|
206 |
<xsl:value-of select='concat($projectId, "@@", $leadOrgId)'/> |
|
205 | 207 |
</FIELD> |
206 | 208 |
<FIELD name="project"> |
207 |
<xsl:value-of select="$projectId" />
|
|
209 |
<xsl:value-of select="$projectId"/> |
|
208 | 210 |
</FIELD> |
209 | 211 |
<FIELD name="resporganization"> |
210 |
<xsl:value-of select="$leadOrgId" />
|
|
212 |
<xsl:value-of select="$leadOrgId"/> |
|
211 | 213 |
</FIELD> |
212 | 214 |
<FIELD name="participantnumber" type="int">1</FIELD> |
213 | 215 |
<FIELD name="semanticclass">coordinator</FIELD> |
214 | 216 |
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD> |
215 | 217 |
<xsl:if test="string-length($personFirstName) > 0"> |
216 |
<FIELD name="contactperson"> |
|
217 |
<xsl:value-of select="$personId" />
|
|
218 |
</FIELD> |
|
218 |
<FIELD name="contactperson">
|
|
219 |
<xsl:value-of select="$personId"/>
|
|
220 |
</FIELD>
|
|
219 | 221 |
</xsl:if> |
220 | 222 |
</ROW> |
221 | 223 |
|
... | ... | |
224 | 226 |
</record> |
225 | 227 |
</xsl:template> |
226 | 228 |
|
227 |
</xsl:stylesheet> |
|
229 |
</xsl:stylesheet> |
Also available in: Unified diff
integrated (hopefully) all required changes from dnet40