Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Problem transforming owl with XSLT

Damian.Nowak at empolis.com Damian.Nowak at empolis.com
Mon Aug 4 01:53:19 PDT 2008


Hi, 

I'm trying to extract the concepts and their comments from an owl ontology. To archive this, I wrote a XSL script which basically looks like this: 

=============
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" exclude-result-prefixes="xs xdt err fn protege xsl rdf rdfs owl" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:err="http://www.w3.org/2005/xqt-errors" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rdf="http://www.w3.org/2000/01/rdf#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#">

	<xsl:strip-space elements="*"/>
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="/">
		<xsl:for-each select="//owl:Class">
			<xsl:if test="current()//rdfs:comment and (current()//rdfs:comment != '')">
				<element>
					<name>
						<!-- This is the problem: select="@rdf:ID" does NOT work -->
						<xsl:value-of select="@*"/>
					</name>
					<comment>
						<xsl:value-of select="rdfs:comment"/>
					</comment>
				</element>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>
=============

The problem is the line where the name of a concept (attribute rdf:ID) is beeing extracted. If I use "<xsl:value-of select="@rdf:ID"/>", it does not work. I tried copy-of, which does not work either. Copy-of="@*" or value-of="@*" DOES work. I have no idea what's the problem. Does anyone have a hint for me? 

I have also extracted a little example for an ontology (but this is just standard owl): 

=============
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="transformator.xsl"?>
<rdf:RDF xmlns:p2="http://www.theseus-processus.org/ontologies/2008/7/"
         xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
         xmlns:temporal="http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl#"
         xmlns:swrla="http://swrl.stanford.edu/ontologies/3.3/swrla.owl#"
         xmlns:dul="http://www.loa-cnr.it/ontologies/DUL.owl#"
         xmlns:swrl="http://www.w3.org/2003/11/swrl#"
         xmlns:owl2="http://www.w3.org/2006/12/owl2#"
         xmlns:swrlx="http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xmlns:p1="http://www.owl-ontologies.com/assert.owl#"
         xmlns:swrlm="http://swrl.stanford.edu/ontologies/built-ins/3.4/swrlm.owl#"
         xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#"
         xmlns:swrlb="http://www.w3.org/2003/11/swrlb#"
         xmlns:abox="http://swrl.stanford.edu/ontologies/built-ins/3.3/abox.owl#"
         xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
         xmlns:sqwrl="http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl#"
         xmlns:tbox="http://swrl.stanford.edu/ontologies/built-ins/3.3/tbox.owl#"
         xmlns="http://www.theseus-processus.org/ontologies/2008/7/Engineering.owl#"
         xml:base="http://www.theseus-processus.org/ontologies/2008/7/Engineering.owl">

  <owl:Ontology rdf:about="">
  </owl:Ontology>
  <owl:Class rdf:ID="ZusammenhaltClass">
    <rdfs:subClassOf>
      <owl:Class rdf:about="#Eigenschaft" />
    </rdfs:subClassOf>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:hasValue>
          <Merkmal rdf:ID="Zusammenhalt">
            <wirdGefordertVonAllgemeinsFunktionsZiel>
              <AllgemeinesFunktionsZiel rdf:ID="ZusammenhaltErzeugen">

                <besitztMerkmal rdf:resource="#Zusammenhalt" />
                <besitztHandlung>
                  <Handlung rdf:ID="erzeugen" />
                </besitztHandlung>
              </AllgemeinesFunktionsZiel>
            </wirdGefordertVonAllgemeinsFunktionsZiel>
          </Merkmal>
        </owl:hasValue>
        <owl:onProperty>
          <owl:FunctionalProperty rdf:ID="modelliertMerkmal" />
        </owl:onProperty>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <owl:Class rdf:ID="AggregatszustandClass">
    <owl:equivalentClass>
      <owl:Class>
        <owl:oneOf rdf:parseType="Collection">
          <AggregatszustandClass rdf:ID="fluessig" />
          <AggregatszustandClass rdf:ID="fest" />
          <AggregatszustandClass rdf:ID="gasfoermig" />
        </owl:oneOf>
      </owl:Class>
    </owl:equivalentClass>
    <rdfs:label xml:lang="en">physical condition</rdfs:label>
    <rdfs:label xml:lang="de">Aggregatzustand</rdfs:label>
    <rdfs:subClassOf>
      <owl:Class rdf:about="#Eigenschaft" />
    </rdfs:subClassOf>
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty>
          <owl:FunctionalProperty rdf:about="#modelliertMerkmal" />
        </owl:onProperty>
        <owl:hasValue>
          <Merkmal rdf:ID="Aggregatzustand" />
        </owl:hasValue>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
   <owl:Class rdf:ID="Korn">
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Gedacht als definierte Klasse, die sich aus Elementen mit geringer Groesse zusammensetzt.</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#Objekt"/>
  </owl:Class>
   <owl:Class rdf:ID="Testobjekt 2">
    <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This is a comment!</rdfs:comment>
    <rdfs:subClassOf rdf:resource="#Objekt"/>
  </owl:Class>  
</rdf:RDF>
=============


I'd be grateful for any hint!

Best regards, 

Damian Nowak

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
empolis GmbH | part of arvato: a Bertelsmann company

An der Autobahn | 33311 Gütersloh

Phone +49 (0) 52 41-80-74476 | Fax +49 (0) 52 41-80-41825

damian.nowak at empolis.com | www.empolis.com

 
Sitz Gütersloh | Amtsgericht Gütersloh HRB 3971
Geschäftsführer: Bernhard Ribbrock, Dr. Stefan Wess
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




More information about the protege-owl mailing list