Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / rdf / rdf.xsl @ 187

History | View | Annotate | Download (13 kB)

1
<?xml version="1.0"?>
2
<xsl:stylesheet 
3
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
4
    xmlns:oo="http://purl.org/openorg/"
5
    xmlns="http://purl.org/NET/crm-owl#" 
6
    xmlns:tei="http://www.tei-c.org/ns/1.0" 
7
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
8
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
9
    xmlns:owl="http://www.w3.org/2002/07/owl#" 
10
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#" 
11
    xmlns:crm="http://purl.org/NET/crm-owl#" 
12
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
13
    xmlns:html="http://www.w3.org/1999/xhtml"
14
    version="1.0" 
15
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
16
    xmlns:service="http://purl.org/service/"
17
    xmlns:ox-service="http://vocab.ox.ac.uk/service/"
18
    exclude-result-prefixes="tei rdf rdfs owl xsd crm xsl xs oo foaf
19
    service ox-service">
20

    
21
  <xsl:param name="REQUEST">/</xsl:param>
22
  <xsl:param name="SERVER">http://www.oucs.ox.ac.uk</xsl:param>
23

    
24
  <xsl:output encoding="utf-8" method="xml" indent="yes"/>
25

    
26
  <xsl:key name="persons" match="persName" use="@ref"/>
27

    
28
  <xsl:template match="/">
29
    <rdf:RDF>
30
      <xsl:apply-templates/>
31
    </rdf:RDF>
32
  </xsl:template>
33

    
34
  <xsl:template match="html:link[@rev|@rel]">
35
    <service:Service
36
	rdf:about="{@href}">
37
      <xsl:if test="@rev='ox-service:serviceLevelDescription'">
38
	<rdfs:label>
39
	  <xsl:value-of
40
	      select="ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title|ancestor::TEI.2/teiHeader/fileDesc/titleStmt/title"/>
41
	</rdfs:label>
42
	<service:maintainedBy>
43
	  <foaf:Group>
44
	    <xsl:attribute name="rdf:about">
45
	      <xsl:value-of select="substring-before(@href,'service')"/>
46
	      <xsl:text>group</xsl:text>
47
	      <xsl:value-of select="substring-after(@href,'service')"/>
48
	    </xsl:attribute>
49
	    <foaf:mbox rdf:resource="mailto:{ancestor::tei:TEI/tei:teiHeader/tei:fileDesc/tei:publicationStmt/tei:authority|ancestor::TEI.2/teiHeader/fileDesc/publicationStmt/authority}"/>
50
	  </foaf:Group>
51
	</service:maintainedBy>
52
	<oo:contact>
53
	    <xsl:attribute name="rdf:resource">
54
	      <xsl:value-of select="substring-before(@href,'service')"/>
55
	      <xsl:text>group</xsl:text>
56
	      <xsl:value-of select="substring-after(@href,'service')"/>
57
	    </xsl:attribute>
58
	</oo:contact>
59

    
60
      </xsl:if>
61
      <xsl:element name="{@rev|@rel}">
62
	<xsl:attribute name="rdf:resource">
63
	  <xsl:value-of select="$SERVER"/>
64
	  <xsl:value-of select="$REQUEST"/>
65
	</xsl:attribute>
66
      </xsl:element>
67

    
68

    
69
    </service:Service>
70
  </xsl:template>
71
<!--  
72
  <rdf:RDF
73
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
74
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
75
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
76
    xmlns:oo="http://purl.org/openorg/"
77
    xmlns:service="http://purl.org/service/"
78
    xmlns:ox-service="http://vocab.ox.ac.uk/service/">
79
  <service:Service rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus">
80
    <rdfs:label>Nexus</rdfs:label>
81
    <service:provider rdf:resource="http://oxpoints.oucs.ox.ac.uk/id/23232373"/>
82
    <service:maintainedBy>
83
      <foaf:Group rdf:about="http://data.ox.ac.uk/id/group/nexus-team">
84
        <rdfs:label>Nexus Team</rdfs:label>
85
        <org:subOrganizationOf rdf:resource="http://oxpoints.oucs.ox.ac.uk/id/23232373"/>
86
        <foaf:mbox rdf:resource="mailto:nexus@oucs.ox.ac.uk"/>
87
      </foaf:Group>
88
    </service:maintainedBy>
89
    <oo:contact rdf:resource="http://data.ox.ac.uk/id/group/nexus-team"/>
90

    
91
    <service:subService>
92
      <service:Service rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus/exchange">
93
        <rdfs:label>Nexus Exchange</rdfs:label>
