Project

General

Profile

1
<RESOURCE_PROFILE>
2
    <HEADER>
3
        <RESOURCE_IDENTIFIER value="592a7a9d-8288-47b5-9913-667c778e3cc4_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
4
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
5
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
6
        <RESOURCE_URI value=""/>
7
        <DATE_OF_CREATION value="2014-07-17T10:41:08+02:00"/>
8
    </HEADER>
9
    <BODY>
10
        <CONFIGURATION>
11
            <IMPORTED/>
12
            <SCRIPT>
13
                <TITLE>Mediawiki to eagle</TITLE>
14
                <CODE><![CDATA[
15
<xsl:stylesheet version="2.0"
16
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
17
    xmlns:dnet="eu.dnetlib.miscutils.functional.xml.DnetXsltFunctions"
18
    xmlns:utils="eu.dnetlib.miscutils.datetime.DateUtils" 
19
    xmlns:tei="http://www.tei-c.org/ns/1.0"
20
    xmlns:oai="http://www.openarchives.org/OAI/2.0/"
21
    exclude-result-prefixes="xsl tei dnet utils">
22
    
23
    <xsl:output indent="yes" encoding="UTF-8"/>
24
    
25
    <xsl:param name="varOfficialName" />
26
    
27
    <xsl:variable name="REPO_ID" select="//*[local-name()='repositoryId']" />
28
    <xsl:variable name="ORIG_OBJ_ID" select="//*[local-name()='objIdentifier']" />
29
    <xsl:variable name="NOW" select="utils:now_ISO8601()" />
30
    <xsl:variable name="LOCAL_ID" select="//entity/@id" />
31
    <xsl:variable name="LOCAL_ID_MD5" select="dnet:md5($LOCAL_ID)" />
32
    <xsl:variable name="DATE_EDITED" select="//entity/@_modified_" />
33
    
34
    <xsl:template match="/">
35
        <package xsl:exclude-result-prefixes="oai">
36
            <xsl:for-each select="//property[@id='p11' or @id='p12' or 
37
                @id='p13' or @id='p14'  or 
38
                @id='p15' or @id='p16' or 
39
                @id='p17' or @id='p18' or 
40
                @id='p19' or @id='p20' or 
41
                @id='p57' or @id='p61' or 
42
                @id='p67']/claim">
43
                <xsl:variable name="TRANSLATION_LANG">
44
                    <xsl:choose>
45
                        <xsl:when test="./mainsnak[@property = 'p11'] ">en</xsl:when>
46
                        <xsl:when test="./mainsnak[@property = 'p12'] ">de</xsl:when>
47
                        <xsl:when test="./mainsnak[@property = 'p13'] ">it</xsl:when>
48
                        <xsl:when test="./mainsnak[@property = 'p14'] ">es</xsl:when>
49
                        <xsl:when test="./mainsnak[@property = 'p15'] ">fr</xsl:when>
50
                        <xsl:when test="./mainsnak[@property = 'p16'] ">el</xsl:when>
51
                        <xsl:when test="./mainsnak[@property = 'p17'] ">ru</xsl:when>
52
                        <xsl:when test="./mainsnak[@property = 'p18'] ">si</xsl:when>
53
                        <xsl:when test="./mainsnak[@property = 'p19'] ">hu</xsl:when>
54
                        <xsl:when test="./mainsnak[@property = 'p20'] ">ro</xsl:when>
55
                        <xsl:when test="./mainsnak[@property = 'p57'] ">hr</xsl:when>
56
                        <xsl:when test="./mainsnak[@property = 'p61'] ">se</xsl:when>
57
                        <xsl:when test="./mainsnak[@property = 'p67'] ">he</xsl:when>
58
                        <xsl:otherwise>unknown</xsl:otherwise>
59
                    </xsl:choose>
60
                </xsl:variable>
61
                <oai:record xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oai="http://www.openarchives.org/OAI/2.0/">
62
                    <oai:header>
63
                        <dri:objIdentifier>
64
                            <xsl:if test="//property[@id='p22' or @id='p24' or
65
                                @id='p33' or @id='p34' or
66
                                @id='p35' or @id='p36' or
67
                                @id='p37' or @id='p38' or
68
                                @id='p39' or @id='p40' or
69
                                @id='p48' or @id='p50' or
70
                                @id='p59' or @id='p63' or 
71
                                @id='p47' or @id='p68']/claim">
72
                                <xsl:value-of select="concat($ORIG_OBJ_ID,'::', dnet:md5(./@id), '_translation')" />
73
                            </xsl:if>
74
                        </dri:objIdentifier>
75
                        <dri:dateOfCollection>
76
                            <xsl:value-of select="$NOW" />
77
                        </dri:dateOfCollection>
78
                        <dri:repositoryId>
79
                            <xsl:value-of select="$REPO_ID" />
80
                        </dri:repositoryId>
81
                    </oai:header>
