Project

General

Profile

« Previous | Next » 

Revision 35960

#1175: callID

View differences:

fct_2_db.xsl
1 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/" xmlns:dr="http://www.driver-repository.eu/namespace/dr"
3
	xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaa="http://namespace.openaire.eu/oaa" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions">
4
	
5
	<xsl:param name="parentDatasourceId" />
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"
5
    xmlns:dri="http://www.driver-repository.eu/namespace/dri"
6
    xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:fn="http://www.w3.org/2005/xpath-functions"
7
    exclude-result-prefixes="xs" version="2.0">
6 8

  
7
	<xsl:variable name="invalid" select="' ,-'" />
8
	<xsl:variable name="valid"   select="'___'" />
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
			
18
			<metadata>
19
				<ROWS>
20
					<xsl:for-each select="//project">
21
						<xsl:call-template name="projectTemplate" />
22
					</xsl:for-each>
23
				</ROWS>
24
			</metadata>
25
			
26
		</record>
27
	</xsl:template>
28
	
29
	<xsl:template name="projectTemplate">
30
		
31
		<xsl:variable name="prefix" select="string('fct_________')" />
32
		<xsl:variable name="projectId" select="concat($prefix, '::',  ./id)" />
33
		<xsl:variable name="parentDatasourceId" select="string('openaire____::fct')"/>			
34
		
35
		<ROW table="projects">
36
			<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$projectId" /></FIELD>
37
			<FIELD name="id"><xsl:value-of select="$projectId" /></FIELD>
38
			<FIELD name="code"><xsl:value-of select="./id" /></FIELD>
39
			<FIELD name="websiteurl"><xsl:value-of select="./refUri" /></FIELD>
40
			<FIELD name="acronym"><xsl:value-of select="./reference" /></FIELD>
41
			<FIELD name="title"><xsl:value-of select="./name" /></FIELD>
42
			<FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="./startDate" /></FIELD>
43
			<FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="./endDate" /></FIELD>
44
			<FIELD name="keywords"><xsl:for-each select="./classification/elem"><xsl:if test="position() &gt; 1">, </xsl:if><xsl:value-of select="."/></xsl:for-each></FIELD>
45
			<FIELD name="collectedfrom"><xsl:value-of select="$parentDatasourceId"/></FIELD>
46
			<FIELD name="contracttypeclass">UNKNOWN</FIELD>
47
			<FIELD name="contracttypescheme">fct:contractTypes</FIELD>
48
			<FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
49
		</ROW>
9
    <xsl:param name="parentDatasourceId"/>
10
    <xsl:param name="namespacePrefix"/>
50 11

  
51
		<!-- 
12
    <xsl:variable name="invalid" select="' ,-'"/>
13
    <xsl:variable name="valid" select="'___'"/>
14

  
15
    <xsl:template match="/">
16
        <record xmlns:dr="http://www.driver-repository.eu/namespace/dr"
17
            xmlns:dri="http://www.driver-repository.eu/namespace/dri"
18
            xmlns:dc="http://purl.org/dc/elements/1.1/"
19
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20
            xmlns:oaf="http://namespace.openaire.eu/oaf"
21
            xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">
22

  
23
            <xsl:copy-of select=".//*[local-name()='header']"/>
24

  
25
            <metadata>
26
                <ROWS>
27
                    <xsl:for-each select="//project">
28
                        <xsl:call-template name="projectTemplate"/>
29
                    </xsl:for-each>
30
                </ROWS>
31
            </metadata>
32

  
33
        </record>
34
    </xsl:template>
35

  
36
    <xsl:template name="projectTemplate">
37
        <xsl:variable name="projectId" select="concat($namespacePrefix, '::',  ./id)"/>
38
        <xsl:variable name="projectAcronym" select="./reference"/>
39
        <xsl:variable name="tokens" select="tokenize(./reference,'/')"/>
40
        <xsl:variable name="callID" select="concat($tokens[1], '/', $tokens[last()])"/>
41
        <ROW table="projects">
42
            <FIELD name="_dnet_resource_identifier_">
