1 turid 1.1 <xsl:stylesheet
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
5 xmlns:owl="http://www.w3.org/2002/07/owl#"
6 version="1.0">
7
|
8 turid 1.3 <!-- author dturi $Id: provenance.xsl,v 1.2 2005/10/18 15:20:32 turid Exp $ -->
|
9 turid 1.1
10 <xsl:output method="text"/>
11
12 <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
13 <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
14
|
15 turid 1.3 <xsl:variable name="package">uk.ac.man.cs.img.mygrid.provenance.knowledge.ontology</xsl:variable>
|
16 turid 1.1
17 <xsl:template match="rdf:RDF">
18 <xsl:text>package </xsl:text><xsl:value-of select="$package"/><xsl:text>; </xsl:text>
19 <xsl:text>/** </xsl:text>
20 <xsl:text> * Java constants for classes and predicates in provenance.owl. </xsl:text>
21 <xsl:text> * Automatically generated from provenance.owl using provenance.xsl. </xsl:text>
22 <xsl:text> */ </xsl:text>
23 <xsl:text>public class ProvenanceOntologyConstants { </xsl:text>
24 <xsl:text> </xsl:text>
|
25 turid 1.2 <xsl:text> public static final String NS = "http://www.mygrid.org.uk/provenance#"; </xsl:text>
|
26 turid 1.1 <xsl:text> </xsl:text>
27 <xsl:text>/** </xsl:text>
28 <xsl:text> * Java constants for classes in provenance.owl. </xsl:text>
29 <xsl:text> * Automatically generated from provenance.owl using provenance.xsl. </xsl:text>
30 <xsl:text> */ </xsl:text>
31 <xsl:text> public static class Classes { </xsl:text>
32 <xsl:text> </xsl:text>
33 <xsl:apply-templates select="//owl:Class"/>
34 <xsl:text> } </xsl:text>
35 <xsl:text> </xsl:text>
36 <xsl:text>/** </xsl:text>
37 <xsl:text> * Java constants for object properties in provenance.owl. </xsl:text>
38 <xsl:text> * Automatically generated from provenance.owl using provenance.xsl. </xsl:text>
39 <xsl:text> */ </xsl:text>
40 <xsl:text> public static class ObjectProperties { </xsl:text>
41 <xsl:text> </xsl:text>
42 <xsl:apply-templates select="//owl:ObjectProperty"/>
43 <xsl:text> } </xsl:text>
44 <xsl:text> </xsl:text>
45 <xsl:text>/** </xsl:text>
46 <xsl:text> * Java constants for datatype properties in provenance.owl. </xsl:text>
47 turid 1.1 <xsl:text> * Automatically generated from provenance.owl using provenance.xsl. </xsl:text>
48 <xsl:text> */ </xsl:text>
49 <xsl:text> public static class DatatypeProperties { </xsl:text>
50 <xsl:text> </xsl:text>
51 <xsl:apply-templates select="//owl:DatatypeProperty"/>
52 <xsl:text> } </xsl:text>
53 <xsl:text>}</xsl:text>
54 </xsl:template>
55
56 <xsl:template match="owl:Class">
57 <xsl:call-template name = "provenance_constant"/>
58 </xsl:template>
59
60 <xsl:template match="owl:ObjectProperty">
61 <xsl:call-template name = "provenance_constant"/>
62 </xsl:template>
63
64 <xsl:template match="owl:DatatypeProperty">
65 <xsl:call-template name = "provenance_constant"/>
66 </xsl:template>
67
68 turid 1.1 <xsl:template name="provenance_constant">
69 <xsl:if test="@rdf:ID!=''">
70 <xsl:text> public static final String </xsl:text>
71 <xsl:value-of select="translate(@rdf:ID,$lcletters,$ucletters)"/>
72 <xsl:text> = NS + "</xsl:text><xsl:value-of select="@rdf:ID"/>";
73 <xsl:text> </xsl:text>
74 </xsl:if>
75 </xsl:template>
76
77 </xsl:stylesheet>
|