source: metadata/trunk/toolkit/xslt/meta/MetasharetoOLAC.xsl @ 2587

Last change on this file since 2587 was 2587, checked in by dietuyt, 11 years ago

Renamed (without V number)

File size: 12.7 KB
Line 
1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3   xmlns="http://www.openarchives.org/OAI/2.0/static-repository"
4   xmlns:oai="http://www.openarchives.org/OAI/2.0/"
5   xmlns:olac="http://www.language-archives.org/OLAC/1.1/"
6   xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/"
7   xmlns:ms="http://www.ilsp.gr/META-XMLSchema"
8   xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/static-repository
9 http://www.language-archives.org/OLAC/1.1/static-repository.xsd
10 http://www.language-archives.org/OLAC/1.1/
11 http://www.language-archives.org/OLAC/1.1/olac.xsd
12 http://purl.org/dc/elements/1.1/
13 http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd
14 http://purl.org/dc/terms/
15 http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd">
16
17
18   <!-- Metashare to OLAC converter by IULA UPF. Change dc:publisher as desired (hardcoded!!!)-->
19
20   <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
21   <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
22
23   <xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
24   <xsl:template match="text()"/>
25
26   
27   <!-- RESOURCE INFO (common to all resources: dc.title & dc.description & dc.publisher & dc.creator & dc.date dc.rights) -->
28
29
30   <xsl:template match="ms:resourceInfo">
31      <olac:olac
32         xsi:schemaLocation="http://www.language-archives.org/OLAC/1.1/
33         http://www.language-archives.org/OLAC/1.1/olac.xsd">
34         <xsl:apply-templates/>
35      </olac:olac>
36   </xsl:template>
37
38
39   <!-- dc.title & dc.description & dc.publisher -->
40   <xsl:template match="ms:resourceInfo/ms:identificationInfo">
41
42      <dc:title>
43         <xsl:value-of select="./ms:resourceName"/>
44      </dc:title>
45
46      <dc:description>
47         <xsl:for-each select="./ms:description">
48            <xsl:value-of select="normalize-space(.)"/>
49            <xsl:text> </xsl:text>
50         </xsl:for-each>
51      </dc:description>
52     
53      <dc:publisher>
54         <xsl:text>Universitat Pompeu Fabra. Institut Universitari de LingÌística Aplicada (IULA)</xsl:text>
55      </dc:publisher>
56     
57      <dc:identifier xsi:type="dcterms:URI">
58         <xsl:value-of select="./ms:identifier"/>
59      </dc:identifier>
60     
61   </xsl:template>
62
63
64   <!-- dc.creator -->
65   <xsl:template
66      match="/ms:resourceInfo/ms:resourceCreationInfo/ms:resourceCreator/ms:organizationInfo/ms:organizationName">
67     
68      <dc:creator>
69         <xsl:value-of select="."/>
70      </dc:creator>
71   </xsl:template>
72
73   <!-- dc.date  -->
74   <xsl:template match="/ms:resourceInfo/ms:metadataInfo/ms:metadataCreationDate">
75      <dc:date>
76         <xsl:value-of select="."/>
77      </dc:date>
78   </xsl:template>
79
80   <!-- dc.rights- -->
81   
82   <xsl:template match="ms:resourceInfo/ms:distributionInfo">
83      <dc:rights>
84         <xsl:choose>
85            <xsl:when test="./ms:licenceInfo/ms:licence = 'CC-BY-NC-SA'">
86               <xsl:text>This resource is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/)</xsl:text>
87            </xsl:when>
88           
89            <xsl:when test="./ms:licenceInfo/ms:licence = 'CC-BY-SA'">
90               <xsl:text>This resource is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-sa/3.0/)</xsl:text>
91            </xsl:when>
92           
93            <xsl:when test="./ms:licenceInfo/ms:licence = 'AGPL'">
94               <xsl:text>This resource is licensed under an Affero General Public License</xsl:text>
95            </xsl:when>
96           
97            <xsl:when test="./ms:licenceInfo/ms:licence = 'GPL'">
98               <xsl:text>This resource is licensed under a GNU General Public License version 2.0</xsl:text>
99            </xsl:when>
100           
101            <xsl:when test="./ms:licenceInfo/ms:licence = 'MSCommons-BY-NC-SA'">
102               <xsl:text>This resource is licensed under a META-SHARE Commons Attribution-NonCommercial-ShareAlike License (http://www.meta-net.eu/meta-share/meta-share-licenses/META-SHARE%20COMMONS_BYNCSA%20v1.0.pdf)</xsl:text>
103            </xsl:when>
104           
105            <xsl:when test="./ms:licenceInfo/ms:licence = 'GFDL'">
106               <xsl:text>This resource is licensed under a GNU Free Documentation License</xsl:text>
107            </xsl:when>
108           
109            <xsl:otherwise>
110               <xsl:text>This resource is licensed under a '</xsl:text>
111               <xsl:value-of select="./ms:licenceInfo/ms:licence"/>
112               <xsl:text>'</xsl:text>
113            </xsl:otherwise>
114         </xsl:choose>
115         
116         <xsl:text>. The availability status of the resource is: '</xsl:text>
117         <xsl:value-of select="ms:availability"/>
118         <xsl:text>'.</xsl:text>
119      </dc:rights>
120   </xsl:template>
121   
122
123
124   
125   <!-- LEXICAL RESOURCES -->
126   
127   <!-- dc.subject & dc.type & dc.format & dc.language -->
128   <xsl:template match="ms:resourceInfo/ms:resourceComponentType/ms:lexicalConceptualResourceInfo">
129
130      <dc:subject>
131         <xsl:text>'language resources', 'lexical conceptual resource', '</xsl:text>
132         <xsl:value-of
133            select="/ms:resourceInfo/ms:resourceComponentType/ms:lexicalConceptualResourceInfo/ms:lexicalConceptualResourceMediaType/ms:lexicalConceptualResourceTextInfo/ms:lingualityInfo/ms:lingualityType"/>
134         <xsl:text> </xsl:text>
135         <xsl:value-of
136            select="/ms:resourceInfo/ms:resourceComponentType/ms:lexicalConceptualResourceInfo/ms:lexicalConceptualResourceType"/>
137         <xsl:text>'</xsl:text>
138      </dc:subject>
139     
140       
141      <!-- Metashare lexicalConceptualResourceType -> OLAC Vocabulary lexicon (currently everything goes to olac lexicon and dcterms Dataset) -->
142      <xsl:choose>
143         <xsl:when test="./ms:lexicalConceptualResourceType = 'lexicon'">
144            <dc:type xsi:type="olac:linguistic-type" olac:code="lexicon"/>
145            <dc:type>
146               <xsl:attribute name="xsi:type">
147                  <xsl:text>dcterms:DCMIType</xsl:text>
148               </xsl:attribute>   
149               <xsl:text>Dataset</xsl:text>
150            </dc:type> 
151         </xsl:when>
152         <xsl:when test="./ms:lexicalConceptualResourceType = 'lexicon/wordList'">
153            <dc:type xsi:type="olac:linguistic-type" olac:code="lexicon"/>
154            <dc:type>
155               <xsl:attribute name="xsi:type">
156                  <xsl:text>dcterms:DCMIType</xsl:text>
157               </xsl:attribute>   
158               <xsl:text>Dataset</xsl:text>
159            </dc:type> 
160         </xsl:when>
161         <xsl:when test="./ms:lexicalConceptualResourceType = 'thesaurus'">
162            <dc:type xsi:type="olac:linguistic-type" olac:code="lexicon"/>
163            <dc:type>
164               <xsl:attribute name="xsi:type">
165                  <xsl:text>dcterms:DCMIType</xsl:text>
166               </xsl:attribute>   
167               <xsl:text>Dataset</xsl:text>
168            </dc:type> 
169         </xsl:when>
170         <xsl:when test="./ms:lexicalConceptualResourceType = 'terminologicalResource'">
171            <dc:type xsi:type="olac:linguistic-type" olac:code="lexicon"/>
172            <dc:type>
173               <xsl:attribute name="xsi:type">
174                  <xsl:text>dcterms:DCMIType</xsl:text>
175               </xsl:attribute>   
176               <xsl:text>Dataset</xsl:text>
177            </dc:type> 
178         </xsl:when>
179         <xsl:otherwise>
180            <dc:type xsi:type="olac:linguistic-type" olac:code="lexicon"/>
181            <dc:type>
182               <xsl:attribute name="xsi:type">
183                  <xsl:text>dcterms:DCMIType</xsl:text>
184               </xsl:attribute>   
185               <xsl:text>Dataset</xsl:text>
186            </dc:type> 
187         </xsl:otherwise>
188      </xsl:choose>
189
190     
191      <xsl:if
192         test="./ms:lexicalConceptualResourceMediaType/ms:lexicalConceptualResourceTextInfo/ms:textFormatInfo/ms:mimeType">
193         <dc:format>
194
195            <xsl:value-of
196               select="./ms:lexicalConceptualResourceMediaType/ms:lexicalConceptualResourceTextInfo/ms:textFormatInfo/ms:mimeType"/>
197
198         </dc:format>
199      </xsl:if>
200      <xsl:if
201         test="./ms:lexicalConceptualResourceMediaType/ms:lexicalConceptualResourceTextInfo/ms:characterEncodingInfo/ms:characterEncoding">
202         <dc:format>
203
204            <xsl:value-of
205               select="./ms:lexicalConceptualResourceMediaType/ms:lexicalConceptualResourceTextInfo/ms:characterEncodingInfo/ms:characterEncoding"/>
206
207         </dc:format>
208      </xsl:if>
209
210      <xsl:for-each
211         select="./ms:lexicalConceptualResourceMediaType/ms:lexicalConceptualResourceTextInfo/ms:languageInfo">
212         <dc:language>
213            <xsl:attribute name="xsi:type">
214               <xsl:text>olac:language</xsl:text>
215            </xsl:attribute>
216            <xsl:attribute name="olac:code">
217               <xsl:value-of select="./ms:languageId"/>
218            </xsl:attribute>
219         </dc:language>
220      </xsl:for-each>   
221
222   </xsl:template>
223
224   <!-- CORPUS -->
225
226   <xsl:template match="/ms:resourceInfo/ms:resourceComponentType/ms:corpusInfo">
227
228      <dc:subject>
229         <xsl:text>'language resources', '</xsl:text>
230         <xsl:value-of
231            select="/ms:resourceInfo/ms:resourceComponentType/ms:corpusInfo/ms:corpusMediaType/ms:corpusTextInfo/ms:lingualityInfo/ms:lingualityType"/>
232         <xsl:text> corpus'</xsl:text>
233      </dc:subject>
234     
235      <dc:type xsi:type="olac:linguistic-type" olac:code="primary_text"/>
236
237      <xsl:choose>
238         <xsl:when test="./ms:corpusMediaType/ms:corpusTextInfo/ms:mediaType = 'corpusAudioInfo'">
239            <dc:type>
240               <xsl:attribute name="xsi:type">
241                  <xsl:text>dcterms:DCMIType</xsl:text>
242               </xsl:attribute>   
243               <xsl:text>Sound</xsl:text>
244            </dc:type>
245         </xsl:when>
246         <xsl:when test="./ms:corpusMediaType/ms:corpusTextInfo/ms:mediaType = 'corpusTextInfo'">
247            <dc:type>
248               <xsl:attribute name="xsi:type">
249                  <xsl:text>dcterms:DCMIType</xsl:text>
250               </xsl:attribute>   
251               <xsl:text>Text</xsl:text>
252            </dc:type>
253         </xsl:when>
254         <xsl:when test="./ms:corpusMediaType/ms:corpusTextInfo/ms:mediaType = 'corpusImageInfo'">
255            <dc:type>
256               <xsl:attribute name="xsi:type">
257                  <xsl:text>dcterms:DCMIType</xsl:text>
258               </xsl:attribute>   
259               <xsl:text>Image</xsl:text>
260            </dc:type>
261         </xsl:when>
262      </xsl:choose>
263
264      <xsl:if test="./ms:corpusMediaType/ms:corpusTextInfo/ms:textFormatInfo/ms:mimeType">
265         <dc:format>
266
267            <xsl:value-of
268               select="./ms:corpusMediaType/ms:corpusTextInfo/ms:textFormatInfo/ms:mimeType"/>
269
270         </dc:format>
271      </xsl:if>
272      <xsl:if
273         test="./ms:corpusMediaType/ms:corpusTextInfo/ms:characterEncodingInfo/ms:characterEncoding">
274         <dc:format>
275
276            <xsl:value-of
277               select="./ms:corpusMediaType/ms:corpusTextInfo/ms:characterEncodingInfo/ms:characterEncoding"/>
278
279         </dc:format>
280      </xsl:if>
281
282      <xsl:for-each select="./ms:corpusMediaType/ms:corpusTextInfo/ms:languageInfo">
283         <dc:language>
284            <xsl:attribute name="xsi:type">
285               <xsl:text>olac:language</xsl:text>
286            </xsl:attribute>
287            <xsl:attribute name="olac:code">
288               <xsl:value-of select="./ms:languageId"/>
289            </xsl:attribute>
290         </dc:language>
291      </xsl:for-each>
292
293   </xsl:template>
294
295
296   <!-- TOOLS -->
297
298   <xsl:template match="/ms:resourceInfo/ms:resourceComponentType/ms:toolServiceInfo">
299
300      <xsl:choose>
301         <xsl:when test="./ms:toolServiceType = 'service'">
302            <dc:type>
303               <xsl:attribute name="xsi:type">
304                  <xsl:text>dcterms:DCMIType</xsl:text>
305               </xsl:attribute>   
306                  <xsl:text>Service</xsl:text>
307            </dc:type>
308         </xsl:when>
309         <xsl:otherwise>
310            <dc:type>
311               <xsl:attribute name="xsi:type">
312                  <xsl:text>dcterms:DCMIType</xsl:text>
313               </xsl:attribute>
314               
315                  <xsl:text>Software</xsl:text>
316               
317            </dc:type>
318         </xsl:otherwise>
319      </xsl:choose>
320
321      <dc:subject>
322         <xsl:text>'language resources', 'language </xsl:text>
323         <xsl:value-of
324            select="/ms:resourceInfo/ms:resourceComponentType/ms:toolServiceInfo/ms:toolServiceType"/>
325         <xsl:text>', '</xsl:text>
326         <xsl:value-of
327            select="/ms:resourceInfo/ms:resourceComponentType/ms:toolServiceInfo/ms:toolServiceSubtype"/>
328         <xsl:text>'</xsl:text>
329      </dc:subject>
330
331   </xsl:template>
332
333
334 
335   
336
337
338</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.