Re: RDFa generalization - expressing Microformats

> <body prefix="uf=http://microformats.org/vocab#">
>
> <div typeof="haudio">
>    <span property="title">Start Wearing Purple</span> by
>    <span property="contributor">Gogol Bordello</span>
>    <span property="published" content="20020514">May 14th, 2002</span>
> </div>
>
> </body>

Why not just use something like this:

     prefix="=http://microformats.org/vocab#"

(Yes, that value intentionally starts with an equals sign.) That way  
you're saying that all unprefixes values come from that vocab - there  
is no need for the vocab document to define all those "xhv:reserved"  
triples.

So for example, for the following HTML:

     <body prefix="=http://microformats.org/vocab#
                   dc=http://purl.org/dc/terms/">
       <div typeof="haudio">
         <span property="title dc:title">Start Wearing Purple</span> by
         <span property="contributor">Gogol Bordello</span>
         <span property="published" content="20020514">May 14th,  
2002</span>
       </div>
     </body>

The parser would see the <body> element and become aware that two  
CURIE prefixes have been defined - "dc" and a default prefix. Then it  
hits the <div> element and sees the typeof attribute. This contains a  
unprefixed value, so the default prefix is used and expands to:

     _:bnode0 a <http://microformats.org/vocab#haudio>.

Then the parser hits the first <span> and sees to properties: "title"  
belonging to the default prefix, and "dc:title" which clearly has the  
"dc" prefix so creates two triples:

     _:bnode0
       <http://microformats.org/vocab#title>
         "Start Wearing Purple" ;
       <http://purl.org/dc/title>
         "Start Wearing Purple" .

(/me wishes turtle had a shorthand for situations like this: two  
triples which share a subject and object.)

That way the RDFa parser has no need to download and parse the  
vocabulary document. Instead it uses the simple rule that all  
unprefixed terms belong to the default prefix, and the default prefix  
may be defined in the same way as other prefixes using  
prefix="pfx=uri" but by having "pfx" set to the empty string. If no  
default prefix is defined, then a default default prefix of <http:// 
www.w3.org/1999/xhtml/vocab#> is assumed.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Tuesday, 2 September 2008 09:38:52 UTC