94
        <foaf:homepage rdf:resource="http://www.oucs.ox.ac.uk/nexus/email/"/>
95
        <service:software rdf:resource="http://dbpedia.org/resource/Microsoft_Exchange_Server"/>
96
        <service:provides rdf:resource="http://dbpedia.org/resource/Email"/>
97

    
98
        <ox-service:serviceLevelDescription rdf:resource="http://www.oucs.ox.ac.uk/internal/sld/nexus-exchange.xml"/>
99
        <service:interface>
100
          <service:Interface rdf:about="http://data.ox.ac.uk/id/service-interface/oucs/nexus/exchange/http">
101
            <service:protocol rdf:resource="http://dbpedia.org/resource/HTTP_Secure"/>
102
            <service:endpoint rdf:resource="https://nexus.ox.ac.uk/"/>
103
          </service:Interface>
104
        </service:interface>
105
        <service:interface>
106
          <service:Interface rdf:about="http://data.ox.ac.uk/id/service-interface/oucs/nexus/exchange/imaps">
107
            <service:protocol rdf:resource="http://dbpedia.org/resource/Internet_Message_Access_Protocol"/>
108
            <service:endpoint rdf:resource="imaps://imap.nexus.ox.ac.uk/"/>
109
          </service:Interface>
110
        </service:interface>
111
      </service:Service>
112
    </service:subService>
113

    
114
    <service:subService>
115
      <service:Service rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus/sharepoint">
116
        <rdfs:label>Nexus Sharepoint</rdfs:label>
117
        <foaf:homepage rdf:resource="http://www.oucs.ox.ac.uk/nexus/sharepoint/"/>
118
        <service:software rdf:resource="http://dbpedia.org/resource/Microsoft_SharePoint_Server"/>
119
        <service:provides rdf:resource="http://dbpedia.org/resource/Collaborative_software"/>
120
        <ox-service:serviceLevelDescription rdf:resource="http://www.oucs.ox.ac.uk/internal/sld/nexus-sharepoint.xml"/>
121
        <service:interface>
122
          <service:Interface rdf:about="http://data.ox.ac.uk/id/service-interface/oucs/nexus/sharepoint/http">
123
            <service:protocol rdf:resource="http://dbpedia.org/resource/HTTP_Secure"/>
124
            <service:endpoint rdf:resource="https://sharepoint.nexus.ox.ac.uk/"/>
125
          </service:Interface>
126
        </service:interface>
127
      </service:Service>
128
    </service:subService>
129
  </service:Service>
130
</rdf:RDF>
131

    
132

    
133

    
134
<link rel="alternate" type="application/rdf+xml" href="nexus.rdf"/>
135
<link rel="foaf:primaryTopic" href="http://data.ox.ac.uk/id/service/oucs/nexus"/>
136

    
137

    
138
<link rev="foaf:homepage" href="http://data.ox.ac.uk/id/service/oucs/nexus"/>
139

    
140
<http://data.ox.ac.uk/id/service/oucs/nexus> <http://www.xmlns.com/foaf/0.1/homepage> <http://nexus.ox.ac.uk/>
141

    
142
<rdf:RDF>
143
  <rdf:Description rdf:about="http://www.oucs.ox.ac.uk/internal/sld/nexus.xml">
144
    <foaf:primaryTopic rdf:resource="http://data.ox.ac.uk/id/service/oucs/nexus"/>
145
  </rdf:Description>
146
  <rdf:Description rdf:about="http://data.ox.ac.uk/id/service/oucs/nexus">
147
    <foaf:homepage rdf:resource="http://www.oucs.ox.ac.uk/nexus/"/>
148
    <ox-service:serviceLevelDescription rdf:resource="http://www.oucs.ox.ac.uk/internal/sld/nexus.xml"/>
149
  </rdf:Description>
150
</rdf:RDF>
151

    
152
-->
153

    
154
  <xsl:template name="teiname">
155
    <xsl:choose>
156
      <xsl:when test="@type='place'">
157
        <xsl:call-template name="E53"/>
158
      </xsl:when>
159
      <xsl:when test="@type='person'">
160
        <xsl:call-template name="E21"/>
161
      </xsl:when>
162
    </xsl:choose>
163
  </xsl:template>
164

    
165
  <xsl:template name="E53">
166
    <E53_Place>
167
      <xsl:call-template name="makeID"/>
168
      <xsl:apply-templates/>
169
    </E53_Place>
170
  </xsl:template>
171

    
172
  <xsl:template name="E21">
173
    <E21_Person>
174
      <xsl:call-template name="makeID"/>
175
      <xsl:apply-templates/>
