Revision 47063
Added by Miriam Baglioni almost 7 years ago
modules/dnet-openaireplus-workflows/trunk/src/main/resources/eu/dnetlib/msro/openaireplus/workflows/repo-hi/xslt/fwf_2_db.xsl | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|
2 |
<xsl:stylesheet xmlns:fwf="eu.dnetlib.data.transform.xml.FWFXsltFunctions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
|
3 | 3 |
|
4 | 4 |
<xsl:param name="parentDatasourceId"/> |
5 | 5 |
<xsl:param name="namespacePrefix"/> |
6 | 6 |
|
7 | 7 |
<xsl:variable name="funderID" select="concat($namespacePrefix, '::FWF')"/> |
8 |
<xsl:variable name="fundingName" select="normalize-space(.//column[@name='Grant_Type'])"/> |
|
9 |
<xsl:variable name="fundingCode" select="normalize-space(.//column[@name='Grant_Type_Code'])"/> |
|
8 |
<xsl:variable name="fundingName" select="normalize-space(.//column[@name='promotion category'])"/> |
|
9 |
|
|
10 |
<xsl:variable name="fundingCode" select="normalize-space(substring-before(.//column[@name='project number'],'–'))"/> |
|
11 |
<xsl:variable name="projectNumber" select="normalize-space(substring-after(.//column[@name='project number'],'–'))"/> |
|
10 | 12 |
<xsl:variable name="fundingID"> |
11 | 13 |
<xsl:choose> |
12 |
<xsl:when test="string-length(normalize-space(.//column[@name='Grant_Type_Code'])) > 0">
|
|
13 |
<xsl:value-of select="concat($funderID, '::', normalize-space(.//column[@name='Grant_Type_Code']))"/>
|
|
14 |
<xsl:when test="string-length($fundingCode) > 0">
|
|
15 |
<xsl:value-of select="concat($funderID, '::', $fundingCode)"/>
|
|
14 | 16 |
</xsl:when> |
15 | 17 |
<xsl:otherwise> |
16 | 18 |
<xsl:value-of select="$funderID"/> |
17 | 19 |
</xsl:otherwise> |
18 |
</xsl:choose> |
|
20 |
</xsl:choose>`
|
|
19 | 21 |
</xsl:variable> |
20 | 22 |
|
21 |
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', translate(.//column[@name='Project Identifier (Grant)'], ' ', '_'))"/> |
|
22 |
<xsl:variable name="projectCode" select=".//column[@name='Project Identifier (Grant)']"/> |
|
23 |
<xsl:variable name="projectTitle" select=".//column[@name='Grant_Title']"/> |
|
24 | 23 |
|
25 |
<xsl:variable name="startDate" select=".//column[@name='Start_date']"/>
|
|
26 |
<xsl:variable name="endDate" select=".//column[@name='End_date']"/>
|
|
24 |
<xsl:variable name="projectID" select="concat($namespacePrefix, '::', concat($fundingCode,'_',$projectNumber))"/>
|
|
25 |
<xsl:variable name="projectCode" select="concat($fundingCode,' ',$projectNumber)"/>
|
|
27 | 26 |
|
28 |
<xsl:variable name="dateFormat" select="string('dd-MMM-yyyy')"/>
|
|
27 |
<xsl:variable name="projectTitle" select=".//column[@name='project title']"/>
|
|
29 | 28 |
|
29 |
<xsl:variable name="startDate" select=".//column[@name='from']"/> |
|
30 |
<xsl:variable name="endDate" select=".//column[@name='till']"/> |
|
31 |
<xsl:variable name="personId" select="translate(normalize-space(.//column[@name='project lead']),' ','_')"/> |
|
32 |
<xsl:variable name="dateFormat" select="string('yyyy-MM-dd')"/> |
|
33 |
<xsl:variable name="organizationId" select="translate(normalize-space(.//column[@name='research place & institute']),' ','_')"/> |
|
30 | 34 |
<xsl:template match="/"> |
31 | 35 |
<record> |
36 |
|
|
32 | 37 |
<xsl:copy-of select=".//*[local-name()='header']"/> |
33 | 38 |
<metadata> |
39 |
|
|
34 | 40 |
<ROWS> |
35 | 41 |
<xsl:if test="string-length($projectTitle) > 0 and string-length($projectID) > 0"> |
36 | 42 |
<ROW table="projects"> |
... | ... | |
41 | 47 |
<xsl:value-of select="$projectID"/> |
42 | 48 |
</FIELD> |
43 | 49 |
<FIELD name="code"> |
44 |
<xsl:value-of select=".//column[@name='Project Identifier (Grant)']"/>
|
|
50 |
<xsl:value-of select="$projectCode"/>
|
|
45 | 51 |
</FIELD> |
46 | 52 |
<FIELD name="startdate" type="date" format="{$dateFormat}"> |
47 | 53 |
<xsl:value-of select="$startDate"/> |
... | ... | |
50 | 56 |
<xsl:value-of select="$endDate"/> |
51 | 57 |
</FIELD> |
52 | 58 |
<FIELD name="title"> |
53 |
<xsl:value-of select=".//column[@name='Grant_Title']"/>
|
|
59 |
<xsl:value-of select="$projectTitle"/>
|
|
54 | 60 |
</FIELD> |
61 |
<FIELD name="keywords"> |
|
62 |
<xsl:value-of select=".//column[@name='keywords']"/> |
|
63 |
</FIELD> |
|
64 |
<FIELD name="optional1"> |
|
65 |
<xsl:variable name="grantAmount" select=".//column[@name='grants awarded']"/> |
|
66 |
<xsl:variable name="tmp" select="substring(normalize-space($grantAmount),1,1)"/> |
|
67 |
<xsl:value-of select="concat($tmp,' ',substring-after($grantAmount,$tmp))"/> |
|
68 |
</FIELD> |
|
69 |
|
|
55 | 70 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
56 | 71 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
57 | 72 |
<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId"/></FIELD> |
... | ... | |
74 | 89 |
<xsl:value-of select="$endDate"/> |
75 | 90 |
</FIELD> |
76 | 91 |
</ROW> |
92 |
<ROW table="organizations"> |
|
93 |
|
|
94 |
<FIELD name="_dnet_resource_identifier_"> |
|
95 |
<xsl:value-of select="$organizationId" /> |
|
96 |
</FIELD> |
|
97 |
<FIELD name="id"> |
|
98 |
<xsl:value-of select="$organizationId" /> |
|
99 |
</FIELD> |
|
100 |
<FIELD name="legalname"> |
|
101 |
<xsl:value-of select="normalize-space(.//column[@name='research place & institute'])" /> |
|
102 |
</FIELD> |
|
103 |
<FIELD name="collectedfrom"> |
|
104 |
<xsl:value-of select="$parentDatasourceId" /> |
|
105 |
</FIELD> |
|
106 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
|
107 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
|
108 |
</ROW> |
|
109 |
|
|
110 |
<ROW table="persons"> |
|
111 |
<FIELD name="_dnet_resource_identifier_"> |
|
112 |
<xsl:value-of select="$personId" /> |
|
113 |
</FIELD> |
|
114 |
<FIELD name="id"> |
|
115 |
<xsl:value-of select="$personId" /> |
|
116 |
</FIELD> |
|
117 |
<FIELD name="firstname"> |
|
118 |
<xsl:value-of select="fwf:getName(.//column[@name='project lead'],true())" /> |
|
119 |
</FIELD> |
|
120 |
<FIELD name="secondnames"> |
|
121 |
<xsl:value-of select="fwf:getName(.//column[@name='project lead'],false())" /> |
|
122 |
</FIELD> |
|
123 |
<FIELD name="collectedfrom"> |
|
124 |
<xsl:value-of select="$parentDatasourceId" /> |
|
125 |
</FIELD> |
|
126 |
<FIELD name="provenanceActionClass">sysimport:crosswalk:entityregistry</FIELD> |
|
127 |
<FIELD name="provenanceActionScheme">dnet:provenanceActions</FIELD> |
|
128 |
</ROW> |
|
129 |
|
|
130 |
<ROW table="project_organization"> |
|
131 |
<FIELD name="_dnet_resource_identifier_"> |
|
132 |
<xsl:value-of select='concat($projectID, "@@", $organizationId)' /> |
|
133 |
</FIELD> |
|
134 |
<FIELD name="project"> |
|
135 |
<xsl:value-of select="$projectID" /> |
|
136 |
</FIELD> |
|
137 |
<FIELD name="resporganization"> |
|
138 |
<xsl:value-of select="$organizationId" /> |
|
139 |
</FIELD> |
|
140 |
<FIELD name="contactperson"> |
|
141 |
<xsl:value-of select="$personId" /> |
|
142 |
</FIELD> |
|
143 |
<FIELD name="semanticclass">participant</FIELD> |
|
144 |
<FIELD name="semanticscheme">dnet:project_organization_relations</FIELD> |
|
145 |
</ROW> |
|
146 |
|
|
77 | 147 |
</xsl:if> |
78 | 148 |
</ROWS> |
79 | 149 |
</metadata> |
80 | 150 |
</record> |
81 | 151 |
</xsl:template> |
82 | 152 |
</xsl:stylesheet> |
153 |
|
Also available in: Unified diff
Transformation for the new csv