Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#7 | 835906-7-empty-datatype.patch | 2.09 KB | linclark |
#5 | 835906-5-empty-datatype.patch | 1.95 KB | linclark |
Comments
Comment #1
Blooniverse CreditAttribution: Blooniverse commented... which datatype should this be, @scor?
Comment #2
scor CreditAttribution: scor commentedthere should be no datatype attribute at all in the RDFa output
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedWe should ensure that RDF UI module does not save the datatype (or delete the existing datatype) if the string is empty.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedAlso, I would consider this an alpha blocker.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedRewrote 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.
Comment #6
scor CreditAttribution: scor commentedThis patch solves the datatype issue.
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.Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks for catching that, this one removes the entire mapping if the predicate is empty.
Comment #8
milesw CreditAttribution: milesw commentedTested #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! :)
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks for the review Miles, fixed with commit http://drupalcode.org/project/rdf.git/commit/cbadb4c
Comment #11
milesw CreditAttribution: milesw commented