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@192.168.27.2>

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. 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: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>
]]]

(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/
Received on Thursday, 13 January 2005 11:56:57 GMT

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