Monday, April 16, 2007

XML Schema validation for RDF

pencil icon, that"s clickable to start editing the post

In my last post Excuse me, where do I find the Semantic Web - did I miss a turn back there? I wondered whether it was possible to do XML Schema validation of RDF. Later a found and example of it by Dave Beckett on the page W3C XML Schemas for simple DC in RDF/XML. This most certainly shows that it's possible, but also that it'll either be very lax or has to be very context specific, in this example for Simple Dublic Core (look also at the referenced page Expressing Simple Dublin Core in RDF/XML).

Another funny thing I found through this is that there is a DTD for XML Schema at the W3C website. I'm not sure if this is for any practical use, but David uses it. As a side note the XML Schema for Simple Dublin Core Metadata Element Set 1.1 in RDF/XML (For Information Only) imports both the XML og XML Schema namespaces, and I dislike seeing that. I'm not sure about the validity, but it's weird because if your using XML the processor has to know about the inner workings of XML og else it'll just have to show it as plain text, and the same goes for XML Schema, what's this information worth for the XML Schema Processor (that should know something about XML Schema like for a start the namespace):

<import namespace="http://www.w3.org/XML/1998/namespace" 
        schemaLocation="http://www.w3.org/2001/xml.xsd">
  <annotation>

    <documentation xml:lang="en">
      Get access to the xml: attribute groups for xml:lang
      as declared on various elements below
    </documentation>
  </annotation>
</import>

<import namespace="http://www.w3.org/2000/10/XMLSchema" 
        schemaLocation="http://www.w3.org/2001/XMLSchema.xsd">

  <annotation>
    <documentation xml:lang="en">
      Get access to the XML Schema for 2001-05-02 W3C REC
    </documentation>
  </annotation>
</import>

Okay, after my blood cooled down, I had a look at the schemas and the one for XML is not be wrong at all. As summerized in the page about the "xml:" Namespace and here's a link to the usage of 'xml:lang' in the current XML spec, where it states:

A special attribute named xml:lang may be inserted in documents to specify the language used in the contents and attribute values of any element in an XML document. In valid documents, this attribute, like any other, MUST be declared if it is used.

It can also be read in the first <xs:documentation>: element of the XSD for XML:

   See http://www.w3.org/XML/1998/namespace.html and
   http://www.w3.org/TR/REC-xml for information about this namespace.

    This schema document describes the XML namespace, in a form
    suitable for import by other schema documents.  

    Note that local names in this namespace are intended to be defined
    only by the World Wide Web Consortium or its subgroups.  The
    following names are currently defined in this namespace and should
    not be used with conflicting semantics by any Working Group,
    specification, or document instance:

    base (as an attribute name): denotes an attribute whose value
         provides a URI to be used as the base for interpreting any
         relative URIs in the scope of the element on which it
         appears; its value is inherited.  This name is reserved
         by virtue of its definition in the XML Base specification.

    id   (as an attribute name): denotes an attribute whose value
         should be interpreted as if declared to be of type ID.
         The xml:id specification is not yet a W3C Recommendation,
         but this attribute is included here to facilitate experimentation
         with the mechanisms it proposes.  Note that it is _not_ included
         in the specialAttrs attribute group.

    lang (as an attribute name): denotes an attribute whose value
         is a language code for the natural language of the content of
         any element; its value is inherited.  This name is reserved
         by virtue of its definition in the XML specification.
  
    space (as an attribute name): denotes an attribute whose
         value is a keyword indicating what whitespace processing
         discipline is intended for the content of the element; its
         value is inherited.  This name is reserved by virtue of its
         definition in the XML specification.

    Father (in any context at all): denotes Jon Bosak, the chair of 
         the original XML Working Group.  This name is reserved by 
         the following decision of the W3C XML Plenary and 
         XML Coordination groups:

             In appreciation for his vision, leadership and dedication
             the W3C XML Plenary on this 10th day of February, 2000
             reserves for Jon Bosak in perpetuity the XML name
             xml:Father

And what of an easter egg that came last, the xml:Father for Jon Bosak - I'm curious whether any XML processor supports that :-).

0 comments :