82
                    <oai:metadata>
83
                        <eagleObject xmlns="http://www.eagle-network.eu/eagle">
84
                            <dnetResourceIdentifier>
85
                                <xsl:value-of select="concat($ORIG_OBJ_ID, '::', dnet:md5(./@id), '::translation')" />
86
                            </dnetResourceIdentifier>
87
                            <recordSourceInfo providerName="{$varOfficialName}" providerAcronym="MW" landingPage="{concat('http://www.eagle-network.eu/wiki/index.php/Item:', $LOCAL_ID)}">
88
                                <xsl:value-of select="$LOCAL_ID" />
89
                            </recordSourceInfo>
90
                            <editingInfo>
91
                                <dateEdited>
92
                                    <xsl:value-of select="$DATE_EDITED" />
93
                                </dateEdited>
94
                                <metadataEditor>Eagle mediawiki</metadataEditor>
95
                            </editingInfo>
96
                            <metadataIpr />
97
                            <xsl:for-each select="//description">
98
                                <title lang="{./@language}">
99
                                    <xsl:value-of select="./@value" />
100
                                </title>
101
                            </xsl:for-each>
102
                            <xsl:for-each select="//description">
103
                                <description lang="{./@language}">
104
                                    <xsl:value-of select="./@value" />
105
                                </description>
106
                            </xsl:for-each>
107
                            <entityType>documental</entityType>
108
                            <documentalManifestation>
109
                                <documentType>translation</documentType>
110
                                <xsl:for-each select="//property[@id='p22' or @id='p24' or
111
		                                @id='p33' or @id='p34' or
112
		                                @id='p35' or @id='p36' or
113
		                                @id='p37' or @id='p38' or
114
		                                @id='p39' or @id='p40' or
115
		                                @id='p48' or @id='p50' or
116
		                                @id='p59' or @id='p63' or 
117
		                                @id='p47' or @id='p68']/claim">
118
                                    <hasArtifact>
119
                                        <dnetResourceIdentifier>
120
                                            <xsl:variable name="acronym">
121
                                                <xsl:choose>
122
                                                    <xsl:when test="./mainsnak/@property='p22'">UAH</xsl:when>
123
                                                    <xsl:when test="./mainsnak/@property='p24'">EDH</xsl:when>
124
                                                    <xsl:when test="./mainsnak/@property='p33'">AUSONIUS</xsl:when>
125
                                                    <xsl:when test="./mainsnak/@property='p34'">PLUS</xsl:when>
126
                                                    <xsl:when test="./mainsnak/@property='p35'">DAI</xsl:when>
127
                                                    <xsl:when test="./mainsnak/@property='p36'">CYI</xsl:when>
128
                                                    <xsl:when test="./mainsnak/@property='p37'">EDB</xsl:when>
129
                                                    <xsl:when test="./mainsnak/@property='p38'">EDR</xsl:when>
130
                                                    <xsl:when test="./mainsnak/@property='p39'">EDH</xsl:when>
131
                                                    <xsl:when test="./mainsnak/@property='p40'">BSR</xsl:when>
132
                                                    <xsl:when test="./mainsnak/@property='p47'">UOXF</xsl:when>
133
                                                    <xsl:when test="./mainsnak/@property='p48'">ELTE</xsl:when>
134
                                                    <xsl:when test="./mainsnak/@property='p50'">APH</xsl:when>
135
                                                    <xsl:when test="./mainsnak/@property='p59'">UBB</xsl:when>
136
                                                    <xsl:when test="./mainsnak/@property='p63'">RIB</xsl:when>
137
                                                    <xsl:when test="./mainsnak/@property='p68'">MAMA</xsl:when>
138
                                                </xsl:choose>
139
                                            </xsl:variable>
140
                                            <xsl:value-of select="concat($acronym, '::', dnet:md5(./mainsnak/datavalue/@value), '::artifact')"></xsl:value-of>
141
                                        </dnetResourceIdentifier>
142
                                        <recordSourceInfo providerName="" providerAcronym="" landingPage="">
143
                                            <xsl:value-of select="./mainsnak/datavalue/@value" />
144
                                        </recordSourceInfo>
145
                                        <hasTmId>
146
                                            <tmId>
147
                                                <xsl:value-of select="//mainsnak[@property='p3']/datavalue/@value"></xsl:value-of>
148
                                            </tmId>
149
                                        </hasTmId>
150
                                        <objectType></objectType>
151
                                        <material></material>
152
                                    </hasArtifact>
153
                                </xsl:for-each>
154
                                <translation>
155
                                    <text lang="{$TRANSLATION_LANG}">
156
                                        <xsl:value-of select="./mainsnak/datavalue/@value"></xsl:value-of>
157
                                    </text>
158
                                    <notes></notes>
159
                                    <author>
160
                                        <xsl:value-of select=".//snak[@property='p21']/datavalue/@value" />
161
                                    </author>
