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

RE: Hide vs Expose the type information in an RDF/XML instance?

From: Jon Hanna <jon@spin.ie>
Date: Thu, 20 Feb 2003 15:50:19 -0000
To: <www-rdf-interest@w3.org>
Message-ID: <NDBBLCBLIMDOPKMOPHLHIECPEOAA.jon@spin.ie>

> For example, is this preferred:
>
>      <Length>
>           <rdf:Description>
>                <rdf:value>6300</rdf:value>
>                <uom:units>kilometers</uom:units>
>           </rdf:Description>
>      </Length>
>
> Or, is this preferred:
>
>      <Length>
>           <Distance>
>                <rdf:value>6300</rdf:value>
>                <uom:units>kilometers</uom:units>
>           </Distance>
>      </Length>
>
> In the first case, the type information is "hidden" in the RDF Schema.
> In the second case the type information is "exposed" in the RDF/XML
> instance.  Which is preferred?  What are the tradeoffs?  /Roger

I would prefer the latter generally. It requires less work to obtain the
type if desired, is more human-readable. However it isn't a "biggie".

Your hand may be forced either way by a few things. The first may be
mandated if the system outputting the RDF/XML simply doesn't know the type.
The second may be mandated if there are using a subClassOf the type that
could be deduced from the range, and want to make that clear. Also you may
be using an XML document type that is a subset of the possible RDF/XML
encodings and that may mandate such a use (RSS works this way. I've been
experimenting of late with RDF/XML files that use an XSL to render as
human-readable HTML pages when viewed in a browser, that's a lot easier if
you restrict the possible encodings).

It's worth remembering that stating that a resource is of a given type
doesn't rule out it being of other types as well. That it is of the types of
all of its type's superclasses is implied. If you need to point out that it
is of an unrelated type you need to do something like:

<Distance>
	<rdf:type rdf:resource="#EstimatedMeasurement"/>
	<rdf:value>6300</rdf:value>
	<uom:units>kilometers</uom:units>
</Distance>

Which is equivalent to:

<EstimatedMeasurement>
	<rdf:type rdf:resource="#Distance"/>
	<rdf:value>6300</rdf:value>
	<uom:units>kilometers</uom:units>
</EstimatedMeasurement>

Of course here you could have defined #EstimatedDistance as a subClassOf
both and then used that.
Received on Thursday, 20 February 2003 10:49:01 GMT

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