An XML ``presentation'' syntax for OWL

[Resent for archival purposes, for some reason not stored in the mail
archive]

-------- Original Message --------
Subject: An XML ``presentation'' syntax for OWL
Resent-Date: Tue, 28 May 2002 13:42:59 -0400 (EDT)
Resent-From: www-webont-wg@w3.org
Date: Tue, 28 May 2002 13:39:30 -0400
From: "Peter F. Patel-Schneider" <pfps@research.bell-labs.com>
To: www-webont-wg@w3.org

----Next_Part(Tue_May_28_13:39:27_2002_593)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I put together an XML Schema that closely corresponds to the abstract
syntax in the OWL Feature Specification document.  This is my first
significant XML Schema, so there may be better ways of doing some of the
things there.  Also enclosed is a simple, nonsensical document using the
Schema.

Comments are welcome.

peter


----Next_Part(Tue_May_28_13:39:27_2002_593)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="schema.xsd"

<!--		XML Schema for OWL
		Peter F. Patel-Schneider, Bell Labs Research

This is an XML Schema for an XML syntax for OWL.  The XML syntax has
been
chosen to also be valid RDF/XML.  I have included some comments in-line,
to
show what is going on.  
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns"
    xmlns:owl="http://www.owl.org/owl"
    xmlns:owlrdf="http:rdf.xsd"
    targetNamespace="http://www.owl.org/owl"
    elementFormDefault="qualified"
    attributeFormDefault="qualified"
>


<!-- First, some other names for xsd:QName, just to keep straight what
the
     QName is used for. -->

 <xsd:simpleType name="datatypeID">
  <xsd:restriction base="xsd:QName" />
 </xsd:simpleType>

 <xsd:simpleType name="classID">
  <xsd:restriction base="xsd:QName" />
 </xsd:simpleType>

 <xsd:simpleType name="individualID">
  <xsd:restriction base="xsd:QName" />
 </xsd:simpleType>

 <xsd:simpleType name="dataPropertyID">
  <xsd:restriction base="xsd:QName" />
 </xsd:simpleType>

 <xsd:simpleType name="individualPropertyID">
  <xsd:restriction base="xsd:QName" />
 </xsd:simpleType>

<!-- Next, a few types that are used to reference named things. -->

 <xsd:complexType name="Class">
  <!-- This is what is wanted, where owlrdf defines ID appropriately
	  <xsd:attribute ref="owlrdf:ID" use="required"/>
       This does't seem to work in Topologi so we'll have to use owl:ID.
       The other uses of ID and resource should be treated similarly.
  -->
  <xsd:attribute name="ID" type="owl:classID" use="required" />
 </xsd:complexType>

 <xsd:complexType name="Datatype">
  <xsd:attribute name="ID" type="owl:datatypeID" use="required" />
 </xsd:complexType>

 <xsd:complexType name="ClassReference">
  <xsd:attribute name="resource" type="owl:classID" use="required" />
 </xsd:complexType>

 <xsd:complexType name="PropertyReference">
  <xsd:attribute name="resource" type="xsd:QName" use="required" />
 </xsd:complexType>

 <xsd:complexType name="DataPropertyReference">
  <xsd:attribute name="resource" type="owl:dataPropertyID"
use="required" />
 </xsd:complexType>

 <xsd:complexType name="IndividualPropertyReference">
  <xsd:attribute name="resource" type="owl:individualPropertyID" 
		 use="required" />
 </xsd:complexType>

 <xsd:complexType name="IndividualReference">
  <xsd:sequence>
   <xsd:element name="Individual" type="owl:Fact" 
		minOccurs="0" maxOccurs="1" />
  </xsd:sequence>
  <xsd:attribute name="resource" type="owl:individualID" />
 </xsd:complexType>



<!-- Now for the main stuff. 

     2. A owl document contains an ontology, which has includes,
     axioms, and statements.
-->

 <xsd:element name="ontology" type="owl:OntologyType" />  <!-- Top Level
-->

 <xsd:complexType name="OntologyType">
   <xsd:sequence minOccurs="0" maxOccurs="unbounded">
    <xsd:choice>

     <xsd:element name="Include" type="owl:IncludeType" />

     <xsd:element name="EquivalentClass" type="owl:ClassAxiom" />
     <xsd:element name="SubClass" type="owl:ClassAxiom" />
     <xsd:element name="EnumeratedClass" type="owl:Enumeration" />
     <xsd:element name="DisjointClasses" type="owl:Descriptions" />
     <xsd:element name="EquivalentClasses" type="owl:Descriptions" />
     <xsd:element name="SubClassOf" type="owl:SubClassOfType" />

     <xsd:element name="DataProperty" type="owl:DataPropertyAxiom" />
     <xsd:element name="IndividualProperty"