162
                                    <translationIpr uri="">
163
                                        <xsl:choose>
164
                                            <xsl:when test=".//snak[@property='p25']/datavalue/@value != ''">
165
                                                <xsl:value-of select=".//snak[@property='p25']/datavalue/@value" />
166
                                            </xsl:when>
167
                                            <xsl:otherwise>
168
                                                <xsl:choose>
169
                                                    <xsl:when test="//mainsnak[@property='p25']/datavalue/@value != ''">
170
                                                        <xsl:value-of select="//mainsnak[@property='p25']/datavalue/@value" />
171
                                                    </xsl:when>
172
                                                    <xsl:otherwise>CC0 - No rights reserved</xsl:otherwise>
173
                                                </xsl:choose>
174
                                            </xsl:otherwise>
175
                                        </xsl:choose>
176
                                    </translationIpr>
177
                                    <publicationTitle>
178
                                        <xsl:value-of select=".//snak[@property='p26']/datavalue/@value" />
179
                                    </publicationTitle>
180
                                    <publicationYear>
181
                                        <xsl:value-of select=".//snak[@property='p29']/datavalue/@value" />
182
                                    </publicationYear>
183
                                    <publicationAuthor>
184
                                        <xsl:value-of select=".//snak[@property='p46']/datavalue/@value" />
185
                                    </publicationAuthor>
186
                                    <publicationEditor>
187
                                        <xsl:value-of select=".//snak[@property='p41']/datavalue/@value" />
188
                                    </publicationEditor>
189
                                    <publicationPlace>
190
                                        <xsl:value-of select=".//snak[@property='p28']/datavalue/@value" />
191
                                    </publicationPlace>
192
                                    <xsl:for-each select="//property[@id='p22' or @id='p24' or
193
			                                @id='p33' or @id='p34' or
194
			                                @id='p35' or @id='p36' or
195
			                                @id='p37' or @id='p38' or
196
			                                @id='p39' or @id='p40' or
197
			                                @id='p48' or @id='p50' or
198
			                                @id='p59' or @id='p63' or 
199
			                                @id='p47' or @id='p68']/claim">
200
                                        <hasTranscription>
201
                                            <dnetResourceIdentifier>
202
                                                <xsl:variable name="acronym">
203
                                                    <xsl:choose>
204
                                                        <xsl:when test="./mainsnak/@property='p22'">UAH</xsl:when>
205
	                                                    <xsl:when test="./mainsnak/@property='p24'">EDH</xsl:when>
206
	                                                    <xsl:when test="./mainsnak/@property='p33'">AUSONIUS</xsl:when>
207
	                                                    <xsl:when test="./mainsnak/@property='p34'">PLUS</xsl:when>
208
	                                                    <xsl:when test="./mainsnak/@property='p35'">DAI</xsl:when>
209
	                                                    <xsl:when test="./mainsnak/@property='p36'">CYI</xsl:when>
210
	                                                    <xsl:when test="./mainsnak/@property='p37'">EDB</xsl:when>
211
	                                                    <xsl:when test="./mainsnak/@property='p38'">EDR</xsl:when>
212
	                                                    <xsl:when test="./mainsnak/@property='p39'">EDH</xsl:when>
213
	                                                    <xsl:when test="./mainsnak/@property='p40'">BSR</xsl:when>
214
	                                                    <xsl:when test="./mainsnak/@property='p47'">UOXF</xsl:when>
215
	                                                    <xsl:when test="./mainsnak/@property='p48'">ELTE</xsl:when>
216
	                                                    <xsl:when test="./mainsnak/@property='p50'">APH</xsl:when>
217
	                                                    <xsl:when test="./mainsnak/@property='p59'">UBB</xsl:when>
218
	                                                    <xsl:when test="./mainsnak/@property='p63'">RIB</xsl:when>
219
	                                                    <xsl:when test="./mainsnak/@property='p68'">MAMA</xsl:when>
220
                                                    </xsl:choose>
221
                                                </xsl:variable>
222
                                                <xsl:value-of select="concat($acronym, '::', dnet:md5(./mainsnak/datavalue/@value), '::transcription')"></xsl:value-of>
223
                                            </dnetResourceIdentifier>
224
                                            <recordSourceInfo providerName="" providerAcronym="" landingPage="" />
225
                                            <text></text>
226
                                        </hasTranscription>
227
                                    </xsl:for-each>
228
                                </translation>
229
                            </documentalManifestation>
230
                        </eagleObject>
231
                    </oai:metadata>
232
                </oai:record>
233
            </xsl:for-each>
234
        </package>
235
    </xsl:template>
236
</xsl:stylesheet>
237
]]></CODE>
238
            </SCRIPT>
239
        </CONFIGURATION>
240
        <STATUS/>
241
        <SECURITY_PARAMETERS/>
242
    </BODY>
243
</RESOURCE_PROFILE>
(5-5/6)