W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > August 2002

Re: Using XMLSchema-instance attributes in RDF/XML Syntax (fwd)

From: Thomas G. Habing <thabing@uiuc.edu>
Date: Tue, 27 Aug 2002 17:32:28 -0500
Message-ID: <3D6BFDFC.1D42AE10@uiuc.edu>
To: Patrick.Stickler@nokia.com
CC: danbri@w3.org, w3c-rdfcore-wg@w3.org

Hi Patrick,

If I understand inlined datatype elements correctly, I think it could (with
some minor? changes) be a suitable representation, at least for the simple
XML Schema types.

Looking at one of the examples from your referenced note:

<rdf:Description rdf:about="#Jenny" xml:lang="en">
  <ex:age><xsd:integer>10</xsd:integer></ex:age>
</rdf:Description>

I assume that xsd is mapped to the http://www.w3.org/2001/XMLSchema
namespace.  Unfortunately, the XML Schema schema does not define an element
xsd:integer, only a simple type xsd:integer, meaning that you cannot just
feed the above example to a validator to check whether 10 is indeed an
integer or not.  I suppose you could do some preprocessing to turn the above
into something that would be palatable to a validator, such as

<rdf:Description rdf:about="#Jenny" xml:lang="en">
  <ex:age xsi:type="xsd:integer">10</ex:age>
</rdf:Description>