type="owl:IndividualPropertyAxiom" />
<!-- The restrictions on what properties can be equivalent to and sub of
     others are context-sensitive and cannot be expressed in XML Schema
     so this lets any property in -->
     <xsd:element name="EquivalentProperties" type="owl:Properties" />
     <xsd:element name="SubPropertyOf" type="owl:SubPropertyOfType" />
 
     <xsd:element name="Individual" type="owl:Fact" />
     <xsd:element name="SameIndividual" type="owl:Individuals" />
     <xsd:element name="DifferentIndividuals" type="owl:Individuals" />
 
    </xsd:choice>
   </xsd:sequence>
   <xsd:attribute name="ID" type="xsd:QName" />
   <!--  ... DC attributes ... -->
  </xsd:complexType>

<xsd:complexType name="IncludeType">
 <xsd:attribute name="ontology" type="xsd:anyURI" use="required"/>
</xsd:complexType>


<!-- 3.1 The body of a class axiom is a sequence of superclasses,
     followed by property restrictions, and finally some general
     descriptions. --> 

 <xsd:complexType name="ClassAxiom">	<!-- RDF description -->
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">   
   <xsd:choice>
    <xsd:element name="super"	    type="owl:ClassReference" />
    <xsd:element name="restriction" type="owl:RestrictionType" />
    <xsd:element name="description" type="owl:DescriptionType" />
   </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name="name" type="xsd:QName" use="required" />
 </xsd:complexType>

<!-- An enumeration is just a sequence of individuals,
     suitably encapsulated. -->

 <xsd:complexType name="Enumeration">	<!-- RDF description -->
  <xsd:sequence>
   <xsd:element name="member" type="owl:IndividualReference"
	        minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>
  <xsd:attribute name="name" type="xsd:QName" use="required" />
 </xsd:complexType>

<!-- A subclassOf statement is just two descriptions, sub and super. -->

 <xsd:complexType name="SubClassOfType">	<!-- RDF description -->
  <xsd:all>
   <xsd:element name="sub" type="owl:DescriptionType"
	 	minOccurs="1" maxOccurs="1" />
   <xsd:element name="super" type="owl:DescriptionType"
	 	minOccurs="1" maxOccurs="1" />
  </xsd:all>
 </xsd:complexType>


<!-- 3.2 Property axioms contain supers, domains, and ranges, along
     with characteristics of the property. -->

 <xsd:complexType name="DataPropertyAxiom">	<!-- RDF description -->
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
   <xsd:choice>
    <xsd:element name="super"  type="owl:DataPropertyReference" />
    <xsd:element name="domain" type="owl:DescriptionType" />
    <xsd:element name="range"  type="owl:DataRange" />
   </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name="name" type="xsd:QName" use="required" />
  <xsd:attribute name="functional" type="xsd:boolean" />
 </xsd:complexType>

 <xsd:complexType name="IndividualPropertyAxiom"> <!-- RDF description
-->
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
   <xsd:choice>
    <xsd:element name="super"  type="owl:IndividualPropertyReference" />
    <xsd:element name="domain" type="owl:DescriptionType" />
    <xsd:element name="range"  type="owl:DescriptionType" />
   </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name="name" type="xsd:QName" use="required" />
  <xsd:attribute name="inverseOf" type="owl:individualPropertyID" />
  <xsd:attribute name="symmetric"         type="xsd:boolean" />
  <xsd:attribute name="functional"	  type="xsd:boolean" />
  <xsd:attribute name="inverseFunctional" type="xsd:boolean" />
  <xsd:attribute name="oneToOne"	  type="xsd:boolean" />
  <xsd:attribute name="transitive"	  type="xsd:boolean"/>
 </xsd:complexType>

<!-- Datatypes and sets of values can show up in data property ranges.
-->

 <xsd:complexType name="DataRange">		<!-- RDF property -->
  <xsd:choice>
   <xsd:element name="DataType" type="owl:Datatype"
		minOccurs="1" maxOccurs="1" />
   <xsd:element name="OneOf" type="owl:Datavalues"
		minOccurs="1" maxOccurs="1" />
  </xsd:choice>
 </xsd:complexType>

 <xsd:complexType name="Datavalues">		<!-- RDF description -->
  <xsd:sequence>
   <xsd:element name="member" type="xsd:anySimpleType"
	        minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>
 </xsd:complexType>

