How to best use XML Schema in DAML+OIL

Hi!

I'm designing an ontology in DAML+OIL (actually DAML-S, but that's not
too important here) for a printer device. I would like some guidance on
how to best use XML Schema datatypes for this.

Here's what I'm doing currently:


Each printer has an implementation of a PrinterProfile class, which
describes a number of serviceParameters.

An example is that I want each printer to be able to describe which
paper sizes it supports. Only certain pre-defined values are allowed,
and it can have several of these. So I've done it like this:

-------------------------------------------------------------
(in printerprofile.daml, i.e. in the PrinterProfile class def):

<daml:Class rdf:ID="PaperSize">
  <rdfs:subClassOf rdf:resource="&profile;#ServiceParameter"/>
  <rdfs:subClassOf>
    <daml:Restriction>
      <daml:onProperty rdf:resource="&profile;#sParameter"/>
      <daml:toClass rdf:resource="&dt;#PaperSizesType"/>
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>


(this refers to xml schema datatypes in printerprofile-dt.xsd):

  <xsd:element name="PaperSizeType">
    <xsd:simpleType>
      <xsd:restriction base="xsd:string">
      	<xsd:enumeration value="A4"/>
      	<xsd:enumeration value="Letter"/>
      	<xsd:enumeration value="A3"/>
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:element>

  <!-- A sequence of one, two or all three of the paper
       sizes defined above -->
<xsd:element name="PaperSizesType">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="PaperSizeElement" 
	           type="#PaperSizeType" 
	           minOccurs="1"
                   maxOccurs="3"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>


(in printer1-profile, which has an implementation of the PrinterProfile
 class):

  <printer:PaperSizesType rdf:ID="Printer1-PaperSize-Data"> 
    <printer:PaperSizeElement>A4</printer:PaperSizeElement>
    <printer:PaperSizeElement>Letter</printer:PaperSizeElement>
  </printer:PaperSizesType>

  <profile:serviceParameter>
    <printer:PaperSize rdf:ID="Printer1-PaperSize">
      <profile:serviceParameterName>
      Printer 1 PaperSize
      </profile:serviceParameterName>
      <profile:sParameter rdf:resource="#Printer1-PaperSize-Data"/>
    </printer:PaperSize>
  </profile:serviceParameter>
-------------------------------------------------------------

The above implementation places a lot of the 'logic' of the datatype in
the XML Schema definition, and uses non-predefined XML Schema datatypes.
The DAML+OIL reference[1] says:

"The question of whether any XML Schema datatype can be used in such
constructions, or whether only certain XML Schema dataypes can be so
used (such as only the predefined datatypes), remains open."

In the above implementation, there will be ONE service parameter with
all the paper sizes. Another way is this:

-------------------------------------------------------------
<daml:Class rdf:ID="PaperSize">
  <rdfs:subClassOf rdf:resource="&profile;#ServiceParameter"/>
  <rdfs:subClassOf>
    <daml:Restriction>
      <daml:onProperty rdf:resource="&profile;#sParameter"/>
<!-- N.B PaperSize, not PaperSizeS! Same PaperSizeType as above-->
      <daml:toClass rdf:resource="&dt;#PaperSizeType"/>      
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>


And then, in printer1-profile.daml:

  <printer:PaperSizeType rdf:ID="Printer1-PaperSize-Data1"> 
    A4
  </printer:PaperSizeType>

  <printer:PaperSizeType rdf:ID="Printer1-PaperSize-Data2"> 
    Letter
  </printer:PaperSizeType>

 <profile:serviceParameter>
    <printer:PaperSize rdf:ID="Printer1-PaperSize1">
      <profile:serviceParameterName>
      Printer 1 PaperSize instance 1
      </profile:serviceParameterName>
      <profile:sParameter rdf:resource="#Printer1-PaperSize-Data2"/>
    </printer:PaperSize>
  </profile:serviceParameter>

 <profile:serviceParameter>
    <printer:PaperSize rdf:ID="Printer1-PaperSize2">
      <profile:serviceParameterName>
      Printer 1 PaperSize instance 2
      </profile:serviceParameterName>
      <profile:sParameter rdf:resource="#Printer1-PaperSize-Data2"/>
    </printer:PaperSize>
  </profile:serviceParameter>
-------------------------------------------------------------

As you can see, this has several service parameters, one for each paper
size, but less 'logic' in the XML Schema description. Which is best, and
under what circumstances?

Regards
Daniel

------------------------------------------------------
[1] http://www.daml.org/2001/03/reference.html

Received on Thursday, 3 April 2003 10:17:58 UTC