RDFa Core 1.1
RDFa Core 1.1
Syntax and processing rules for embedding RDF through attributes
W3C
Working Draft 22 April 2010
This version:
Latest published version:
Latest recommendation:
Editors:
Ben Adida
Creative Commons
Mark Birbeck
webBackplane
Shane McCarron
Applied Testing and Technology, Inc.
Ivan Herman
W3C
This document is also available in these non-normative formats:
PostScript version
and
PDF version
W3C
MIT
ERCIM
Keio
), All Rights Reserved.
W3C
liability
trademark
and
document use
rules apply.
Abstract
The current Web is primarily made up of an enormous number of documents
that have been created using HTML. These documents contain significant
amounts of structured data, which is largely unavailable to tools and
applications. When publishers can express this data
more completely, and when tools can read it, a new world of user
functionality becomes available, letting users transfer structured
data between applications and web sites, and allowing browsing applications
to improve the user experience: an event on a web page can
be directly imported into a user's desktop calendar; a license on a
document can be detected so that users can be informed of their rights
automatically; a photo's creator, camera setting information,
resolution, location and topic can be published as easily as the original
photo itself, enabling structured search and sharing.
RDFa Core is a specification for attributes to express structured data
in any markup language.
The embedded
data already available in the markup language (e.g., XHTML)
is reused by the RDFa markup, so that
publishers don't need to repeat significant data in the document
content.
The underlying abstract
representation is RDF [
RDF-PRIMER
], which lets publishers build their own
vocabulary, extend others, and evolve their vocabulary with maximal
interoperability over time. The expressed structure is closely tied
to the data, so that rendered data can be copied and pasted along
with its relevant structure.
The rules for interpreting the data are generic, so that there is no
need for different rules for different formats; this allows authors
and publishers of data to define their own formats without having to
update software, register formats via a central authority, or worry
that two formats may interfere with each other.
RDFa shares some of the same goals with microformats [
MICROFORMATS
].
Whereas microformats
specify both a syntax for embedding structured data into HTML
documents and a vocabulary of specific terms for each microformat,
RDFa specifies only a syntax and relies on independent specification
of terms (often called vocabularies or taxonomies) by others. RDFa allows terms
from multiple independently-developed vocabularies to be freely
intermixed and is designed such that the language can be parsed
without knowledge of the specific vocabulary being used.
This document is a detailed syntax specification for RDFa, aimed
at:
those looking to create an RDFa Processor, and who therefore need a
detailed description of the parsing rules;
those looking to recommend the use of RDFa within their
organization, and who would like to create some guidelines for their
users;
anyone familiar with RDF, and who wants to understand more about what
is happening 'under the hood', when an RDFa Processor runs.
For those looking for an introduction to the use of RDFa and some real-world
examples, please consult the
RDFa Primer
How to Read this Document
First, if you are not familiar with either RDFa
or
RDF, and simply
want to add RDFa to your documents, then you may find the RDFa Primer
RDFA-PRIMER
] to be a better introduction.
If you are already familiar with RDFa, and you want to examine the processing
rules — perhaps to create an RDFa Processor — then you'll find the
Processing Model
section of most interest.
It contains an overview of each of the processing steps, followed by more detailed
sections, one for each rule.
If you are not familiar with RDFa, but you
are
familiar with RDF,
then you might find reading the
Syntax Overview
useful,
before looking at the
Processing Model
since it gives a range of examples
of markup that use RDFa. Seeing some examples first should make reading the
processing rules easier.
If you are not familiar with RDF, then you might want to take a look at
the section on
RDF Terminology
before trying to do too much with RDFa. Although RDFa is designed to
be easy to author — and authors don't need to understand RDF to use it —
anyone writing
applications that
consume
RDFa will need to understand RDF. There is a lot
of material about RDF on the web, and a growing range of tools that support RDFa,
this document only contains
enough background on RDF to make the goals of RDFa more clear.
Status of This Document
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current
W3C
publications and the latest revision of this technical report can be found in the
W3C
technical reports index
at http://www.w3.org/TR/.
This is a revision of RDFa Syntax 1.0 [
RDFA-SYNTAX
].
Once development is complete, if accepted by the
W3C
membership, this document will supersede the
previous
Recommendation
. There are a number of substantive differences between
this version and its predecessor, including:
The removal of the specific rules for XHTML - these are now defined in XHTML+RDFa
XHTML-RDFA
An expansion of the datatypes of some RDFa attributes so that they
can contain Terms, CURIES, or URIs.
The ability to change the default vocabulary when no 'prefix' is specified on a
CURIE.
The ability to reference external RDFa Profile documents; these are used to ease authoring by creating vocabulary term collections.
sample test harness
is available. This set of tests is
not intended to be exhaustive. Users may find the tests to
be useful examples of RDFa usage.
This document was published by the
RDFa Working Group
as a First Public Working Draft. This document is intended to become a
W3C
Recommendation. If you wish to make comments regarding this document, please send them to
public-rdfa-wg@w3.org
archives
). All feedback is welcome.
Publication as a Working Draft does not imply endorsement by the
W3C
Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the
5 February 2004
W3C
Patent Policy
W3C
maintains a
public list of any patent disclosures
made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
Essential Claim(s)
must disclose the information in accordance with
section 6 of the
W3C
Patent Policy
Table of Contents
1.
Motivation
2.
Syntax Overview
2.1
The RDFa Attributes
2.2
Examples
3.
RDF Terminology
3.1
Statements
3.2
Triples
3.3
URI references
3.4
Plain literals
3.5
Typed literals
3.6
Turtle
3.7
Graphs
3.8
Compact URIs
3.9
Markup Fragments and RDFa
3.10
A description of RDFa in RDF terms
4.
Conformance
4.1
RDFa Processor Conformance
4.2
RDFa Host Language Conformance
5.
Attributes and Syntax
6.
CURIE Syntax Definition
7.
Processing Model
7.1
Overview
7.2
Evaluation Context
7.3
Chaining
7.4
CURIE and URI Processing
7.4.1
Scoping of Prefix Mappings
7.4.2
General Use of CURIEs in Attributes
7.4.3
General Use of Terms in Attributes
7.4.4
Use of CURIEs in Specific Attributes
7.4.5
Referencing Blank Nodes
7.5
Sequence
8.
RDFa Processing in detail
8.1
Changing the evaluation context
8.1.1
Setting the current subject
8.1.1.1
The current document
8.1.1.2
Using
@about
8.1.1.3
Using
@src
8.1.1.4
Creating a new item with
@typeof
8.1.1.5
Determining the subject with neither
@about
nor
@typeof
8.2
Completing 'incomplete triples'
8.3
Object resolution
8.3.1
Literal object resolution
8.3.1.1
Plain Literals
8.3.1.2
Typed literals
8.3.1.3
XML Literals
8.3.2
URI object resolution
8.3.2.1
Using
@resource
to set the object
8.3.2.2
Using
@href
8.3.2.3
Incomplete triples
9.
RDFa Profiles
A.
CURIE Datatypes
A.1
XML Schema Definition
A.2
XML DTD Definition
B.
The RDFa Term Assignment Vocabulary
C.
Change History
D.
Acknowledgments
E.
References
E.1
Normative references
E.2
Informative references
1.
Motivation
This section is non-normative.
RDF/XML [
RDF-SYNTAX
] provides
sufficient flexibility to represent all of the abstract concepts in
RDF [
RDF-CONCEPTS
]. However, it
presents a number of challenges; first it is difficult or impossible to
validate documents that contain RDF/XML using XML Schemas or DTDs,
which therefore makes it difficult to import RDF/XML into other markup
languages. Whilst newer schema languages such as RELAX NG [
RELAXNG-SCHEMA
do provide a way to validate documents
that contain arbitrary RDF/XML, it will be a while before they gain
wide support.
Second, even if one could add RDF/XML directly into an XML
dialect like XHTML, there would be significant data duplication
between the rendered data and the RDF/XML structured data. It would
be far better to add RDF to a document without repeating the
document's existing data. For example, an XHTML document that
explicitly renders its author's name in the text—perhaps as a
byline on a news site—should not need
to repeat this name for the RDF expression of the same concept: it
should be possible to supplement the existing markup in such a way
that it can also be interpreted as RDF.
Another reason for aligning the rendered data with the structured data
is that it is highly beneficial to express the web data's
structure 'in context'; as users often want to transfer structured data from one
application to another, sometimes to or from a non-web-based
application, the user experience can be enhanced.
For example, information about specific
rendered data could be presented to the user via 'right-clicks' on an
item of interest.
In the past, many attributes were 'hard-wired' directly into
the markup language to represent specific concepts. For example, in
XHTML 1.1 [
XHTML11
] and HTML [
HTML401
there is
@cite
; the
attribute allows an author to add information to a document which
is used to indicate the origin of a quote.
However, these 'hard-wired' attributes make it difficult to
define a generic process for extracting metadata from any document
since an RDFa Processor would need to know about each of the special attributes.
One motivation for RDFa has been to devise a means by which documents
can be augmented with metadata in a general, rather than hard-wired, manner.
This has been achieved by creating a fixed set of attributes and parsing rules,
but allowing those attributes to contain properties from any of a number of the
growing range of available RDF vocabularies. In most cases the
values
of those properties
are the information that is already in an author's XHTML document.
RDFa alleviates the
pressure on markup language designers to anticipate all the structural
requirements users of their language might have, by
outlining a new syntax for RDF that
relies only on attributes. By adhering to the concepts and rules in this specification,
language designers can import RDFa into their environment with a minimum of hassle and
be confident that semantic data will be extractable from their documents
by conforming processors.
2.
Syntax Overview
This section is non-normative.
The following examples are intended to help readers who are not familiar with RDFa to
quickly get a sense of how it works.
For a more thorough introduction, please read the RDFa Primer [
RDFA-PRIMER
].
For brevity, in the following examples and throughout this document, assume that the following
vocabulary prefixes have been defined:
biblio:
cc:
dbp:
dbr:
dc:
ex:
foaf:
rdf:
rdfa:
rdfs:
taxo:
xhv:
xsd:
2.1
The RDFa Attributes
RDFa makes use of a number of commonly found attributes, as well as providing a few new ones. Attributes
that already exist in widely deployed languages (e.g., HTML) have the same meaning they
always did, although their syntax has been slightly modified
in some cases.
For example, in (X)HTML,
@rel
already defines the relationship between one document and another. However,
in (X)HTML there is no clear way to add new values; RDFa sets out to explicitly solve this problem, and does so by
allowing URIs as
values. It also introduces the idea of 'compact URIs' — referred to as CURIEs in this
document — which allow a full URI value to be
expressed succinctly. For a complete list of RDFa attribute
names and syntax, see
Attributes and
Syntax
2.2
Examples
As an (X)HTML author you will already be familiar with using
meta
and
link
to add additional information to your documents:


Page 7




...

RDFa makes use of this concept, enhancing it with the ability to make use of other vocabularies
by using compact URIs:
xmlns="http://www.w3.org/1999/xhtml"
prefix="foaf: http://xmlns.com/foaf/0.1/
dc: http://purl.org/dc/elements/1.1/"

My home-page



...

RDFa supports the use of
@rel
and
@rev
on
any element. This is even more useful when with the addition of support for different
vocabularies:
This document is licensed under a
prefix="cc: http://creativecommons.org/ns#"
rel="cc:license"
href="http://creativecommons.org/licenses/by-nc-nd/3.0/">
Creative Commons License
.
Not only can URLs in the document be re-used to provide metadata, but so can inline text:
xmlns="http://www.w3.org/1999/xhtml"
prefix="cal: http://www.w3.org/2002/12/cal/ical#"
Jo's Friends and Family Blog


I'm holding
property="cal:summary"
one last summer Barbecue
,
on September 16th at 4pm.




If some displayed text is different to the actual 'value' it represents,
more precise values can be added, which can optionally include datatypes:
xmlns="http://www.w3.org/1999/xhtml"
prefix="cal: http://www.w3.org/2002/12/cal/ical#
xsd: http://www.w3.org/2001/XMLSchema"
Jo's Friends and Family Blog


I'm holding

one last summer Barbecue
,
on
property="cal:dtstart"
content="2015-09-16T16:00:00-05:00"
datatype="xsd:dateTime"
September 16th at 4pm
.




In many cases a block of markup will contain a number of properties that relate to the same
item; it's possible with RDFa to indicate the type of that item:
xmlns="http://www.w3.org/1999/xhtml"
prefix="cal: http://www.w3.org/2002/12/cal/ical#
xsd: http://www.w3.org/2001/XMLSchema"
Jo's Friends and Family Blog

typeof="cal:Vevent"
I'm holding

one last summer Barbecue
,
on
datatype="xsd:dateTime">
September 16th at 4pm
.




RDFa allows the document to contain metadata information about other documents and resources:
xmlns="http://www.w3.org/1999/xhtml"
prefix="biblio: http://example.org/
dc: http://purl.org/dc/elements/1.1/"

Books by Marco Pierre White


I think White's book
'about="urn:ISBN:0091808189"
typeof="biblio:book"
property="dc:title"
Canteen Cuisine
'
is well worth getting since although it's quite advanced stuff, he
makes it pretty easy to follow. You might also like
about="urn:ISBN:1596913614"
typeof="biblio:book"
property="dc:description"
White's autobiography
.


When dealing with small amounts of markup, it is sometimes easier
to use full URIs,
rather than CURIEs. The previous example can also be written as
follows:


Books by Marco Pierre White


I think White's book
'about="urn:ISBN:0091808189"
typeof="http://example.org/book"
property="http://purl.org/dc/elements/1.1/title"
>Canteen Cuisine'
is well worth getting since although it's quite advanced stuff, he
makes it pretty easy to follow. You might also like
about="urn:ISBN:1596913614"
typeof="http://example.org/book"
property="http://purl.org/dc/elements/1.1/description"
>White's autobiography.


A simple way of defining a portion of a document to use FOAF terms is to use
@vocab
to define a default vocabulary URI:
vocab="http://xmlns.com/foaf/0.1/"
about="#me">
My name is property="name"
>John Doe and my blog is called
rel="homepage"
href="http://example.org/blog/">Understanding Semantics.