- From: Gregg Kellogg <gregg@kellogg-assoc.com>
- Date: Mon, 22 Aug 2011 15:29:23 -0400
- To: Jeni Tennison <jeni@jenitennison.com>
- CC: W3C RDFWA WG <public-rdfa-wg@w3.org>
I'm CCing the RDFa WG, as this suggests a possible issue with precedence of terms from the default profile and @vocab, which I believe has been discussed before.
> Hi Gregg,
>
> I'm trying out mapping some microdata examples into RDFa, and came up with this RDFa to represent a list:
>
> <div vocab="#" typeof>
> <p>Flavors in my favorite ice cream:</p>
> <div rel="flavor">
> <ul vocab="http://www.w3.org/1999/02/22-rdf-syntax-ns#" typeof="List">
> <li property="first">Lemon sorbet</li>
> <li rel="rest">
> <span typeof="List">
> <span property="first">Apricot sorbet</span>
> <span rel="rest" resource="nil"></span>
> </span>
> </li>
> </ul>
> </div>
> </div>
>
> aiming to get:
>
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> []
> <#flavor> [
> a rdf:List ;
> rdf:first "Lemon sorbet" ;
> rdf:rest [
> rdf:first "Apricot sorbet" ;
> rdf:rest rdf:nil ;
> ] ;
> ] ;
> .
>
> What I actually get with your RDF Distiller is:
>
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>
> <> <#flavor> [ a rdf:List],
> [ <#rest> [ <#first> "Apricot sorbet";
> <#rest> <nil>;
> a <#List>]] .
As previously mentioned, there is a special rule on the root element (and <head> and <body> with HTML+RDFa) in which @about="" is assumed, so this will not generate a BNode as the top subject.
It's not parsing @resource="nil" as a vocab-expanded URI, but as a document-relative URI. This is because the rules for @resource don't include terms, and @vocab uses the same rules as term (SafeCURIEorCURIEorURI not TERMorCURIEorAbsURI). To make this work, you'll need to use a full URI or a CURIE. Using @resource="rdf:nil" should work, as the 'rdf' prefix is defined in the default profile.
One more gotcha I discovered: If you process the document as HTML+RDFa, @property="first" doesn't generate rdf:first, as the @vocab might indicate; rather, it generate xhv:first; this is because the (X)HTML+RDFa spec defines "first" as a term in the default profile, which trumps @vocab. So, really, your example can only work reliably if you use rdf: prefixes throughout. It worked in the distiller, as it wasn't identified as being an HTML document.
<div vocab="#" typeof>
<p>Flavors in my favorite ice cream:</p>
<div rel="flavor">
<u typeof="rdf:List">
<li property="rdf:first">Lemon sorbet</li>
<li rel="rdf:rest">
<span typeof="rdf:List">
<span property="rdf:first">Apricot sorbet</span>
<span rel="rdf:rest" resource="rdf:nil"></span>
</span>
</li>
</ul>
</div>
</div>
Would you assume that @vocab should trump terms in the default profile (now renamed to something else, due to dropping @profile)? If so, please file a bug.
Gregg
On Aug 14, 2011, at 3:16 PM, Jeni Tennison wrote:
> ...
> Cheers,
>
> Jeni
> --
> Jeni Tennison
> http://www.jenitennison.com
>
Received on Monday, 22 August 2011 19:31:16 UTC