<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<?cocoon-process type="xslt"?>

<!-- Transforming RuleML Sub Elements to RDFS via XSLT     2002-08-19 -->
<!-- Harold Boley    "boley@informatik.uni-kl.de" -->

<!-- What's still missing:
1) Create empty rdfs:Class for root classes (which don't occur in any _sbody):
   Iterate through each _shead and for it again iterate through each _sbody
2) Handle single sub-relation directly, without sor
   (currently singleton <sor><rel>sub-relation</rel></sor> is needed
    instead of just writing  <rel>sub-relation</rel>)
3) Somehow escape spaces, parens, etc. in relation names
   (because these in RDFS become URLs)
 -->

  <!-- process rulebase and position sub transformer -->
  <xsl:template match="/rulebase">
    <rdf:RDF xml:lang="en"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
      <xsl:apply-templates/>
    </rdf:RDF>
  </xsl:template>

  <!-- apply sub transformer to each sub element, creating a
       Class for each _sbody sor's rel element -->
  <xsl:template match="sub">
<xsl:for-each select="_sbody/sor/rel">
  <rdfs:Class xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
             rdf:ID="{.}">
      <rdfs:subClassOf
         rdf:resource="#{../../../_shead/rel}"/>
  </rdfs:Class>
</xsl:for-each>
  </xsl:template>
 
</xsl:stylesheet>

