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

Re: xml datatype facets

From: Benjamin Nowack <bnowack@appmosphere.com>
Date: Thu, 13 Jan 2005 12:56:44 +0100
To: "Geoff Chappell" <geoff@sover.net>
Cc: www-rdf-interest@w3.org
Message-ID: <PM-EH.20050113125644.C835B.1.1D@>

On 12.01.2005 14:14:10, Geoff Chappell wrote:
>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. 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.

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:simpleType xsd:name="LengthConstrainedString">
      <xsd:restriction xsd:base="string">
        <xsd:maxLength value="32"/>
        <xsd:minLength value="1"/>

and then you can use rdf to create an individual of type
<rdfs:Datatype rdf:about="&ex;LengthConstrainedString" />

and use its URI in rdf/xml docs:
   <foo:length rdf:datatype="&ex;LengthConstrainedString">

(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



Benjamin Nowack

Kruppstr. 100
45145 Essen, Germany
Received on Thursday, 13 January 2005 11:56:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:44:54 UTC