/usr/share/dia/xslt/dia-uml2owl.xsl is in dia-common 0.97.2-15ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | <?xml version='1.0'?><!-- -*- mode: indented-text;-*- -->
<xsl:transform
xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:r ="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:s ="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dia ="http://www.lysator.liu.se/~alla/dia/"
xmlns:owl ="http://www.w3.org/2002/07/owl@@#"
>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>dia2owl -- convert UML diagram from dia to OWL</p>
<p>cf <a href="http://www.swi.psy.uva.nl/usr/Schreiber/docs/owl-uml/owl-uml.html">A UML Presentation Syntax for OWL Lite</a>
Author: Guus Schreiber
Created:: April 3, 2002
Last update: April 19, 2002
</p>
<address>Dan Connolly <br class=""/>
$Id$</address>
<p>see log at end</p>
<p>Share and Enjoy.
Copyright (c) 2001 W3C (MIT, INRIA, Keio)
<a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">Open Source license</a>
</p>
</div>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<r:RDF>
<xsl:apply-templates/>
</r:RDF>
</xsl:template>
<xsl:template match='dia:object[@type="UML - Class"]'>
<xsl:variable name="id" select='@id'/>
<!-- hm... dia seems to have odd string quoting -->
<xsl:variable name="label" select='substring-before(substring-after(dia:attribute[@name="name"]/dia:string, "#"), "#")'/>
<xsl:message>@@found UML Class: <xsl:value-of select='$label'/></xsl:message>
<s:Class r:ID='{$id}'>
<s:label><xsl:value-of select='$label'/></s:label>
</s:Class>
</xsl:template>
<xsl:template match='dia:object[@type="UML - Generalization"]'>
<xsl:variable name="subjID"
select='dia:connections/dia:connection[@handle="1"]/@to'/>
<xsl:variable name="objID"
select='dia:connections/dia:connection[@handle="0"]/@to'/>
<xsl:message>@@found UML Generalization:
<xsl:value-of select='$subjID'/>
<xsl:value-of select='$objID'/>
</xsl:message>
<r:Description r:about='{concat("#", $subjID)}'>
<s:subClassOf r:resource='{concat("#", $objID)}'/>
</r:Description>
</xsl:template>
<xsl:template match='dia:object[@type="UML - Association"]'>
<xsl:variable name="id" select='@id'/>
<xsl:variable name="label" select='substring-before(substring-after(dia:attribute[@name="name"]/dia:string, "#"), "#")'/>
<xsl:variable name="domainID"
select='dia:connections/dia:connection[@handle="1"]/@to'/>
<xsl:variable name="rangeID"
select='dia:connections/dia:connection[@handle="0"]/@to'/>
<!-- these include the funky #string quotes# -->
<xsl:variable name="domainMult"
select='dia:attribute[@name="ends"]/dia:composite[1]/
dia:attribute[@name="multiplicity"]/dia:string'/>
<xsl:variable name="rangeMult"
select='dia:attribute[@name="ends"]/dia:composite[2]/
dia:attribute[@name="multiplicity"]/dia:string'/>
<xsl:message>@@found UML Association: <xsl:value-of select='$label'/>
</xsl:message>
<r:Property r:ID='{$id}'>
<s:label><xsl:value-of select='$label'/></s:label>
<s:domain r:resource='{concat("#", $domainID)}'/>
<s:range r:resource='{concat("#", $rangeID)}'/>
</r:Property>
<xsl:if test='$rangeMult = "#1..*#"'>
<r:Description r:about='{concat("#", $domainID)}'>
<owl:hasAtLeastOne r:resource='{concat("#", $id)}'/>
</r:Description>
</xsl:if>
<!-- @@ more cardinality stuff? -->
</xsl:template>
<!-- don't pass text thru -->
<xsl:template match="text()|@*">
</xsl:template>
<!--
$Log$
Revision 1.1 2003/12/04 07:38:34 lclausen
Doc install fix, new XSLT
Revision 1.2 2002/07/11 08:01:46 connolly
got the objProp case working
Revision 1.1 2002/07/11 07:25:28 connolly
got 1st test case working
-->
</xsl:transform>
|