Drupal 7 core outputs RDFa 1.0 by default, the version of RDFa which was recommended at the time of Drupal 7 release in January 2011. Since then, RDFa 1.1 was released and while the RDFa Working Group tried to keep RDFa 1.1 backward compatible with 1.0, there are a few features which were introduced to make RDFa 1.1 easier to author in the long run, which are not backward compatible with 1.0 out of the box. Note that this doesn't affect Drupal 7 sites which are using the default RDFa 1.0 doctype (which I believe is currently still the majority of Drupal 7 sites), but as people upgrade their doctype to RDFa 1.1/HTML5, this issue will start to appear more often, as reported by jneubert. The RDFa markup we generate for taxonomy terms is affected by one of the new features of RDFa 1.1, namely the @property attribute now takes the @href as property value by default, while in RDFa 1.0 @property was taking the value of the
a element (the taxonomy term name). The
a element wrapping usernames is also affected in the same way.
Using an empty @datatype attribute makes @property take on the value of the HTML element as opposed to the @href. This works in both RDFa 1.0 and RDFa 1.1: it is implicit in RDFa 1.0, but can be made explicit in RDFa 1.1 by adding the empty datatype attribute, indicating that the property value has to be a plain literal. This empty @datatype does not have any effect in RDFa 1.0 and does not change the RDF output, it is therefore safe to use it on sites which are still using the legacy RDFa 1.0 doctype. No new HTML element or no repeat content is required, simply an additional empty attribute. This is the new the markup for a taxonomy term:
<li class="taxonomy-term-reference-0" rel="dc:subject"> <a property="rdfs:label skos:prefLabel" datatype="" typeof="skos:Concept" href="/plain/?q=taxonomy/term/1">xy</a> </li>
I've published a couple of test HTML documents in RDFa 1.0 and RDFa 1.1 and you can view the generated RDF output in the RDF.rb Distiller (RDFa 1.0 example and RDFa 1.1 example) and in the W3C PyRDFa Distiller (RDFa 1.0 example and RDFa 1.1 example). In all 4 cases, the RDF output is the same.
A patch is available for review in #10.
Original report by jneubert
On an article page, the link to a taxonomy term is rendered as
<li class="taxonomy-term-reference-0" rel="dc:subject"> <a property="rdfs:label skos:prefLabel" typeof="skos:Concept" href="/plain/?q=taxonomy/term/1">xy</a> </li>
RDFa Distiller extracts from this code snippet:
@prefix dc: <http://purl.org/dc/terms/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix skos: <http://www.w3.org/2004/02/skos/core#> . <> dc:subject [ rdfs:label </plain/?q=taxonomy/term/1>; skos:prefLabel </plain/?q=taxonomy/term/1> ] . </plain/?q=taxonomy/term/1> a skos:Concept .
which is nosense. Instead of literals, the labels become object properties, the literal values are lost.
In my eyes, the entry should be rendered as something like
<li class="taxonomy-term-reference-0" rel="dc:subject"> <a typeof="skos:Concept" href="/plain/?q=taxonomy/term/1"><span property="rdfs:label skos:prefLabel">xy</span></a> </li>
which would produce the intended
<> dc:subject </plain/?q=taxonomy/term/1> . </plain/?q=taxonomy/term/1> a skos:Concept; rdfs:label "xy"; skos:prefLabel "xy" .
I wondered if I did something wrong, but I could reproduce the issue in a plain Drupal 7.17 installation, as well as in plain Drupal 7.15. I'm quite sure that I have seen this differently (and correct) in a prior version.
PASSED: [[SimpleTest]]: [MySQL] 39,685 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 39,757 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 50,027 pass(es). View