<!-- EquivalentProperties takes several propertyIDs, 
     all of the same variety (not expressed here) . -->

 <xsd:complexType name="Properties">		<!-- RDF description -->
  <xsd:sequence>
   <xsd:element name="property" type="owl:PropertyReference"
		minOccurs="1" maxOccurs="unbounded" />
  </xsd:sequence>
 </xsd:complexType>

<!-- A subproperty statement is just two propertyIDs, sub and super,
with
     the following restrictions (not expressed here)
     if sub is a data property then super must be a data property
     if sub is a simple property then super must be an individual
property.
     There are other restrictions having to do with transitivity and
     cardinalites. 
-->

 <xsd:complexType name="SubPropertyOfType">	<!-- RDF description -->
  <xsd:all>
   <xsd:element name="sub" type="xsd:PropertyReference"
	 	minOccurs="1" maxOccurs="1" />
   <xsd:element name="super" type="xsd:PropertyReference"
	 	minOccurs="1" maxOccurs="1" />
  </xsd:all>
 </xsd:complexType>

<!-- 3.3 A property restriction is either on a data property, or on an
	 individual property. --> 

 <xsd:complexType name="RestrictionType">	<!-- RDF property -->
  <xsd:choice>
    <xsd:element name="DataRestriction" type="owl:DataRestrictionType"
		 minOccurs="1" maxOccurs="1" />
    <xsd:element name="IndividualRestriction" 
		 type="owl:IndividualRestrictionType"
		 minOccurs="1" maxOccurs="1" />
  </xsd:choice>
 </xsd:complexType>

<!-- All types of restrictions have the property name as an attribute,
an
     optional cardinality, zero or more ranges, zero or more required
     restrictions, and zero or more value restrictions. 
     There is a side condition that restrictions on transitive
properties
     and their sub-properties cannot have cardinality constraints.
-->  

 <xsd:complexType name="DataRestrictionType">	<!-- RDF descr. -->
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
  <xsd:choice>
   <xsd:element name="range"    type="owl:DataRange" />
   <xsd:element name="required" type="owl:DataRange" />
   <xsd:element name="value"	type="xsd:anySimpleType" />
  </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name="property" type="owl:dataPropertyID"
use="required" />
  <xsd:attribute name="atleast"  type="xsd:positiveInteger" />
  <xsd:attribute name="atmost"   type="xsd:nonNegativeInteger" />
  <xsd:attribute name="exactly"  type="xsd:nonNegativeInteger" />
 </xsd:complexType>

 <xsd:complexType name="IndividualRestrictionType">	<!-- RDF desc. -->
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
  <xsd:choice>
   <xsd:element name="range"    type="owl:DescriptionType" />
   <xsd:element name="required" type="owl:DescriptionType" />
   <xsd:element name="value"	type="owl:IndividualReference" />
  </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name="property" type="owl:individualPropertyID"
use="required" />
  <xsd:attribute name="atleast"  type="xsd:positiveInteger" />
  <xsd:attribute name="atmost"   type="xsd:nonNegativeInteger" />
  <xsd:attribute name="exactly"  type="xsd:nonNegativeInteger" />
 </xsd:complexType>


<!-- 3.4 - Descriptions are either named classes, property restrictions,
     sets, or boolean combinations of descriptions. -->

 <xsd:complexType name="DescriptionType">	<!-- RDF property -->
  <xsd:choice>
   <xsd:element name="Class" type="owl:Class"
		minOccurs="1" maxOccurs="1" />
   <xsd:element name="DataRestriction" type="owl:DataRestrictionType"
	        minOccurs="1" maxOccurs="1" />
   <xsd:element name="IndividualRestriction"
type="owl:IndividualRestrictionType"
	        minOccurs="1" maxOccurs="1" />
   <xsd:element name="OneOf" type="owl:IndividualReferences"
		minOccurs="1" maxOccurs="1" />
   <xsd:element name="And" type="owl:Descriptions"
		minOccurs="1" maxOccurs="1" />
   <xsd:element name="Or" type="owl:Descriptions"
		minOccurs="1" maxOccurs="1" />
   <xsd:element name="Not" type="owl:SingleDescription"
		minOccurs="1" maxOccurs="1" />
  </xsd:choice>
 </xsd:complexType>

 <xsd:complexType name="IndividualReferences">	<!-- RDF description -->
  <xsd:sequence>
   <xsd:element name="member" type="owl:IndividualReference"
	        minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="Descriptions">	<!-- RDF description -->
  <xsd:sequence minOccurs="1" maxOccurs="unbounded">
   <xsd:choice>
    <xsd:element name="class" type="owl:ClassReference" />
    <xsd:element name="description" type="owl:DescriptionType" />
   </xsd:choice>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="SingleDescription">	<!-- RDF description -->
  <xsd:choice>
   <xsd:element name="class" type="owl:Class" 
		minOccurs="1" maxOccurs="1" />
   <xsd:element name="description" type="owl:DescriptionType"
		minOccurs="1" maxOccurs="1" />
  </xsd:choice>
 </xsd:complexType>



