- 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
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 UTC