Avoid setting href as new subject when no rel/rev is present

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Avoid setting href as new subject when no rel/rev is present

Stéphane Corlosquet
Hi,

I just found a bug in the RDF output generated on Drupal 7 frontpage [1]. This is the code of interest (cleaned up for clarity):

<div about="/node/12">
  <ul>
    <li>
      <a content="4" property="sioc:num_replies" href="/node/12#comments">4 comments</a>
    </li>
  </ul>
</div>

I initially thought it would create the triple
</node/12> sioc:num_replies "4" .
but it turns out the RDFa parser I use generates
</node/12#comments> sioc:num_replies "4" .

What's happening is that the href URI is set as new subject because there are no rel/rev (due to the parsing rule 4 at [2]). Adding rel="" does the trick and the Ubiquity-rdfa parser return the expected triple. Another option would be to repeat about="/node/12" in the a tag, though I like the empty rel better:

<div about="/node/12">
  <ul>
    <li>
      <a content="4" property="sioc:num_replies" rel="" href="/node/12#comments">4 comments</a>
    </li>
  </ul>
</div>

I just wanted to check and make sure there is not problem in using the empty rel hack, or whether there is a better way of working around this?

Steph.

[1] http://drupalrdf.openspring.net/
[2] http://www.w3.org/TR/rdfa-syntax/#sec_5.5.
Reply | Threaded
Open this post in threaded view
|

Re: Avoid setting href as new subject when no rel/rev is present

Toby Inkster-4
On Thu, 2010-01-14 at 13:21 -0500, Stephane Corlosquet wrote:
> I just wanted to check and make sure there is not problem in using the
> empty rel hack, or whether there is a better way of working around
> this?

Yes - it's an odd case. I find it an unintuitive behaviour, though I can
imagine plenty of arguments in its favour.

Other workarounds:

1. Include an explicit @about on the <a> tag.

2. Put something useful into rel, such as sioc:has_discussion.

3. Move the @content and @property to the containing <li> element.

Is there an RDFa test suite case covering this construct?

--
Toby A Inkster
<mailto:[hidden email]>
<http://tobyinkster.co.uk>


Reply | Threaded
Open this post in threaded view
|

Re: Avoid setting href as new subject when no rel/rev is present

Ivan Herman-2
In reply to this post by Stéphane Corlosquet
Hi Stéphane,

- The usage of @rel="" is technically correct in my reading of the spec
(and my distiller code:-): step 5 of the processing steps[1] is applied,
and that step only refers to the existence of @rel/@rev not whether they
provide valid URI-s.

- Whether it is good practice or not is of course another question. As
far as I am concerned, I think it is cleaner if, eg, an explicit @about
is placed there (as Toby proposed). This may be a bit of a pain for a
human author but it does not cost a penny, I presume, for an automatic
procedure in Drupal...

Cheers

Ivan


[1] http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014/#s_model

On 2010-1-14 19:21 , Stephane Corlosquet wrote:

> Hi,
>
> I just found a bug in the RDF output generated on Drupal 7 frontpage [1].
> This is the code of interest (cleaned up for clarity):
>
> <div about="/node/12">
>   <ul>
>     <li>
>       <a content="4" property="sioc:num_replies" href="/node/12#comments">4
> comments</a>
>     </li>
>   </ul>
> </div>
>
> I initially thought it would create the triple
> </node/12> sioc:num_replies "4" .
> but it turns out the RDFa parser I use generates
> </node/12#comments> sioc:num_replies "4" .
>
> What's happening is that the href URI is set as new subject because there
> are no rel/rev (due to the parsing rule 4 at [2]). Adding rel="" does the
> trick and the Ubiquity-rdfa parser return the expected triple. Another
> option would be to repeat about="/node/12" in the a tag, though I like the
> empty rel better:
>
> <div about="/node/12">
>   <ul>
>     <li>
>       <a content="4" property="sioc:num_replies" rel=""
> href="/node/12#comments">4 comments</a>
>     </li>
>   </ul>
> </div>
>
> I just wanted to check and make sure there is not problem in using the empty
> rel hack, or whether there is a better way of working around this?
>
> Steph.
>
> [1] http://drupalrdf.openspring.net/
> [2] http://www.w3.org/TR/rdfa-syntax/#sec_5.5.
>
--

Ivan Herman, W3C Semantic Web Activity Lead
Home: http://www.w3.org/People/Ivan/
mobile: +31-641044153
PGP Key: http://www.ivan-herman.net/pgpkey.html
FOAF   : http://www.ivan-herman.net/foaf.rdf
vCard  : http://www.ivan-herman.net/HermanIvan.vcf


smime.p7s (5K) Download Attachment