which, of course, begs the whole questions.  Anyway, assuming that you do
not want to allow the use of xsi:type, but want to stick with the inline
approach (which I do like), you could instead of using
<xsd:integer>10</xsd:integer> use something like
<xdt:integer>10</xdt:integer> where xdt (my suggested URI is
http://www.w3.org/2001/XMLSchema-instance-datatypes) is a new namespace
which defines elements which correspond to the simple, built-in datatypes of
XML schema.  Thus, for every simple, builtin XML Schema datatype, you now
have a standard element which can be used in instance documents to represent
that type. A complete (and XML Schema validatable) example to illustrate:

INSTANCE DOCUMENT:

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:ex="http://somewhere.edu/something/"
  xmlns:xdt="http://www.w3.org/2001/XMLSchema-instance-datatypes#"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.w3.org/2001/XMLSchema-instance-datatypes
                      xml-instance-types.xsd">
  <rdf:Description rdf:about="#Jenny" xml:lang="en">
    <ex:age><xdt:integer>10</xdt:integer></ex:age>
  </rdf:Description>   
</rdf:RDF>


XML SCHEMA for xdt:

<xsd:schema
  targetNamespace="http://www.w3.org/2001/XMLSchema-instance-datatypes"
  xmlns:xdt="http://www.w3.org/2001/XMLSchema-instance-datatypes#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	
  <xsd:element name="integer" type="xsd:integer"/>
  <xsd:element name="string" type="xsd:string"/>
  <xsd:element name="dateTime" type="xsd:dateTime"/>
  <!--...-->

</xsd:schema>

I suppose this approach could be extended to allow XML Schema Validation for
nearly any derived or even complex types.  However, even so, I still contend
that the xsi namespace should be ignored by RDF for this technique to be
used to its fullest.  According to current specs, even the
xsi:schemaLocation attribute in the rdf:RDF element would cause an RDF
parser to complain.

Kind regards,
	Tom


Patrick.Stickler@nokia.com wrote:
> 
> Thomas,
> 
> Could you please have a look at
> 
> http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2002Aug/0187.html
> 
> Would the use of inlined datatype elements be a suitable representation
> for validating datatyped literals with an XML Schema validator?
> 
> Thanks,
> 
> Patrick
> 
> > -----Original Message-----
> > From: ext Thomas G. Habing [mailto:thabing@uiuc.edu]
> > Sent: 21 August, 2002 20:51
> > To: Stickler Patrick (NRC/Tampere)
> > Cc: ext Dan Brickley; w3c-rdfcore-wg@w3.org
> > Subject: Re: Using XMLSchema-instance attributes in RDF/XML
> > Syntax (fwd)
> >
> >
> > Hi Patrick,
> >
> > I appreciate the reply, even if it isn't what I wanted to
> > hear :-)  If I
> > understand correctly, you are saying that, for various
> > reasons, it is not
> > appropriate to ever expect to be able to validate an RDF/XML
> > instance using
> > XML Schema (except possibly through some non-standard means such as
> > transforming some hybrid RDF/XML into different forms
> > depending on whether
> > RDF or XML Schema processing is desired).  This seems
> > unfortunate since my
> > vision of the two is complimentary instead of competing.
> >
> > I can appreciate the desire to unify RDF and XML Schema, but
> > I would suggest
> > that at least for the short term that the unification can be
> > very modest --
> > something akin to my original suggestion :-) or some variation such as
> > http://lists.w3.org/Archives/Public/www-rdf-interest/2002Aug/0
> > 124.html.
> > Then at least it will be possible to create a valid RDF/XML
> > that can be
> > validated with XML Schema.  If the grand unification of RDF
> > and XML Schema
> > is closer than I think it is, that would be great and you can
> > skip this
> > short term step, but I suspect it will be a while before I see an RDF
> > datatyping spec which unifies the two, much less widely supported,
> > non-experimental tools that support everything that XML
> > Schema currently
> > supports, such as regular expressions patterns, unions of datatypes,
> > extension and restriction of datatypes based on facets, etc.
> > (I just now
> > scanned some of the OWL specs, and they look promising, but I
> > am sticking to
> > my current convictions for the moment :-)
> >
> > I have also interspersed some additional comments below.
> >
> > Respectfully submitted,
> >       Tom Habing
> >
> > Patrick Stickler wrote:
> > >
> > > Thanks for the pointer Dan. I was about to reply
> > > directly to Thomas on this.
> > >
> > > I can very much appreciate the utility that would be
> > > afforded XML Schema users in being able to express
> > > local datatyping using xsi:type, but there remain several
> > > questions about its use that have not been clarified:
> > >
> > > 1. Must the datatype identified by xsi:type conform to
> > > the XML Schema specification? Some preliminary
> > > research I've done to determine this shows a strong
> > > perception that this is true. Yet RDF datatyping should
> > > work equally well for any arbitrary datatype which
> > > conforms to the minimal characteristics defined by
> > > RDF, including but not limited to  XML Schema datatypes.
> >
> > My answer to this is, of course xsi:type should conform to
> > the XML Schema
> > specification; that's the whole point.  Why can't RDF
> > datatyping and XML
> > Schema datatyping coexist?
> >
> > > 2. Will the XML Schema WG/community have a problem
> > > with RDF adopting xsi:type as a key term in its own
> > > vocabulary if that  means extending
> > > or interpreting its semantics to apply to datatypes not
> > > bound by the XML Schema specs. I suspect not.
> >
> > Because I want to see RDF and XML Schema peacefully coexists,
> > I disagree.
> > Based on the above, the whole purpose of xsi:type is to
> > indicate that some
> > part of a document should conform to some type defined in an
> > XML Schema.
> > Therefore, I believe this is the only way that xsi:type should ever be
> > used.  RDF should never use xsi:type (except to ignore it)
> > unless it can
> > also be used in the way expected by XML Schema.
> >
> > >
> > > 3. Is introducing this co-dependency between the two
> > > standards absolutely necessary? One could easily
> > > construct a generic tool that incorporates an XML
> > > Schema validator and which validates typed literals
> > > in RDF/XML instances without parsing the RDF/XML
> > > into a graph.
> >
> > This may just be semantics, but I wouldn't necessarily call
> > what I suggested
> > creating a co-dependency between RDF and XML Schema.  It is more like
> > defining a dividing line between RDF and XML Schema --
> > simply, any attribute
> > in the XML Schema Instance (xsi) namespace is within the sole
> > purview of XML
> > Schema, and RDF processors should keep their hands off.  Note, I am
> > referring only to the XML Schema _Instance_ namespace, not
> > the XML Schema
> > namespace (xsd).  I like the idea of using things like <xsd:Integer
> > rdf:value='1234'/> and having that interpreted as valid RDF.
> >
> > >
> > > Given the other aspects of RDF validation, as well as
> > > those of upper layers such as OWL, I expect that in the
> > > long term, validation will be performed on the graph,
> > > not on the XML, and so any utility derived from adopting
> > > xsi:type would be limited and short lived.
> >
> > Even so, why can't we have both, if desired, especially for
> > the short term?
> >
> > >
> > > While I'm very sympathetic to easy validation of RDF/XML
> > > containing XML Schema datatyped literals, I don't think
> > > it is advisable to employ xsi:type, for the reasons outlined
> > > above.
> > >
> > > Cheers,
> > >
> > > Patrick
> > >
> > > _____________Original message ____________
> > > Subject:        Using XMLSchema-instance attributes in
> > RDF/XML Syntax (fwd)
> > > Sender: ext Dan Brickley <danbri@w3.org>
> > > Date:           Wed, 21 Aug 2002 09:52:49 +0300
> > >
> > > of interest re datatyping options...
> > >
> > > dan
> > >
> > > ---------- Forwarded message ----------
> > > Date: Tue, 20 Aug 2002 16:20:31 -0500
> > > From: Thomas G. Habing <thabing@uiuc.edu>
> > > To: www-rdf-interest@w3.org
> > > Subject: Using XMLSchema-instance attributes in RDF/XML Syntax
> > > Resent-Date: Tue, 20 Aug 2002 17:20:35 -0400 (EDT)
> > > Resent-From: www-rdf-interest@w3.org
> > >
> > > Hi all,
> > >
> > > I posted the following to www-rdf-comments recently, but it
> > didn't generate
> > > any comments or followup, so I am posting here to see what
> > happens :-).
> > > Does what I am proposing make sense, is it too simplistic,
> > or am I just
> > > missing something?
> > >
> > > ---
> > >
> > > I have been trying to figure out how I can use the various
> > > XMLSchema-instance attributes (especially xsi:type, but
> > also xsi:nil,
> > > xsi:schemaLocation, etc.) in an RDF/XML document.  I want
> > to create valid
> > > RDF/XML, but at the same time I want to be able to validate at least
> > > portions of the RDF/XML using XML Schema.  Some of my XML
> > Schemas require
> > > the use of the xsi:type attribute in the instance documents
> > in order to
> > > validate.  However, RDF insists on treating these
> > xsi:attributes as RDF
> > > property attributes which causes the RDF to be invalid.
> > >
> > > I can understand this in the original RDF M&S since it
> > predates XML Schema
> > > by a year or so, but I am surprised to see no mention of
> > this issue in the
> > > newest "RDF/XML Syntax Specification."
> > >
> > > I have seen some of the discussions in the various lists of
> > using xsi:type
> > > for data typing in RDF.  I don't claim to understand most
> > of the issues
> > > associated with this, but I would like to humbly suggest
> > that at the very
> > > least there should be some language in the "RDF/XML Syntax
> > Specification" to
> > > the effect that attributes in the XMLSchema-instance
> > namespace should be
> > > ignored by RDF parsers, similar to what is done with the
> > xml* attributes.
> > >
> > > Thanks,
> > >         Tom
> > > --
> > > Thomas Habing
> > > Research Programmer, Digital Library Projects
> > > University of Illinois at Urbana-Champaign
> > > 155 Grainger Engineering Library Information Center, MC-274
> > > thabing@uiuc.edu, (217) 244-4425
> > > http://dli.grainger.uiuc.edu
> >
> > --
> > Thomas Habing
> > Research Programmer, Digital Library Projects
> > University of Illinois at Urbana-Champaign
> > 155 Grainger Engineering Library Information Center, MC-274
> > thabing@uiuc.edu, (217) 244-4425
> > http://dli.grainger.uiuc.edu
> >

-- 
Thomas Habing
Research Programmer, Digital Library Projects
University of Illinois at Urbana-Champaign
155 Grainger Engineering Library Information Center, MC-274
thabing@uiuc.edu, (217) 244-4425
http://dli.grainger.uiuc.edu
Received on Tuesday, 27 August 2002 18:32:41 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:50:28 EDT