43
                <xsl:value-of select="$projectId"/>
44
            </FIELD>
45
            <FIELD name="id">
46
                <xsl:value-of select="$projectId"/>
47
            </FIELD>
48
            <FIELD name="code">
49
                <xsl:value-of select="./id"/>
50
            </FIELD>
51
            <FIELD name="call_identifier">
52
                <xsl:value-of select="$callID"/>
53
            </FIELD>
54
            <FIELD name="websiteurl">
55
                <xsl:value-of select="./refUri"/>
56
            </FIELD>
57
            <FIELD name="acronym">
58
                <xsl:value-of select="./reference"/>
59
            </FIELD>
60
            <FIELD name="title">
61
                <xsl:value-of select="./name"/>
62
            </FIELD>
63
            <FIELD name="startdate" type="date" format="dd/MM/yyyy">
64
                <xsl:value-of select="./startDate"/>
65
            </FIELD>
66
            <FIELD name="enddate" type="date" format="dd/MM/yyyy">
67
                <xsl:value-of select="./endDate"/>
68
            </FIELD>
69
            <FIELD name="keywords">
70
                <xsl:for-each select="./classification/elem">
71
                    <xsl:if test="position() &gt; 1">, </xsl:if>
72
                    <xsl:value-of select="."/>
73
                </xsl:for-each>
74
            </FIELD>
75
            <FIELD name="collectedfrom">
76
                <xsl:value-of select="$parentDatasourceId"/>
77
            </FIELD>
78
            <FIELD name="contracttypeclass">UNKNOWN</FIELD>
79
            <FIELD name="contracttypescheme">fct:contractTypes</FIELD>
80
            <FIELD name="provenanceactionclass">sysimport:crosswalk:entityregistry</FIELD>
81
        </ROW>
82

  
83
        <!-- 
52 84
		<xsl:for-each select="./persons/elem">
53 85
			<xsl:if test="string-length(./name) &gt; 0 and string-length(./researcherId) &gt; 0">
54 86
				
......
113 145
			</xsl:if>
114 146
		</xsl:for-each>
115 147
		-->
116
					
117
		<xsl:for-each select="./funding">
118
			<xsl:variable name="fundingName" select="normalize-space(./program)" />
119
			<xsl:if test="string-length($fundingName) &gt; 0">
120
				<xsl:variable name="fundingId" select="concat($prefix,'::',$fundingName)" />
121
				<ROW table="fundings">
122
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="$fundingId"/></FIELD>
123
					<FIELD name="id"><xsl:value-of select="$fundingId"/></FIELD>
124
					<FIELD name="name"><xsl:value-of select="$fundingName"/></FIELD>
125
					<FIELD name="description"><xsl:value-of select="$fundingName"/></FIELD>
126
					<FIELD name="semanticclass">fct:program</FIELD>
127
					<FIELD name="semanticscheme">fct:funding_typologies</FIELD>
128
				</ROW>
129
				<ROW table="funding_funding">
130
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@fct_________::FCT')"/></FIELD>
131
					<FIELD name="funding1"><xsl:value-of select="$fundingId"/></FIELD>
132
					<FIELD name="funding2">fct_________::FCT</FIELD>
133
					<FIELD name="semanticclass">fct:hasParentFunding</FIELD>
134
					<FIELD name="semanticscheme">fct:funding_relations</FIELD>
135
				</ROW>
136
				<ROW table="organization_funding">
137
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($prefix,'::', ./funder/acronym, '@@', $fundingId)"/></FIELD>
138
					<FIELD name="funding"><xsl:value-of select="$fundingId"/></FIELD>
139
					<FIELD name="funder"><xsl:value-of select="concat($prefix, '::', ./funder/acronym)"></xsl:value-of></FIELD>
140
				</ROW>
141
				<ROW table="project_funding">
142
					<FIELD name="_dnet_resource_identifier_"><xsl:value-of select="concat($fundingId, '@@', $projectId)" /></FIELD>
143
					<FIELD name="funding"><xsl:value-of select="$fundingId" /></FIELD>
