RDFa Core 1.1 - Third Edition
RDFa Core 1.1 - Third Edition
Syntax and processing rules for embedding RDF through attributes
W3C
Recommendation
17 March 2015
This version:
Latest published version:
Implementation report:
Previous version:
Previous Recommendation:
Editors:
Ben Adida
, Creative Commons,
ben@adida.net
Mark Birbeck
, webBackplane,
mark.birbeck@webBackplane.com
Shane McCarron
, Applied Testing and Technology, Inc.,
shane@aptest.com
Ivan Herman
W3C
ivan@w3.org
Please check the
errata
for any errors or issues
reported since publication.
This document is also available in these non-normative formats:
Diff from Previous Recommendation
PostScript version
, and
PDF version
The English version of this specification is the only normative version. Non-normative
translations
may also be available.
2007-2015
W3C
MIT
ERCIM
Keio
Beihang
).
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., HTML) can often be 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 [
RDF11-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 integrate RDFa into a new markup language;
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.
Note
RDFa is a way of expressing
RDF
-style
relationships using simple attributes in existing markup languages
such as HTML. RDF is fully internationalized, and permits the use of
Internationalized Resource Identifiers, or IRIs. You will see the term
'IRI' used throughout this specification. Even if you are not familiar
with the term IRI, you probably have seen the term 'URI' or 'URL'.
IRIs are an extension of URIs that permits the use of characters
outside those of plain ASCII. RDF allows the use of these characters,
and so does RDFa. This specification has been careful to use the
correct term, IRI, to make it clear that this is the case.
Note
Even though this specification exclusively
references IRIs, it is possible that a Host Language will
restrict the syntax for its attributes to a subset of IRIs
(e.g.,
@href
in HTML5). Regardless of
validation constraints in Host Languages, an RDFa Processor
is capable of processing IRIs.
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
This is an Editorial Revision of the
Recommendation published on the 22nd of August, 2013
. That document was a revision of RDFa Syntax 1.0 [
RDFA-SYNTAX
]. There are a number of substantive differences
between this version and Version 1.0, 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 Absolute IRIs.
Host languages are permitted to define collections of default terms,
default prefix mappings, and a default vocabulary.
The ability to define a default vocabulary to use for Terms that are
undefined.
Terms are required to be compared in a case-insensitive manner.
A richer behavior of the @property attribute, that can replace, in many cases the
@rel attribute.
A slightly different handling of @typeof, making it better adapted to practical usage.
There is a more thorough list of changes in
Changes
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 Recommendation.

If you wish to make comments regarding this document, please send them to
public-rdfa@w3.org
archives
).

