I am currently teaching myself RDFa Core 1.1 after successfully learning RDFa Lite rather easily. Straight to the point, I can't understand two things: the difference between property
and rel
, and the difference between resource
and about
.
Please explain to me in simpler terms than the spec :)
property
vs. rel
:
Both attributes indicate a predicate of a triple, e.g. rel="http://purl.org/dc/terms/creator
, which is the predicate ... has as a creator: ...
.
The difference is, from where they take their object. Slightly simplified, the rules for property
are: The object is taken ...
content
attribute or, if this is not present in the tag,datatype
attr is present in the tag:) from a valid resource
attribute or, if this is not present in the tag,datatype
attr is present in the tag:) from a valid href
attribute or, if this is not present in the tag,datatype
attr is present in the tag:) from a valid src
attribute or, if this is not present in the tag,Slightly simplified, rel
differs in two aspects:
resource
or a href
or a src
attribute.property
can induce chaining if used with typeof
(cf. 2).about
vs resource
:
about
is the attribute to indicate the subject of a triple. The rules for resource
are more complicated: It may indicate a subject or an object, and chaining plays a role here, too.
IMHO, chaining is the most complicated and confusing part of RDFa (and does not give you more than syntactic sugar). I would avoid chaining. This is possible by avoiding the attributes rel
, rev
, resource
and typeof
, which brings some further simplification at the same time. Thus, I use only the following attributes:
about
for the subject
property
for the predicate
content
or href
or src
(or the inner content of the element) for the object, following the rules outlined abovelang
for a language tag for object literals, e.g. lang="en"
datatype
for a datatype tag for object literalsprefix
(but only once in a document), so that I can abbreviate URLs by prefixing, e.g. property="dc:creator"
vocab
(rarely and at the most once in a document), so that I can abbreviate URLs implicitly, e.g. property="creator"
.(And I use the tag <base href="...">
to indicate the URL base value of the document.)
This is a strict, safe, easy-to-use and easy-to-parse subset of RDFa and allows to express any triple you want.
I would personally recommend to ignore / avoid using rel and about, they are not really necessary to write RDFa if you follow the rule of thumb that you should not try to be too smart by stuffing as many attributes as possible in a given HTML element. There are around for backward compatibility reasons. The other attributes from 1.1 are worth learning though: content and datatype.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With