176
    </E21_Person>
177
  </xsl:template>
178

    
179
  <xsl:template name="E74">
180
    <E74_Place>
181
      <xsl:apply-templates/>
182
    </E74_Place>
183
  </xsl:template>
184

    
185
  <xsl:template name="E5">
186
    <P11i_participated_in>
187
      <E5_Event>
188
      </E5_Event>
189
    </P11i_participated_in>
190
  </xsl:template>
191

    
192
  <xsl:template name="E47">
193
    <P87_is_identified_by>
194
      <E47_Place_Spatial_Coordinates>
195
	<rdf:value>
196
	  <xsl:value-of select="."/>
197
	</rdf:value>
198
      </E47_Place_Spatial_Coordinates>
199
    </P87_is_identified_by>
200
  </xsl:template>
201

    
202
  <xsl:template name="E69">
203
    <P100i_died_in>
204
      <E69_Death>
205
	<P4_has_time-span>
206
	  <E52_Time-Span>
207
	    <P82_at_some_time_within>
208
	      <E61_Time_Primitive>
209
		<xsl:call-template name="calc-date-value"/>
210
	      </E61_Time_Primitive>
211
	    </P82_at_some_time_within>
212
	  </E52_Time-Span>
213
	</P4_has_time-span>
214
      </E69_Death>
215
    </P100i_died_in>
216
  </xsl:template>
217

    
218
  <xsl:template name="E67">
219
    <P98i_was_born>
220
      <E67_Birth>
221
	<P4_has_time-span>
222
	  <E52_Time-Span>
223
	    <P82_at_some_time_within>
224
	      <E61_Time_Primitive>
225
		<xsl:call-template name="calc-date-value"/>
226
	      </E61_Time_Primitive>
227
	    </P82_at_some_time_within>
228
	  </E52_Time-Span>
229
	</P4_has_time-span>
230
	<P7_took_place_at rdf:resource="{tei:makeID(.)}/{placeName/@key}"/>
231
      </E67_Birth>
232
    </P98i_was_born>
233
  </xsl:template>
234

    
235
  <xsl:template name="E82">
236
    <xsl:choose>
237
      <xsl:when test="parent::person">
238
	<P131_is_identified_by>
239
	  <xsl:copy-of select="@xml:lang"/>
240
	  <E82_Actor_Appellation>
241
	    <rdf:value>
242
	      <xsl:value-of select="normalize-space(.)"/>
243
	    </rdf:value>
244
	  </E82_Actor_Appellation>
245
	</P131_is_identified_by>
246
      </xsl:when>
247
      <xsl:when test="not(@ref)">
248
	<E21_Person><xsl:call-template name="makeID"/>
249
	  <P131_is_identified_by>
250
	    <xsl:copy-of select="@xml:lang"/>
251
	    <E82_Actor_Appellation>
252
	      <rdf:value>
253
		<xsl:value-of select="normalize-space(.)"/>
254
	      </rdf:value>
255
	    </E82_Actor_Appellation>
256
	  </P131_is_identified_by>
257
	</E21_Person>
258
      </xsl:when>
259
      <xsl:when test="generate-id(.) = generate-id(key('persons',@ref)[1])">
260
	<E21_Person><xsl:call-template name="makeID"/>
261
	  <P131_is_identified_by>
262
	    <xsl:copy-of select="@xml:lang"/>
263
	    <E82_Actor_Appellation>
264
	      <rdf:value>
265
		<xsl:value-of select="normalize-space(.)"/>
266
	      </rdf:value>
267
	    </E82_Actor_Appellation>
268
	  </P131_is_identified_by>
269
	</E21_Person>
270
      </xsl:when>
271
    </xsl:choose>
272
  </xsl:template>
273

    
274
  <xsl:template name="E48">
275
    <xsl:choose>
276
      <xsl:when test="parent::place">
277
	<P87_is_identified_by>
278
	  <xsl:copy-of select="@xml:lang"/>
279
	  <E48_Place_Name>
280
	    <rdf:value>
281
	      <xsl:value-of select="normalize-space(.)"/>
282
	    </rdf:value>
283
	  </E48_Place_Name>
284
	</P87_is_identified_by>
285
      </xsl:when>
286
      <xsl:when test=".=''"/>
287
      <xsl:otherwise>
288
	<E53_Place><xsl:call-template name="makeID"/>
289
	  <P87_is_identified_by>
290
	    <xsl:copy-of select="@xml:lang"/>
291
	    <E48_Place_Name>
292
	      <rdf:value>
293
		<xsl:value-of select="normalize-space(.)"/>
