W3C home > Mailing lists > Public > www-rdf-interest@w3.org > February 2003

RE: Type coercing a resource's type?

From: Jon Hanna <jon@spin.ie>
Date: Mon, 24 Feb 2003 11:54:13 -0000
To: <www-rdf-interest@w3.org>
Message-ID: <NDBBLCBLIMDOPKMOPHLHIEELEOAA.jon@spin.ie>

> If this was a programming language I would do a type coercion to coerce
> it to Sea.
>
> My question is this: is there something that I can do in the RDF Schema
> to indicate:
>
>     "For the Yangtze River instance the property
>      EmptiesInto has the more specific type Sea"
>
> That is, in an RDF Schema can I make statements about particular
> instances?  /Roger

Programming languages perform type coercion because there is information
somewhere that allows them to do so (and if there isn't that information it
can go horribly wrong, consider the case of using a reinterpret_cast in C++
where a dynamic_cast would be the correct cast to use).

> My question is this: is there something that I can do in the RDF Schema
> to indicate:
>
>     "For the Yangtze River instance the property
>      EmptiesInto has the more specific type Sea"
>
> That is, in an RDF Schema can I make statements about particular
> instances?  /Roger

Are you sure you want to make that specific statement in the case of the
Yangtze? It would then follow that you would be making similar statements
about the Liffey, the Danube and the Mississippi in the schema. When you get
to the point that you are putting specific information about the stream that
runs at the back of your garden into the schema you'll have a scalability
problem! :)

As I see it you have three options.

1. Put the fact that
<http://www.china.org/geography#EastChinaSea> <rdf:type> <geo:Sea> .
into the document with statements about the Yangtze. The most human-readable
way would probably be:

<River rdf:ID="Yangtze"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns="http://www.geodesy.org/water/naturally-occurring#">
	<Length>6300 kilometers</Length>
	<EmptiesInto>
		<Sea rdf:about="http://www.china.org/geography#EastChinaSea"/>
	</EmptiesInto>
</River>

Quite a few people would argue in favour of providing the most restrictive
type information you have access to when you compose an RDF file, even if it
is redundant in a given application it can be useful. If nothing else the
increased precision should help human reading of the file for debugging
purposes.

2. Put the fact that
<http://www.china.org/geography#EastChinaSea> <rdf:type> <geo:Sea> .
into a document about the EastChinaSea. If your application knows how to
find that document (another issue, but we'll worry about that later...) then
it can find that the type if and when it needs to.

Note that in some cases these two solutions are one and the same (for
example a document about the major natural features of china would probably
contain all of the relevant information).

3. Define a subclass of River SeaRiver. Use OWL to restrict SeaRiver's
EmptiesInto to have Sea as it's range. In this particular case it doesn't
seem very sensible (a river empties into whatever it comes across, so there
is no real difference between a sea-river and a river, as far as my
knowledge of geography tells me), but it can be useful elsewhere.

BTW, you might want to look at renaming the properties length and
emptiesInto if you are at an early stage of development. There is a
convention of using lower-case to begin predicate names and upper-case to
begin class names. It makes no difference technically, and is by no means
universal, but it can greatly aid the readability of RDF/XML files by
helping your eye follow the "striping" between the two.
Received on Monday, 24 February 2003 06:52:42 GMT

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