One confusion that surrounds RDFa is whether you must wait for XHTML 2 to come along, before you can use it. In this post we’ll try to clarify how RDFa relates to HTML now.
The key thing to understand about RDFa is that it doesn’t just add new attributes and techniques to XHTML to allow for the embedding of rich metadata, it also brings to the fore the metadata features that already exist in XHTML. This is important, because a key design goal has been that to convince people to put metadata into their documents–important if we are ever to bring about the so-called Semantic Web–it has to be easy…and to be easy it needs to build on what people already know how to do.
RDFa does a lot, but here we will describe some of its features at a high level, in order to show how RDFa extends XHTML practice, rather than replacing it.
1. Use @rel and @rev to give information about your links.
This first technique is just standard HTML. Best-practice would say that a value is also added to the profile attribute, and currently RDFa says nothing about what that should be–but it should.
2. Use namespace-prefixed @rel and @rev values to make this information globally understandable.
The problem with simply putting text values into @rel and @rev is that it is not clear whether your ‘event’ is the same as my ‘event’. If we want to share our metadata or make it available to metadata search engines then we need to say that we both mean the same thing. This is usually achieved with namespaces, and RDFa recommends using CURIEs (a prefixed name, for example dc:creator) when you want to be precise.
Using namespaces in @rel and @rev would still be valid XHTML though, even though browsers wouldn’t do anything with the values (of course the whole point is that an RDFa parser could).
3. Use @property to provide predicates for inline mark-up.
The addition of the @property attribute is new, but it’s not that difficult to understand–it’s just the equivalent of @rel and @rev for inline text, or the @name attribute on the meta element.
4. Use @about to indicate that something other than the document is the subject.
This is also new, but we feel it is extremely intuitive. @about sets a context for some block of metadata, allowing you to collect together statements that concern some external resource, such as an image, a sound file, a license, a friend, etc.
5. Use <meta> and <link> anywhere in the document.
Also new, but also intuitive; everyone is familiar with using meta and link to add metadata to their documents, and all this new usage does is to allow these elements to be used in a meaningful way elsewhere. It means that now you can indicate the source of a quote, the license for an image, the name of the photographer who took the photo, and so on, all inline within your document.
In summary, RDFa gently builds on HTML best practice, but has the power to ramp up to full-blown RDF. In fact, it even supports reification and bnodes, although if you don’t know what they are, don’t lose any sleep over it!