294
	      </rdf:value>
295
	    </E48_Place_Name>
296
	  </P87_is_identified_by>
297
	</E53_Place>
298
      </xsl:otherwise>
299
    </xsl:choose>
300
  </xsl:template>
301

    
302
  <xsl:template name="P74">
303
    <P74_has_current_or_former_residence>
304
      <xsl:choose>
305
	<xsl:when test="placeName">
306
	  <xsl:apply-templates/>
307
	</xsl:when>
308
	<xsl:otherwise>
309
	  <E53_Place><xsl:call-template name="makeID"/>
310
	    <P87_is_identified_by>
311
	      <xsl:copy-of select="@xml:lang"/>
312
	      <E53_Place_Name>
313
		<rdf:value>
314
		  <xsl:value-of select="normalize-space(.)"/>
315
		</rdf:value>
316
	      </E53_Place_Name>
317
	    </P87_is_identified_by>
318
	  </E53_Place>
319
	</xsl:otherwise>
320
      </xsl:choose>
321
    </P74_has_current_or_former_residence>
322
  </xsl:template>
323

    
324
  <xsl:template name="makeID">
325
    <xsl:variable name="id">
326
      <xsl:choose>
327
	<xsl:when test="ancestor-or-self::*/@xml:base">
328
	  <xsl:value-of select="ancestor-or-self::*[@xml:base][1]/@xml:base"/>
329
	</xsl:when>
330
	<xsl:otherwise>
331
	  <xsl:text>http://www.example.com/id</xsl:text>
332
	</xsl:otherwise>
333
      </xsl:choose>
334
      <xsl:choose>
335
	<xsl:when test="@ref">
336
	  <xsl:value-of select="@ref"/>
337
	</xsl:when>
338
	<xsl:when test="@xml:id">
339
	  <xsl:value-of select="@xml:id"/>
340
	</xsl:when>
341
	<xsl:otherwise>
342
	  <xsl:text>/</xsl:text>
343
	  <xsl:number level="any"/>
344
	</xsl:otherwise>
345
      </xsl:choose>
346
    </xsl:variable>
347
    <xsl:attribute name="rdf:about">
348
      <xsl:value-of select="$id"/>
349
    </xsl:attribute>
350
  </xsl:template>
351

    
352
  <xsl:template name="calc-date-value">
353
    <rdf:value>
354
      <xsl:choose>
355
        <xsl:when test="@when">
356
          <xsl:value-of select="@when"/>
357
        </xsl:when>
358
        <xsl:when test="@notBefore and @notAfter">
359
          <xsl:value-of select="@notBefore"/>
360
          <xsl:text> to  </xsl:text>
361
          <xsl:value-of select="@notAfter"/>
362
        </xsl:when>
363
        <xsl:when test="@notBefore">
364
          <xsl:value-of select="@notBefore"/>
365
          <xsl:text> to </xsl:text>
366
        </xsl:when>
367
        <xsl:when test="@notAfter">
368
          <xsl:text> to </xsl:text>
369
          <xsl:value-of select="@notAfter"/>
370
        </xsl:when>
371
        <xsl:otherwise>
372
          <xsl:value-of select="normalize-space(.)"/>
373
        </xsl:otherwise>
374
      </xsl:choose>
375
    </rdf:value>
376
  </xsl:template>
377

    
378

    
379
  <xsl:function name="tei:makeID" as="xs:string*">
380
    <xsl:param name="here"/>
381
      <xsl:for-each select="$here">
382
	<xsl:variable name="id">
383
        <xsl:choose>
384
          <xsl:when test="ancestor-or-self::*/@xml:base">
385
            <xsl:value-of select="ancestor-or-self::*[@xml:base][1]/@xml:base"/>
386
          </xsl:when>
387
          <xsl:otherwise>
388
            <xsl:text>http://www.example.com/id</xsl:text>
389
          </xsl:otherwise>
390
        </xsl:choose>
391
        <xsl:choose>
392
	  <xsl:when test="@ref">
393
	    <xsl:value-of select="@ref"/>
394
	  </xsl:when>
395
          <xsl:when test="@xml:id">
396
            <xsl:value-of select="@xml:id"/>
397
          </xsl:when>
398
          <xsl:otherwise>
399
	    <xsl:text>/</xsl:text>
400
            <xsl:number level="any"/>
401
          </xsl:otherwise>
402
        </xsl:choose>
403
    </xsl:variable>
404
      <xsl:value-of select="$id"/>
405
      </xsl:for-each>
406
  </xsl:function>
407

    
408

    
409
</xsl:stylesheet>