RE: Referencing Datatypes in Class Instances

> -----Original Message-----
> From: ext Matt Munz [mailto:mmunz@apelon.com]
> Sent: 21 March, 2003 22:19
> To: www-rdf-interest@w3.org
> Subject: Referencing Datatypes in Class Instances
> 
> 
> 
> Hi all,
>  
>   I'm working on "hello world" in RDF-S, and I'm getting a 
> bit confused on the datatypes.
>  
>   Here's my RDF-S:
>  
> <rdfs:Class rdf:ID="Circle"/>
> <rdf:Property rdf:ID="radius">
>   <rdfs:domain rdf:resource="#Circle"/>
>   <rdfs:range 
> rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
> </rdf:Property>
> <rdfs:Datatype rdf:about="http://www.w3.org/2001/XMLSchema#integer"/>
>  
>   Here's my RDF:
>  
> <!-- geometricShapes is assigned to the URI of the RDF-S above -->
> <geometricShapes:Circle rdf:ID="sampleCircle">
>   
> <geometricShapes:radius><xmls:integer>23</xmls:integer></geome
> tricShapes:radius>
> </geometricShapes:Circle> 
>   
>   Is this correct?  

Almost. You should use rdf:datatype to express the typed literal rather
than a sub-element. I.e.

<geometricShapes:Circle rdf:ID="sampleCircle">
 <geometricShapes:radius rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">23</geometricShapes:radius>
</geometricShapes:Circle> 

As an aside, you might want to use xsd:positiveInteger rather
than xsd:integer, unless you actually want to potentially have circles 
with negative or zero radii ;-)

> Is there a reccommended tool/library that 
> I can use to validate RDF against a given RDF-S (Java preferred)?

You can give Jena v2 a try. Note that it is only a pre-release, but it
seems to be pretty solid (for what I've been using it for, at least ;-)

C.f. http://www.hpl.hp.com/semweb/jena2.htm

Cheers,

Patrick

--
Patrick Stickler, Nokia/Finland, (+358 40) 801 9690, patrick.stickler@nokia.com
 

Received on Wednesday, 26 March 2003 08:48:19 UTC