Re: unnamed datatypes in RDF/XML

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 UTC