Due to recent changes in rdfui.module which might save an empty datatype, the RDFa markup might contain datatype="", resulting in HTML markup (like body field) to be treated as literal when, in RDFa 1.0 it would be parsed as rdf:XMLLiteral. We should be cautious and explicitly output the datatype so that there is no ambiguity between the different interpretation in RDF 1.0 vs. RDFa 1.1.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Blooniverse’s picture

... which datatype should this be, @scor?

scor’s picture

there should be no datatype attribute at all in the RDFa output

Anonymous’s picture

We should ensure that RDF UI module does not save the datatype (or delete the existing datatype) if the string is empty.

Anonymous’s picture

Also, I would consider this an alpha blocker.

Anonymous’s picture

Status: Active » Needs review
FileSize
1.95 KB

Rewrote the logic to:

1. Load the original mapping
2. If there is field input for a key (i.e. predicates), then add that to the mapping or overwrite the existing value
3. If there is no field input, unset the value from the mapping
4. Save the mapping

This solves the datatype problem.

scor’s picture

Priority: Normal » Major
Status: Needs review » Needs work

This patch solves the datatype issue.

3. If there is no field input, unset the value from the mapping

This is not enough, the whole mapping needs to be removed. If you blank the predicate in the mappings form and save, the field (e.g. body) will have property="" because the 'type' is still set to property by the form, which is fine, as long as the whole field mapping is unset during submit.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
2.09 KB

Thanks for catching that, this one removes the entire mapping if the predicate is empty.

milesw’s picture

Tested #7 and it works as expected.

Before applying the patch I saved RDF mappings for the Article content type without specifying any datatypes. I found the RDFa for body was indeed outputting datatype="".

Applied #7, re-saved mappings for Article, and now there is no more empty datatype appearing. Nice work! :)

Anonymous’s picture

Status: Needs review » Fixed

Thanks for the review Miles, fixed with commit http://drupalcode.org/project/rdf.git/commit/cbadb4c

Status: Fixed » Closed (fixed)

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

milesw’s picture

Project: Resource Description Framework (RDF) » RDF Extensions
Component: D7. RDF UI » Code