W3C home > Mailing lists > Public > public-lld@w3.org > November 2010

aside: mentioning multiple types of a thing in RDF/XML vs RDFa

From: Dan Brickley <danbri@danbri.org>
Date: Mon, 1 Nov 2010 17:48:06 +0100
Message-ID: <AANLkTim0nqcUCO1Uqa_5_a-Zs_YV7gb4XOF61SHnW8Pa@mail.gmail.com>
To: Antoine Isaac <aisaac@few.vu.nl>
Cc: public-lld <public-lld@w3.org>
>
> Well, I was in fact going to advice subclassing to Jeff.
>

I think the rise of RDFa may have some bearing on design choices here. It
makes it much easier to mention several types for something, with minimal
syntactic overhead.

So in theory RDF is defined as an abstract standard, and its notations are
irrelevant to modelling habits. In practice, these levels of abstraction are
connected.

Here's what it would look like in RDF/XML to mention a 2nd type for a
person,

1. with one type mentioned:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:Person rdf:about="#fred">
 <foaf:name>Fred Flintstone</foaf:name>
</foaf:Person>
</rdf:RDF>


2. Adding in a second type property:

(pretty ugly and long...)

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:Person rdf:about="#fred">

 <rdf:type rdf:resource="http://example.com/vocab2#BiblioPerson"/>

 <foaf:name>Fred Flintstone</foaf:name>
</foaf:Person>
</rdf:RDF>


3. Using a little-known syntax shortcut in RDF/XML (type= attribute)

(a bit prettier, but in XML you're only allowed one of these type
attributes)

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:Person rdf:about="#fred" rdf:type="
http://example.com/vocab2#BiblioPerson">
 <foaf:name>Fred Flintstone</foaf:name>
</foaf:Person>
</rdf:RDF>


Let's compare this with an RDFa 1.0 HTML page:

4.
<html>
<head><title>a page about Fred</title></head>
<body>
<div xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:vocab2="
http://example.com/vocab2#"
about="#fred" typeof="foaf:Person vocab2:BiblioPerson" >
<span property="foaf:name">Fred Flintstone</span>
</div>
</body>
</html>

...from which we can parse 4 triples:

rapper -i rdfa fred.html
rapper: Parsing URI file:///Users/danbri/working/rdfa/fred.html with parser
rdfa
rapper: Serializing with serializer ntriples
<file:///Users/danbri/working/rdfa/fred.html#fred> <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://xmlns.com/foaf/0.1/Person> .
<file:///Users/danbri/working/rdfa/fred.html#fred> <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://example.com/vocab2#BiblioPerson> .
<file:///Users/danbri/working/rdfa/fred.html#fred> <
http://xmlns.com/foaf/0.1/name> "Fred Flintstone" .
rapper: Parsing returned 3 triples


Note the ease of mentioning extra types:

 typeof="foaf:Person vocab2:BiblioPerson"

...that's a space separated list. We could have types from Dbpedia, wordnet,
freebase, marc relators perhaps ... each requires a declared namespace to be
in scope, and then you just add it to the list. And apparently RDFa 1.1 has
more shortcut idioms in store.

My point being that RDF as deployed to date has tended to mention only a
single type per thing described. That made choosing that type a more weighty
act. If (*if*) RDFa gets more traction as a preferred syntax, we could see a
rise in multi-typed descriptions...

</aside>

cheers,

Dan
Received on Monday, 1 November 2010 16:48:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:27:40 UTC