W3C home > Mailing lists > Public > public-html-data-tf@w3.org > November 2011

Re: Using @resource instead of @about in RDFa Lite

From: Ivan Herman <ivan@w3.org>
Date: Thu, 17 Nov 2011 09:34:32 +0100
Cc: Niklas Lindström <lindstream@gmail.com>, public-rdfa-wg <public-rdfa-wg@w3.org>, HTML Data Task Force WG <public-html-data-tf@w3.org>, Dan Brickley <danbri@danbri.org>, Ben Adida <ben@adida.net>
Message-Id: <E54B7BAC-855C-4D2A-B7BF-875DF1168645@w3.org>
To: Jeni Tennison <jeni@jenitennison.com>
I essentially agree. In fact, I realized a while ago, when I played with the new @property setting in RDFa 1.1, that @resource might really be missing[1]. I must admit I did not think of dropping @about although, thinking about it further, having them both might be a bit complicated for the constituency of RDFa Lite.

I have cc-d Ben explicitly, to see if there were some technical issues discussed on this that we may not know about.

Ivan

[1] http://lists.w3.org/Archives/Public/public-rdfa-wg/2011Nov/0024.html

On Nov 16, 2011, at 23:49 , Jeni Tennison wrote:

> 
> On 16 Nov 2011, at 21:19, Niklas Lindström wrote:
>> Have we considered whether @resource would be preferable over @about
>> in RDFa Lite?
> 
> It's funny because I was just running into some issues that made me wish for @resource rather than @about.
> 
> @danbri set me the challenge of creating a stylesheet to map microdata into RDFa 1.1 Lite in part to easily generate some RDFa 1.1 Lite examples using schema.org markup.
> 
> The first document that I tried was http://www.imdb.com/title/tt0813715/. This contains the markup (much simplified here):
> 
>  <div itemscope itemtype="http://schema.org/TVSeries">
>    <div itemprop="aggregateRating" 
>         itemscope itemtype="http://schema.org/AggregateRating">
>      Ratings: 
>      <strong><span itemprop="ratingValue">7.2</span></strong>
>      <span class="mellow">/<span itemprop="bestRating">10</span></span> from 
>      <a href="ratings" 
>         title="23,201 IMDb users have given an average vote of 7.2/10">
>        <span itemprop="ratingCount">23,201</span> users</a>
>    </div>
>  </div>
> 
> which if you were to convert to RDF using the microdata/RDF mapping that Gregg's been working on, would generate something like:
> 
>  <> md:item [ 
>    a schema:TVSeries;
>    schema:aggregateRating [ 
>      a schema:AggregateRating;
>      schema:bestRating "10";
>      schema:ratingCount "23,201";
>      schema:ratingValue "7.2"
>    ]
>  ] .
> 
> A simplistic mapping into RDFa 1.1 gives:
> 
>  <div vocab="http://schema.org/" typeof="TVSeries">
>    <div property="aggregateRating" 
>         vocab="http://schema.org/" typeof="AggregateRating">
>      Ratings: 
>      <strong><span property="ratingValue">7.2</span></strong>
>      <span class="mellow">/<span property="bestRating">10</span></span> from 
>      <a href="ratings" 
>         title="23,201 IMDb users have given an average vote of 7.2/10">
>        <span property="ratingCount">23,201</span> users</a>
>    </div>
>  </div>
> 
> If you run that through a RDFa parser, you get:
> 
>  [ 
>    a schema:TVSeries;
>    schema:aggregateRating [ 
>      a schema:AggregateRating;
>      schema:bestRating "10";
>      schema:ratingValue "7.2"
>    ]
>  ] .
> 
>  <ratings> schema:ratingCount "23,201" .
> 
> What's happened? The ratingCount property is nested within a link, and the @href of the link is creating a new scope for the statements within that link, so instead of belonging to the AggregateRating, the ratingCount is a property of <ratings> (the URI of the link).
> 
> I can get around that in this case by adding a property="" to the link. However, if it had a @rel on it already, like this:
> 
>  <div vocab="http://schema.org/" typeof="TVSeries">
>    <div property="aggregateRating" 
>         vocab="http://schema.org/" typeof="AggregateRating">
>      Ratings: 
>      <strong><span property="ratingValue">7.2</span></strong>
>      <span class="mellow">/<span property="bestRating">10</span></span> from 
>      <a href="ratings" rel="prefetch"
>         title="23,201 IMDb users have given an average vote of 7.2/10">
>        <span property="ratingCount">23,201</span> users</a>
>    </div>
>  </div>
> 
> then that wouldn't work. In that case, I need to make sure that the subject of the ratingCount property is the aggregate rating, rather than <ratings>.
> 
> I could do that in two ways. One would be to add an @about attribute on both elements pointing to the same blank node, but in that case I'd need to create another nested <div> because if I put an @about attribute on the element with property="aggregateRating" then the subject of the triple generated by that property would be the @about. But then the property="aggregateRating" doesn't chain, so I'd have to use @rel:
> 
>  <div vocab="http://schema.org/" typeof="TVSeries">
>    <div rel="aggregateRating">
>      <div about="_:rating" vocab="http://schema.org/" typeof="AggregateRating">
>        Ratings: 
>        <strong><span property="ratingValue">7.2</span></strong>
>        <span class="mellow">/<span property="bestRating">10</span></span> from 
>        <a href="ratings" rel="prefetch"
>           title="23,201 IMDb users have given an average vote of 7.2/10">
>          <span about="_:rating" property="ratingCount">23,201</span> users</a>
>      </div>
>    </div>
>  </div>
> 
> Or as Nicklas suggested I could use the @resource attribute. That works out a lot neater:
> 
>  <div vocab="http://schema.org/" typeof="TVSeries">
>    <div property="aggregateRating" resource="_:rating"
>         vocab="http://schema.org/" typeof="AggregateRating">
>      Ratings: 
>      <strong><span property="ratingValue">7.2</span></strong>
>      <span class="mellow">/<span property="bestRating">10</span></span> from 
>      <a href="ratings" rel="prefetch" resource="_:rating"
>         title="23,201 IMDb users have given an average vote of 7.2/10">
>        <span property="ratingCount">23,201</span> users</a>
>    </div>
>  </div>
> 
> Note that in neither case does the xhv:prefetch relationship make any sense whatsoever. Hopefully processors will ignore the bogus xhv:* properties.
> 
> @resource also gives a lot better mapping for @itemid. Say the microdata had an @itemid on the inner <div> like this:
> 
>  <div itemscope itemtype="http://schema.org/TVSeries">
>    <div itemprop="aggregateRating" 
>         itemscope itemtype="http://schema.org/AggregateRating"
>         itemid="ratings">
>      Ratings: 
>      <strong><span itemprop="ratingValue">7.2</span></strong>
>      <span class="mellow">/<span itemprop="bestRating">10</span></span> from 
>      <a href="ratings" 
>         title="23,201 IMDb users have given an average vote of 7.2/10">
>        <span itemprop="ratingCount">23,201</span> users</a>
>    </div>
>  </div>
> 
> If @resource were allowed in RDFa 1.1 Lite then I could just map the @itemid to @resource really easily:
> 
>  <div vocab="http://schema.org/" typeof="TVSeries">
>    <div property="aggregateRating"
>         vocab="http://schema.org/" typeof="AggregateRating"
>         resource="ratings">
>      Ratings: 
>      <strong><span property="ratingValue">7.2</span></strong>
>      <span class="mellow">/<span property="bestRating">10</span></span> from 
>      <a href="ratings"
>         title="23,201 IMDb users have given an average vote of 7.2/10">
>        <span property="ratingCount">23,201</span> users</a>
>    </div>
>  </div>
> 
> So I strongly support Niklas' suggestion of using @resource rather than @about in RDFa 1.1 Lite.
> 
> Cheers,
> 
> Jeni
> -- 
> Jeni Tennison
> http://www.jenitennison.com
> 
> 


----
Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
mobile: +31-641044153
FOAF: http://www.ivan-herman.net/foaf.rdf
Received on Thursday, 17 November 2011 08:32:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 17 November 2011 08:32:04 GMT