All comments are welcome.
Please see the Working Group's
implementation
report
This document has been reviewed by
W3C
Members, by software developers, and by other
W3C
groups and interested parties, and is endorsed by the Director as a
W3C
Recommendation.
It is a stable document and may be used as reference material or cited from another
document.
W3C
's role in making the Recommendation is to draw attention to the
specification and to promote its widespread deployment. This enhances the functionality
and interoperability of the Web.
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
This document is governed by the
14 October 2005
W3C
Process Document
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
IRI References
3.4
Plain Literals
3.5
Typed Literals
3.6
Turtle
3.7
Graphs
3.8
Compact URI Expressions
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
4.3
XML+RDFa Document Conformance
5.
Attributes and Syntax
5.1
Roles of attributes
5.2
White space within attribute values
6.
CURIE Syntax Definition
6.1
Why CURIEs and not QNames?
7.
Processing Model
7.1
Overview
7.2
Evaluation Context
7.3
Chaining
7.4
CURIE and IRI 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
7.6
Processor Status
7.6.1
Accessing the Processor Graph
7.6.2
Processor Graph Terms
7.7
Vocabulary Expansion
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
Typing resources with
@typeof
8.1.1.3.1
Chaining with
@property
and
@typeof
8.1.1.4
Determining the subject with neither
@about
nor
@typeof
8.1.1.4.1
Inheriting subject from
@resource
8.1.1.4.2
Inheriting an anonymous subject
8.2
Completing incomplete triples
8.3
Object resolution
8.3.1
Object resolution for the
@property
attribute
8.3.1.1
Plain Literals
8.3.1.1.1
Language Tags
8.3.1.2
Typed Literals
8.3.1.3
XML Literals
8.3.2
IRI object resolution
8.3.2.1
Using
@resource
to set the object
8.3.2.2
Using
@href
or
@src
to set the object
8.3.2.3
Incomplete triples
8.4
List Generation
9.
RDFa Initial Contexts
10.
RDFa Vocabulary Expansion
10.1
Details of the RDFa Vocabulary Expansion
10.1.1
RDFa Vocabulary Entailment
10.2
Vocabulary Expansion Control of RDFa Processors
10.2.1
Notes to RDFa Vocabulary Implementations and Publishing
A.
CURIE Datatypes
A.1
XML Schema Definition
A.2
XML DTD Definition
B.
The RDFa Vocabulary
B.1
Term and Prefix Assignments
B.2
Processor Graph Reporting
B.3
Term for vocabulary expansion
C.
Changes
C.1
Major differences since the Last Published Recommentation
C.2
Major differences with RDFa Syntax 1.0
D.
Acknowledgments
E.
References
E.1
Normative references
E.2
Informative references
1.
Motivation
This section is non-normative.
RDF/XML [
RDF-SYNTAX-GRAMMAR
] provides sufficient flexibility to represent all
of the abstract concepts in RDF. 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. Moreover, organizations that generate
a lot of content (e.g., news outlets) find it easier to embed the
semantic data inline than to maintain it separately.
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 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
].
In RDF, it is common for people to shorten vocabulary terms via
abbreviated IRIs that use a 'prefix' and a 'reference'. This mechanism
is explained in detail in the section titled Compact URI Expressions.
The examples throughout this document assume that the following
vocabulary
prefixes
have been defined:
bibo:
cc:
dbp:
dbp-owl:
dbr:
dc:
ex:
foaf:
owl:
rdf:
rdfa:
rdfs:
xhv:
xsd:
Note
In some of the examples below we have used IRIs with
fragment identifiers that are local to the document containing the RDFa
fragment identifiers shown (e.g., '
about="#me"
'). This
idiom, which is also used in RDF/XML [
RDF-SYNTAX-GRAMMAR
] and other
RDF serializations, gives a simple way to 'mint' new IRIs for entities
described by RDFa and therefore contributes considerably to the
expressive power of RDFa. The precise meaning of IRIs which include
fragment identifiers when they appear in RDF graphs is given in
Section 7 of [
RDF-SYNTAX-GRAMMAR
]. To ensure that such fragment
identifiers can be interpreted correctly, media type registrations
for markup languages that incorporate RDFa should directly or
indirectly reference this specification.
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 there is no clear way to add new
@rel
values; RDFa sets out to explicitly solve this problem, and does so by
allowing IRIs as values. It also introduces the concepts of
and '
compact URI expressions
— referred to
as CURIEs in this document — which allow a full IRI value to be
expressed succinctly. For a complete list of RDFa attribute names and
syntax, see
Attributes and Syntax
2.2
Examples
In (X)HTML, authors can include metadata and relationships concerning
the current document by using the
meta
and
link
elements (in these examples, XHTML+RDFa [
XHTML-RDFA
] is used).
For example, the author of the page along with the pages
preceding and following the current page can be expressed using the
link and meta elements:
Example 1


Page 7




...

RDFa makes use of this concept, enhancing it with the ability to make
use of other vocabularies by using full IRIs:
Example 2


My home-page



...

Because using full IRIs like those above can be cumbersome, RDFa also
permits the use of
compact URI expressions
so an author can use a shorthand to reference terms in multiple
vocabularies:
Example 3
xmlns="http://www.w3.org/1999/xhtml"
prefix="foaf: http://xmlns.com/foaf/0.1/
dc: http://purl.org/dc/terms/"

My home-page



...

RDFa supports the use of
@rel
and
@rev
on
any element. This is even more useful with the addition of support for
different vocabularies:
Example 4
This document is licensed under the
prefix="cc: http://creativecommons.org/ns#"
rel="cc:license"
href="http://creativecommons.org/licenses/by-nc-nd/3.0/"
>Creative Commons By-NC-ND License.
Not only can IRIs in the document be re-used to provide metadata, but
so can inline text when used with
@property
Example 5
xmlns="http://www.w3.org/1999/xhtml"
prefix="dc: http://purl.org/dc/terms/"
My Home Page

property="dc:title"
>My home-page

Last modified: 16 September 2015




If some displayed text is different from the actual 'value' it
represents, a more precise value can be added using
@content
. A value can also optionally
be typed using
@datatype
Example 6
xmlns="http://www.w3.org/1999/xhtml"
prefix="xsd: http://www.w3.org/2001/XMLSchema#
dc: http://purl.org/dc/terms/"
My Home Page

My home-page


Last modified: content="2015-09-16T16:00:00-05:00"
datatype="xsd:dateTime"
>16 September 2015
.




RDFa allows the document to contain metadata information about other
documents and resources:
Example 7
xmlns="http://www.w3.org/1999/xhtml"
prefix="bibo: http://purl.org/ontology/bibo/
dc: http://purl.org/dc/terms/"

Books by Marco Pierre White


I think White's book
'about="urn:ISBN:0091808189"
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"
property="dc:description"
>White's autobiography.


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 using
@typeof
Example 8
xmlns="http://www.w3.org/1999/xhtml"
prefix="bibo: http://purl.org/ontology/bibo/
dc: http://purl.org/dc/terms/"

Books by Marco Pierre White


I think White's book
'typeof="bibo: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="bibo:Book"
property="dc:description"
>White's autobiography.


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


Books by Marco Pierre White


I think White's book
'about="urn:ISBN:0091808189"
typeof="http://purl.org/ontology/bibo/Book"
property="http://purl.org/dc/terms/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://purl.org/ontology/bibo/Book"
property="http://purl.org/dc/terms/description"
>White's autobiography.


A simple way of defining a portion of a document using terms from a
specific vocabulary is to use
@vocab
to define a default
vocabulary IRI. For example, to use FOAF terms:
Example 10
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.