The RDFa markup for the number of comments in teaser mode is:

<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 RDFa parsing rule 4). Our options are either to:
- add about="/node/12" in the a tag
- add rel="" in the a tag

Although it's less self explanatory, I would choose the empty rel which would perform slightly better - no value to check_plain() in drupal_attributes() - and generate a bit less extra markup (with appropriate documentation in rdf.module).

(see related thread on the RDFa mailing list).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

Issue tags: +RDF, +RDFa

tagging

Stefan Freudenberg’s picture

Status: Active » Needs review
FileSize
926 bytes

Here's a patch that adds the empty rel attribute to the comment count links.

scor’s picture

Status: Needs review » Needs work

We need a comment to explain why we need to add this empty rel, something like:
According to the RDFa processing rule #4 triggered the lack of @rel/@rev attribute, a new subject URI will be set from the @href value. We want to trigger rule #5 and for that reason set an empty @rel attribute. (with a link to http://www.w3.org/TR/rdfa-syntax/#sec_5.5.)

A test for that empty @rel will also be nice :)

Stefan Freudenberg’s picture

FileSize
2.86 KB

Added a comment and a test.

Stefan Freudenberg’s picture

Status: Needs work » Needs review
Stefan Freudenberg’s picture

FileSize
2.95 KB

Removed trailing whitespace.

scor’s picture

This patch works. The test fail when the empty @rel hunk is not there, and works otherwise, so this is RTBC after some minor docs tweaks below (leaving needs review as this is minor).

+++ modules/rdf/rdf.module	8 Apr 2010 12:42:24 -0000
@@ -483,6 +483,12 @@ function rdf_preprocess_node(&$variables
+      // According to RDFa parsing rule number 4 a new subject URI is created

a comma between "number 4" and "a new..." would improve the read flow.

+++ modules/rdf/rdf.module	8 Apr 2010 12:42:24 -0000
@@ -483,6 +483,12 @@ function rdf_preprocess_node(&$variables
+      // the original node URL from the about attribute of the container we

parent container to be more explicit.

+++ modules/rdf/rdf.module	8 Apr 2010 12:42:24 -0000
@@ -483,6 +483,12 @@ function rdf_preprocess_node(&$variables
+      // from the href attribute if no rel/rev attribute is present.  To get
+++ modules/rdf/rdf.module	8 Apr 2010 12:42:24 -0000
@@ -483,6 +483,12 @@ function rdf_preprocess_node(&$variables
+      // set an empty rel attribute which triggers rule number 5.  See

We don't put double space after the end of a sentence.

Stefan Freudenberg’s picture

FileSize
2.86 KB

Modified the patch according to previous comment.

scor’s picture

Status: Needs review » Reviewed & tested by the community

thanks Stefan! RTBC as said in #7.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -RDF, -RDFa

Automatically closed -- issue fixed for 2 weeks with no activity.