144
					<FIELD name="project"><xsl:value-of select="$projectId" /></FIELD>
145
					<FIELD name="startdate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../startDate" /></FIELD>
146
					<FIELD name="enddate" type="date" format="dd/MM/yyyy"><xsl:value-of select="../endDate" /></FIELD> 
147
					<FIELD name="optional1"><xsl:value-of select="./amount" /></FIELD>
148
					<FIELD name="optional2"><xsl:value-of select="./dateAwarded" /></FIELD>
149
				</ROW>
150
			</xsl:if>
151
		</xsl:for-each>
152 148

  
153
	</xsl:template>
149
        <xsl:for-each select="./funding">
150
            <xsl:variable name="fundingName" select="normalize-space(./program)"/>
151
            <xsl:if test="string-length($fundingName) &gt; 0">
152
                <xsl:variable name="fundingId" select="concat($namespacePrefix,'::',$fundingName)"/>
153
                <ROW table="fundings">
154
                    <FIELD name="_dnet_resource_identifier_">
155
                        <xsl:value-of select="$fundingId"/>
156
                    </FIELD>
157
                    <FIELD name="id">
158
                        <xsl:value-of select="$fundingId"/>
159
                    </FIELD>
160
                    <FIELD name="name">
161
                        <xsl:value-of select="$fundingName"/>
162
                    </FIELD>
163
                    <FIELD name="description">
164
                        <xsl:value-of select="$fundingName"/>
165
                    </FIELD>
166
                    <FIELD name="semanticclass">fct:program</FIELD>
167
                    <FIELD name="semanticscheme">fct:funding_typologies</FIELD>
168
                </ROW>
169
                <ROW table="funding_funding">
170
                    <FIELD name="_dnet_resource_identifier_">
171
                        <xsl:value-of select="concat($fundingId, '@@fct_________::FCT')"/>
172
                    </FIELD>
173
                    <FIELD name="funding1">
174
                        <xsl:value-of select="$fundingId"/>
175
                    </FIELD>
176
                    <FIELD name="funding2">fct_________::FCT</FIELD>
177
                    <FIELD name="semanticclass">fct:hasParentFunding</FIELD>
178
                    <FIELD name="semanticscheme">fct:funding_relations</FIELD>
179
                </ROW>
180
                <ROW table="organization_funding">
181
                    <FIELD name="_dnet_resource_identifier_">
182
                        <xsl:value-of
183
                            select="concat($namespacePrefix,'::', ./funder/acronym, '@@', $fundingId)"
184
                        />
185
                    </FIELD>
186
                    <FIELD name="funding">
187
                        <xsl:value-of select="$fundingId"/>
188
                    </FIELD>
189
                    <FIELD name="funder">
190
                        <xsl:value-of select="concat($namespacePrefix, '::', ./funder/acronym)"/>
191
                    </FIELD>
192
                </ROW>
193
                <ROW table="project_funding">
194
                    <FIELD name="_dnet_resource_identifier_">
195
                        <xsl:value-of select="concat($fundingId, '@@', $projectId)"/>
196
                    </FIELD>
197
                    <FIELD name="funding">
198
                        <xsl:value-of select="$fundingId"/>
199
                    </FIELD>
200
                    <FIELD name="project">
201
                        <xsl:value-of select="$projectId"/>
202
                    </FIELD>
203
                    <FIELD name="startdate" type="date" format="dd/MM/yyyy">
204
                        <xsl:value-of select="../startDate"/>
205
                    </FIELD>
206
                    <FIELD name="enddate" type="date" format="dd/MM/yyyy">
207
                        <xsl:value-of select="../endDate"/>
208
                    </FIELD>
209
                    <FIELD name="optional1">
210
                        <xsl:value-of select="./amount"/>
211
                    </FIELD>
212
                    <FIELD name="optional2">
213
                        <xsl:value-of select="./dateAwarded"/>
214
                    </FIELD>
215
                </ROW>
216
            </xsl:if>
217
        </xsl:for-each>
218

  
219
    </xsl:template>
154 220
</xsl:stylesheet>

Also available in: Unified diff