<!-- 4. Facts about individuals have several types and property
	information, including nested facts.  NB: Although this is RDF
	syntax, it is not in the usual RDF manner. -->

 <xsd:complexType name="Fact">			<!-- RDF description -->
  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
   <xsd:choice>
    <xsd:element name="type" type="owl:ClassReference" />
    <xsd:element name="property" type="owl:PropertyValue" />
   </xsd:choice>
  </xsd:sequence>
  <xsd:attribute name="name" type="xsd:QName" />
 </xsd:complexType>

 <xsd:complexType name="PropertyValue">		<!-- RDF property -->
  <xsd:choice>
   <xsd:element name="IndividualPropertyValue" 
		type="owl:IndividualPropertyValueType" />
   <xsd:element name="DataPropertyValue" 
		type="owl:DataPropertyValueType" />
  </xsd:choice>
 </xsd:complexType>

 <xsd:complexType name="IndividualPropertyValueType"> <!-- RDF descr.
-->
  <xsd:sequence>
   <xsd:element name="individual" type="owl:IndividualReference" />
  </xsd:sequence>
  <xsd:attribute name="property" type="owl:individualPropertyID"
		 use="required" />
 </xsd:complexType>

 <xsd:complexType name="DataPropertyValueType">	<!-- RDF description -->
  <xsd:sequence>
   <xsd:element name="value" type="xsd:anySimpleType" />
  </xsd:sequence>
  <xsd:attribute name="property" type="owl:dataPropertyID"
		 use="required" />
 </xsd:complexType>

<!-- Individual equality and disequality take a sequence of individuals
-->

 <xsd:complexType name="Individuals">		<!-- RDF description -->
  <xsd:sequence minOccurs="1" maxOccurs="unbounded">
   <xsd:element name="individual" type="owl:IndividualReference" />
  </xsd:sequence>
 </xsd:complexType>

</xsd:schema>

----Next_Part(Tue_May_28_13:39:27_2002_593)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="schema-example.text"

<!--		Examples of OWL XML Syntax -->

<owl:ontology xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns"
	      xmlns:owl="http://www.owl.org/owl">

<!-- Syntax					Comments	    Why -->
<owl:EquivalentClass owl:name="Student">	<!-- Good -->
 <owl:super owl:resource="Person" />		<!-- OK - resource questionable
-->
 <owl:super owl:resource="Thing" />		<!-- OK - resource questionable -->
 <owl:restriction>				<!-- Unnecessary    STRIPING,SCHEMA -->
  <owl:IndividualRestriction owl:property="child" 
			 owl:atmost="1">        <!-- Good -->
   <owl:range>					<!-- range="Person" ? -->
    <owl:Class owl:ID="Person" />		<!-- ""		    SCHEMA -->
   </owl:range>					<!-- "" -->
  </owl:IndividualRestriction>			<!-- OK -->
 </owl:restriction>				<!-- Unnecessary    STRIPING,SCHEMA -->
 <owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
  <owl:IndividualRestriction owl:property="advisor"	
			 owl:atleast="1">	<!-- Good -->
   <owl:range>					<!-- range="Person" ? -->
    <owl:Class owl:ID="Person" />		<!-- ""		    SCHEMA -->
   </owl:range>					<!-- "" -->
   <owl:required>					<!-- <required class="Person" /> ? -->
    <owl:Class owl:ID="Person" />		<!-- ""	     	    SCHEMA -->
   </owl:required>				<!-- ""		 -->
  </owl:IndividualRestriction>			<!-- OK -->
 </owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
 <owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
  <owl:DataRestriction owl:property="studentID"	
			owl:exactly="1">	<!-- Good -->
   <owl:range>					<!-- range="xsd:integer" ? -->
    <owl:DataType owl:ID="xsd:integer" />	<!-- ""		    SCHEMA -->
   </owl:range>					<!-- "" -->
  </owl:DataRestriction>			<!-- OK -->
 </owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
 <owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
  <owl:Or>					<!-- Good -->
   <owl:class owl:resource="Foo" />		<!-- OK - resource questionable -->
   <owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
    <owl:IndividualRestriction owl:property="year"	
			   owl:exactly="1">	<!-- Good -->
     <owl:range>				<!-- OK -->
      <owl:OneOf>				<!-- Good -->
       <owl:member owl:resource="Freshman" />	<!-- OK - resource
