W3C home > Mailing lists > Public > public-owl-wg@w3.org > November 2007

Re: unnamed datatypes in RDF/XML

From: Jeremy Carroll <jjc@hpl.hp.com>
Date: Tue, 20 Nov 2007 11:51:15 +0000
Message-ID: <4742CA33.5080605@hpl.hp.com>
To: Alan Ruttenberg <alanruttenberg@gmail.com>
CC: Carsten Lutz <clu@tcs.inf.tu-dresden.de>, Michael Smith <msmith@clarkparsia.com>, Uli Sattler <sattler@cs.man.ac.uk>, Sandro Hawke <sandro@w3.org>, Bijan Parsia <bparsia@cs.man.ac.uk>, public-owl-wg <public-owl-wg@w3.org>, ewallace@cme.nist.gov

Alan Ruttenberg wrote:
> Doesn't this just mean we have to be a little more careful where we put 
> the namespace?

No, and yes.

First no:


Consider:

  <owl:Class ID="ActionTime"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:my="http://example.org/myDatatypes" >
     <owl:equivalentClass>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#hasTime"/>
          <owl:someValuesFrom rdf:parseType="Literal">
            <xs:simpleType xmlns:my="http://example.org/myDatatypes" >
             <xs:restriction base="my:precision3">
              <xs:minInclusive value="305.200" />
              <xs:maxInclusive value="310.199" />
             </xs:restriction>
            </xs:simpleType>
          </owl:someValuesFrom>
        </owl:Restriction>
      </owl:equivalentClass>
   </owl:Class>

the second declaration of xmlns:my has no effect, and hence XML 
Canonicalization deteles it, as non-canonical.
i.e. XML Canonicalization rearranges namespace declarations.

When canonicalizing fragments of XML documents, as, for example, with 
rdf:parseType="Literal", it is usual to use exclusive canonicalization, 
which, discards namespaces from the outer context, which are not visibly 
used. For technical reasons, exclusive canonicalization discards all 
namespaces which are not visibly used. The namespace declaration
   xmlns:my="http://example.org/myDatatypes"
is not a visible use.

So no, your proposed fix does not work.

See
http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/#sec-Enveloping
for background motivating the visible use rule.

However, there is a similar fix that would work.

In
http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/#sec-Limitations
they suggest
[[
the XML must be modified so that use of the namespace prefix involved is 
visible, or ...
]]

So, we could have a rule that the definition of the datatype is the XML 
Schema datatype definition, with additional namespace qualified 
attribtues, with local name 'hack'. All these attributes are to be 
discarded before passing the definition to an XML Schema engine.

With this rule then we could have


  <owl:Class ID="ActionTime"
     xmlns:xs="http://www.w3.org/2001/XMLSchema" >
     <owl:equivalentClass>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#hasTime"/>
          <owl:someValuesFrom rdf:parseType="Literal">
            <xs:simpleType xmlns:my="http://example.org/myDatatypes" 

                       my:hack="" >
             <xs:restriction base="my:precision3">
              <xs:minInclusive value="305.200" />
              <xs:maxInclusive value="310.199" />
             </xs:restriction>
            </xs:simpleType>
          </owl:someValuesFrom>
        </owl:Restriction>
      </owl:equivalentClass>
   </owl:Class>

or equivalently

  <owl:Class ID="ActionTime"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:my="http://example.org/myDatatypes" >
     <owl:equivalentClass>
        <owl:Restriction>
          <owl:onProperty rdf:resource="#hasTime"/>
          <owl:someValuesFrom rdf:parseType="Literal">
            <xs:simpleType
                       my:hack="" >
             <xs:restriction base="my:precision3">
              <xs:minInclusive value="305.200" />
              <xs:maxInclusive value="310.199" />
             </xs:restriction>
            </xs:simpleType>
          </owl:someValuesFrom>
        </owl:Restriction>
      </owl:equivalentClass>
   </owl:Class>


where the my:hack attribute acts as a visible use.

(Clearly any attribute name would do! I think it would be helpful to 
have one fixed one, a possible long but descriptive name would be
   "namespace-work-around")

OTOH for an unnamed datatype, maybe its derivation history is 
irrelevant. All datatypes defined with XML Schema, are derived from XML 
Schema built-in types, so the alternative is simply to flatten the 
derivation - with my example precision3 had a pattern, and the derived 
type has a minInclusive and maxInclusive, so maybe

  <xs:simpleType
     xmlns:xs="http://www.w3.org/2001/XMLSchema" >
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="305.200" />
      <xs:maxInclusive value="310.199" />
      <xs:pattern value="[0-9]*.[0-9]{3}" >
        </xs:pattern>
    </xs:restriction>
  </xs:simpleType>

can be used instead of

  <xs:simpleType
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:my="http://example.org/myDatatypes" >
    <xs:restriction base="my:precision3">
      <xs:minInclusive value="305.200" />
      <xs:maxInclusive value="310.199" />
    </xs:restriction>
  </xs:simpleType>

[I don't believe that it is trivial to merge two patterns, if the user 
defined type is derived using a pattern, and then a further pattern is 
used to derive a subtype]

Jeremy
Received on Tuesday, 20 November 2007 11:51:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:27 GMT