W3C home > Mailing lists > Public > www-rdf-interest@w3.org > January 2005

RE: xml datatype facets

From: Geoff Chappell <geoff@sover.net>
Date: Thu, 13 Jan 2005 09:22:47 -0500
To: "'Benjamin Nowack'" <bnowack@appmosphere.com>
Cc: <www-rdf-interest@w3.org>
Message-ID: <004201c4f97b$5b34d820$6401a8c0@gsclaptop>



> -----Original Message-----
> From: Benjamin Nowack [mailto:bnowack@appmosphere.com]
> Sent: Thursday, January 13, 2005 6:57 AM
> To: Geoff Chappell
> Cc: www-rdf-interest@w3.org
> Subject: Re: xml datatype facets
> 
> On 12.01.2005 14:14:10, Geoff Chappell wrote:
> >
> >Hi,
> >
> >Any one know of any standards or best practices for specifying facets on
> xml
> >datatypes in rdf?
> >
> >I imagine something like this (in turtle/n3):
> >
> >ex:LengthConstrainedString a rdfs:Datatype;
> >  rdfs:subClassOf xsd:string;
> >  xsd:maxLength
> "32"^^<http://www.w3.org/2001/XMLSchema#nonNegativeInteger>;
> >  xsd:minLength
> > "1"^^<http://www.w3.org/2001/XMLSchema#nonNegativeInteger>.

> hm, ex:LengthConstrainedString would need to be a subDatatype, not a
> subClass of xsd:string. 

Are you sure? I think it is an instance of datatype, just as xmlliteral and
xsd:string are - i.e. it's one of those things that maps strings to values.
And I'd think it is a subclass of xsd:string because, well, it is...;-) i.e.
by definition it's just a specialization/winnowing of the instances of the
class xsd:string to those that are between 1 and 32 chars in length. 

> But (AFAIK) RDF doesn't provide means to
> define/describe custom datatypes at all (apart from owl:DataRange) and
> refers to XML Schema to define them and assign a URI which can then be
> used in RDF instead.

Yeah, I'm just wondering how to tighten that coupling some.

> So you'd need some XML schema with something along: (not sure if
> it's correct, esp. re namespaces of name/base/etc attributes,
> also not sure about the fragId thing)
> [[[
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>    xsd:targetNamespace="http://www.example.com/dt#">
>    <xsd:simpleType xsd:name="LengthConstrainedString">
>       <xsd:restriction xsd:base="string">
>         <xsd:maxLength value="32"/>
>         <xsd:minLength value="1"/>
>       </xsd:restriction>
>    </xsd:simpleType>
> </xsd:schema>
> ]]]
> 
> and then you can use rdf to create an individual of type
> rdfs:Datatype
> [[[
> <rdfs:Datatype rdf:about="&ex;LengthConstrainedString" />
> ]]]
> 
> and use its URI in rdf/xml docs:
> [[[
> <rdf:Description>
>    <foo:length rdf:datatype="&ex;LengthConstrainedString">
>      bar
>    </foo:length>
> <rdf:Description>
> ]]]

The question is how would a rdf processor that knew about primitive xml
datatypes and could understand their various facets, come up with the xml
definition of ex: LengthConstrainedString (upon encountering it's use in a
triple)? Seems to me either the name needs to be reliably dereferencable
(i.e. treat the uri like a url - a get of which returns a chunk of xml), or
the rdf graph needs to carry the definition with it - either by a mapping to
triples or just as a xmlliteral on some well known property.


> (with the drawback that tools with limited support for built-in
> datatypes (xsd:string, xsd:integer) will in most cases treat
> foo:length like an untyped literal, so it may result in less
> processable information than you'd get using a less constrained
> xsd:string.)
> 
> benjamin
> 
> >
> >
> >Or....?
> >
> >Thanks,
> >
> >Geoff
> >
> >
> >
> 
> --
> Benjamin Nowack
> 
> Kruppstr. 100
> 45145 Essen, Germany
> http://www.bnode.org/


Geoff
Received on Thursday, 13 January 2005 14:22:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:52:12 GMT