questionable -->
       <owl:member owl:resource="Sophomore" />	<!-- OK - resource
questionable -->
       <owl:member owl:resource="Junior" />	<!-- OK - resource
questionable -->
       <owl:member owl:resource="Senior" />	<!-- OK - resource
questionable -->
      </owl:OneOf>				<!-- OK -->
     </owl:range>				<!-- OK -->
    </owl:IndividualRestriction>			<!-- OK -->
   </owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
   <owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
    <owl:DataRestriction owl:property="grade"
			 owl:exactly="1">	<!-- Good -->
     <owl:range>				<!-- OK -->
      <owl:OneOf>				<!-- OK -->
       <owl:member xsi:type="xsd:integer">1</owl:member>
       <owl:member xsi:type="xsd:integer">2</owl:member>
       <owl:member xsi:type="xsd:integer">3</owl:member>
       <owl:member xsi:type="xsd:integer">4</owl:member>
      </owl:OneOf>				<!-- OK -->
     </owl:range>				<!-- OK -->
    </owl:DataRestriction>			<!-- OK -->
   </owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
  </owl:Or>					<!-- OK -->
 </owl:description>				<!-- Unnecessary    STRIPING,SCHEMA -->
</owl:EquivalentClass>				<!-- OK -->

<owl:IndividualProperty owl:name="foo" owl:inverseOf="oof" 
				       owl:functional="true">
 <owl:super owl:resource="bar" />
 <owl:range>
  <owl:Class owl:ID="Person" />
 </owl:range>
 <owl:domain>
  <owl:And>
   <owl:class owl:resource="Person" />
   <owl:class owl:resource="Employee" />
  </owl:And>
 </owl:domain>
</owl:IndividualProperty>

<owl:IndividualProperty owl:name="trans" owl:inverseOf="snrat" 
						owl:transitive="true">
 <owl:super owl:resource="p2" />
 <owl:super owl:resource="p3" />
</owl:IndividualProperty>

<owl:EnumeratedClass owl:name="CSProfessors">	<!-- Good -->
 <owl:member owl:resource="ProfessorFoo" />	<!-- OK - resource
questionable -->
 <owl:member owl:resource="ProfessorFoo" />	<!-- OK - resource
questionable -->
</owl:EnumeratedClass>				<!-- OK -->

<!-- RDF-compatible XML-Schema compatible -->

<owl:Individual owl:name="John">		<!-- Good -->
 <owl:type owl:resource="Person" />		<!-- OK - resource questionable -->
 <owl:property>					<!-- Unnecessary    STRIPING -->
  <owl:IndividualPropertyValue owl:property="child">	<!-- Good -->
   <owl:individual owl:resource="Susan" />	<!-- individual="Susan" ? -->
  </owl:IndividualPropertyValue>		<!-- OK -->
 </owl:property>				<!-- Unnecessary    STRIPING -->
 <owl:property>					<!-- Unnecessary    STRIPING -->
  <owl:IndividualPropertyValue owl:property="child">	<!-- Good -->
   <owl:individual>				<!-- Unnecessary    STRIPING -->
    <owl:Individual>				<!-- OK -->
     <owl:type owl:resource="Person" />		<!-- OK - resource questionable
-->
    </owl:Individual>				<!-- OK -->
   </owl:individual>				<!-- Unnecessary    STRIPING -->
  </owl:IndividualPropertyValue>		<!-- OK -->
 </owl:property>				<!-- Unnecessary    STRIPING -->
</owl:Individual>				<!-- OK -->



<!-- XML-Schema compatible, but not this schema, and not RDF-compatible
	<owl:Individual owl:name="John" owl:type="Person">
	 <owl:property owl:property="child" owl:individual="Susan" />
	</owl:Individual>
 -->

<!-- regular RDF, not XML-Schema compatible
	<Person owl:ID="John">
	 <child>
	  <Person owl:ID="Susan" />
	 </owl:child>
	</owl:Person>
-->

</owl:ontology>

----Next_Part(Tue_May_28_13:39:27_2002_593)----

Received on Thursday, 30 May 2002 09:59:17 UTC