This
document
is
also
available
in
this
these
non-normative
format:
formats:
Diff
from
previous
Editor's
Draft
,
PostScript
version
,
and
PDF
version
.
Copyright © 2007-2010 W3C ® ( MIT , ERCIM , Keio ), All Rights Reserved. W3C liability , trademark and document use rules apply.
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
use
cases
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:
For those looking for an introduction to the use of RDFa and some real-world examples, please consult the RDFa Primer .
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
a
parser
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
clearer.
And
finally,
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.
more
clear.
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
an
early
editors
draft
for
discussion
purposes.
Once
development
is
complete,
if
accepted
by
the
W3C
membership,
this
document
will
supercede
the
previous
version
Recommendation
.
There
are
a
number
of
substantive
differences
between
this
version
and
its
predecessor,
including:
A 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 an Editor's Draft. If you wish to make comments regarding this document, please send them to public-rdfa-wg@w3.org ( subscribe , archives ). All feedback is welcome.
Publication as a Editor's 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 .
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
a
parser
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
general,
rather
than
hard-wired
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.
The
In
most
cases
the
values
of
those
properties
are
in
most
cases
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.
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: | http://example.org/biblio/0.1 |
cc: | http://creativecommons.org/ns# |
dbp: | http://dbpedia.org/property/ |
dbr: | http://dbpedia.org/resource/ |
dc: |
|
ex: | http://example.org/ |
foaf: | http://xmlns.com/foaf/0.1/ |
rdf: | http://www.w3.org/1999/02/22-rdf-syntax-ns# |
rdfa: | http://www.w3.org/ns/rdfa# |
rdfs: | http://www.w3.org/2000/01/rdf-schema# |
taxo: | http://purl.org/rss/1.0/modules/taxonomy/ |
xhv: | http://www.w3.org/1999/xhtml/vocab# |
xsd: | http://www.w3.org/2001/XMLSchema# |
RDFa
makes
use
of
a
number
of
(X)HTML
commonly
found
attributes,
as
well
as
providing
a
few
new
ones.
Attributes
that
already
exist
in
(X)HTML
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
.
As
an
(X)HTML
author
you
will
already
be
familiar
with
using
meta
and
link
to
add
additional
information
to
your
documents:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Page 7</title> <meta name="author" content="Mark Birbeck" /> <link rel="prev" href="page6.html" /> <link rel="next" href="page8.html" /> </head> <body>...</body> </html>
RDFa makes use of this concept, enhancing it with the ability to make use of other vocabularies by using compact URIs:
<html xmlns="http://www.w3.org/1999/xhtml"prefix="foaf: http://xmlns.com/foaf/0.1/ dc: http://purl.org/dc/elements/1.1/" > <head> <title>My home-page</title> <meta property="dc:creator" content="Mark Birbeck" /> <link rel="foaf:topic" href="http://www.formsPlayer.com/#us" /> </head> <body>...</body> </html>
Although
not
widely
used,
(X)HTML
already
RDFa
supports
the
use
of
@rel
and
@rev
on
the
a
any
element.
This
becomes
is
even
more
useful
in
RDFa
when
with
the
addition
of
support
for
different
vocabularies:
This document is licensed under a<a<a prefix="cc: http://creativecommons.org/ns#" rel="cc:license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/"> Creative Commons License </a>.
Not only can URLs in the document be re-used to provide metadata, but so can inline text:
<html xmlns="http://www.w3.org/1999/xhtml"prefix="cal: http://www.w3.org/2002/12/cal/ical#" > <head><title>Jo's Friends and Family Blog</title></head> <body> <p> I'm holding <span property="cal:summary"> one last summer Barbecue </span>, on September 16th at 4pm. </p> </body> </html>
If some displayed text is different to the actual 'value' it represents, more precise values can be added, which can optionally include datatypes:
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:cal="http://www.w3.org/2002/12/cal/ical#"prefix="cal: http://www.w3.org/2002/12/cal/ical# xsd: http://www.w3.org/2001/XMLSchema" > <head><title>Jo's Friends and Family Blog</title></head> <body> <p> I'm holding <span property="cal:summary"> one last summer Barbecue </span>, on<span<span property="cal:dtstart" content="2015-09-16T16:00:00-05:00" datatype="xsd:dateTime"> September 16th at 4pm </span>. </p> </body> </html>
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:
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:cal="http://www.w3.org/2002/12/cal/ical#" xmlns:xsd="http://www.w3.org/2001/XMLSchema"prefix="cal: http://www.w3.org/2002/12/cal/ical# xsd: http://www.w3.org/2001/XMLSchema" > <head><title>Jo's Friends and Family Blog</title></head> <body> <p typeof="cal:Vevent"> I'm holding <span property="cal:summary"> one last summer Barbecue </span>, on<span property="cal:dtstart" content="2007-09-16T16:00:00-05:00"<span property="cal:dtstart" content="2015-09-16T16:00:00-05:00" datatype="xsd:dateTime"> September 16th at 4pm </span>. </p> </body> </html>
The
metadata
features
available
in
(X)HTML
only
allow
information
to
be
expressed
about
the
document
itself.
RDFa
allows
the
document
to
contain
metadata
information
about
other
documents
and
resources:
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:biblio="http://example.org/" xmlns:dc="http://purl.org/dc/elements/1.1/"prefix="biblio: http://example.org/ dc: http://purl.org/dc/elements/1.1/" > <head> <title>Books by Marco Pierre White</title> </head> <body> I think White's book '<span about="urn:ISBN:0091808189" typeof="biblio:book" property="dc:title"> Canteen Cuisine </span>' is well worth getting since although it's quite advanced stuff, he makes it pretty easy to follow. You might also like <span about="urn:ISBN:1596913614" typeof="biblio:book" property="dc:description"> White's autobiography </span>. </body> </html>
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:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Books by Marco Pierre White</title> </head> <body> I think White's book '<spanabout="urn:ISBN:0091808189" typeof="http://example.org/book" property="http://purl.org/dc/elements/1.1/title"about="urn:ISBN:0091808189" typeof="http://example.org/book" property="http://purl.org/dc/elements/1.1/title" >Canteen Cuisine</span>' is well worth getting since although it's quite advanced stuff, he makes it pretty easy to follow. You might also like <spanabout="urn:ISBN:1596913614" typeof="http://example.org/book" property="http://purl.org/dc/elements/1.1/description"about="urn:ISBN:1596913614" typeof="http://example.org/book" property="http://purl.org/dc/elements/1.1/description" >White's autobiography</span>. </body> </html>
A simple way of defining a portion of a document to use FOAF terms is to use @vocab to define a default vocabulary URI:
<div vocab="http://xmlns.com/foaf/0.1/" about="#me"> My name is <span property="name">John Doe</span> and my blog is called <a rel="homepage" href="http://example.org/blog/">Understanding Semantics</a>. </div>
the following triples will be generated:
@prefix foaf: <http://xmlns.com/foaf/0.1/> .<#me> foaf:name "John Doe" ;<#me> foaf:name "John Doe" ; foaf:homepage <http://example.org/blog/> .
RDFa
also
permits
external
definition
of
collections
of
prefixes.
The
following
RDFa
Profile
document,
residing
at
http://www.example.org/vocab-rdf-dc.html
defines
the
standard
RDF
prefixes
as
well
as
the
Dublin
Core
vocabulary
prefix
in
RDFa.
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:rdfa="http://www.w3.org/ns/rdfa#">prefix="rdfa: http://www.w3.org/ns/rdfa#"> <head> ... </head> <body> <p>This is an example to defining the standard RDF and Dublin Core prefixes </p><p typeof="rdfa:PrefixMapping"> The "<span property="rdfa:prefix">rdf</span>" prefix can<p typeof="rdfa:PrefixMapping"> The "<span property="rdfa:prefix">rdf</span>" prefix can be used for the URI:"<span property="rdfa:uri">http://www.w3.org/1999/02/22-rdf-syntax-ns#</span>".</p>"<span property="rdfa:uri">http://www.w3.org/1999/02/22-rdf-syntax-ns#</span>".</p> <p typeof="_:a">The "<span property="rdfa:prefix">rdfs</span>" prefix canThe "<span property="rdfa:prefix">rdfs</span>" prefix can be used for the URI:"<span property="rdfa:uri">http://www.w3.org/2000/01/rdf-schema#</span>".</p>"<span property="rdfa:uri">http://www.w3.org/2000/01/rdf-schema#</span>".</p><p typeof="rdfa:PrefixMapping"> The "<span property="rdfa:prefix">dc</span>" prefix can<p typeof="rdfa:PrefixMapping"> The "<span property="rdfa:prefix">dc</span>" prefix can be used for the URI:"<span property="rdfa:uri">http://dublincore.org/documents/dcmi-terms/</span>".</p>"<span property="rdfa:uri">http://dublincore.org/documents/dcmi-terms/</span>".</p> </html>
(Note
that
typing
the
blank
node
with
rdfa:PrefixMapping
is
not
necessary,
as
shown
by
the
association
of
the
rdfs
.)
Using @profile , the following RDFa snippet:
<p about="http://www.example.org/doc"profile="http://www.example.org/vocab-rdf-dc">profile="http://www.example.org/vocab-rdf-dc"> <span property="dc:title">title of the document</span> <span property="rdfs:comment">and this is a longer comment on the same document</span> </p>
yields the following triples:
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dc: <http://dublincore.org/documents/dcmi-terms/> . <http://www.example.org/doc> dc:title "title of the document" ; rdfs:comment "and this is a longer comment on the same document" .
It
is
also
possible
to
define
terms.
Given
the
following
RDFa
Profile
document
at
http://www.example.org/vocab-foaf-terms.html
:
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:rdfa="http://www.w3.org/ns/rdfa#">prefix="rdfa: http://www.w3.org/ns/rdfa#"> <head> <title>Example RDFa Vocabulary</title> </head> <body> <p> This is an example RDFa vocabulary that makes it easier to use the foaf:name and foaf:homepage terms. </p> <p typeof="_:a">The "<span property="rdfa:term">name</span>" term canThe "<span property="rdfa:term">name</span>" term can be used for the URI:"<span property="rdfa:uri">http://xmlns.com/foaf/0.1/name</span>".</p>"<span property="rdfa:uri">http://xmlns.com/foaf/0.1/name</span>".</p> <p typeof="_:b">The "<span property="rdfa:term">homepage</span>" term canThe "<span property="rdfa:term">homepage</span>" term can be used for the URI:"<span property="rdfa:uri">http://xmlns.com/foaf/0.1/homepage</span>".</p>"<span property="rdfa:uri">http://xmlns.com/foaf/0.1/homepage</span>".</p> </body> </html>
and the following HTML markup:
<div profile="http://www.example.org/vocab-foaf-terms" about="#me">My name is <span property="name">John Doe</span> and my blog is called <a rel="homepage"My name is <span property="name">John Doe</span> and my blog is called <a rel="homepage" href="http://example.org/blog/">Understanding Semantics</a>. </div>
the following triples will be generated:
@prefix foaf: <http://xmlns.com/foaf/0.1/> .<#me> foaf:name "John Doe" ;<#me> foaf:name "John Doe" ; foaf:homepage <http://example.org/blog/> .
This section is non-normative.
The
previous
section
gave
examples
of
typical
markup
in
order
to
illustrate
what
the
structure
of
RDFa
looks
like.
But
markup.
However,
what
RDFa
represents
is
RDF.
In
order
to
author
RDFa
you
do
not
need
to
understand
RDF,
although
it
would
certainly
help.
However,
if
you
are
building
a
system
that
consumes
the
RDF
output
of
a
language
that
supports
RDFa
you
will
almost
certainly
need
to
understand
RDF.
This
section
introduces
the
basic
concepts
and
terminology
of
RDF.
For
a
more
thorough
explanation
of
RDF,
please
refer
to
the
RDF
Concepts
document
[
RDF-CONCEPTS
]
and
the
RDF
Sytax
Document
[
RDF-SYNTAX
].
The structured data that RDFa provides access to is a collection of statements . A statement is a basic unit of information that has been constructed in a specific format to make it easier to process. In turn, by breaking large sets of information down into a collection of statements, even very complex metadata can be processed using simple rules.
To illustrate, suppose we have the following set of facts:
Albert was born on March 14, 1879, in Germany. There is a picture of him at the web address, http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg.
This would be quite difficult for a machine to interpret, and it is certainly not in a format that could be passed from one data application to another. However, if we convert the information to a set of statements it begins to be more manageable. The same information could therefore be represented by the following shorter 'statements':
Albert was born on March 14, 1879. Albert was born in Germany. Albert has a picture at http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg.
To make this information machine-processable, RDF defines a structure for these statements. A statement is formally called a triple , meaning that it is made up of three components. The first is the subject of the triple, and is what we are making our statements about . In all of these examples the subject is 'Albert'.
The second part of a triple is the property of the subject that we want to define. In the examples here, the properties would be 'was born on', 'was born in', and 'has a picture at'. These are more usually called predicates in RDF.
The final part of a triple is called the object . In the examples here the three objects have the values 'March 14, 1879', 'Germany', and 'http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg'.
Breaking complex information into manageable units helps us be specific about our data, but there is still some ambiguity. For example, which 'Albert' are we talking about? If another system has more facts about 'Albert', how could we know whether they are about the same person, and so add them to the list of things we know about that person? If we wanted to find people born in Germany, how could we know that the predicate 'was born in' has the same purpose as the predicate 'birthplace' that might exist in some other system? RDF solves this problem by replacing our vague terms with URI references .
URIs are most commonly used to identify web pages, but RDF makes use of them as a way to provide unique identifiers for concepts. For example, we could identify the subject of all of our statements (the first part of each triple) by using the DBPedia [ http://dbpedia.org ] URI for Albert Einstein, instead of the ambiguous string 'Albert':
<http://dbpedia.org/resource/Albert_Einstein> has the name Albert Einstein. <http://dbpedia.org/resource/Albert_Einstein> was born on March 14, 1879. <http://dbpedia.org/resource/Albert_Einstein> was born in Germany. <http://dbpedia.org/resource/Albert_Einstein> has a picture at http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg.
URI references are also used to uniquely identify the objects in metadata statements (the third part of each triple). The picture of Einstein is already a URI, but we could also use a URI to uniquely identify the country Germany. At the same time we'll indicate that the name and date of birth really are literals (and not URIs), by putting quotes around them:
<http://dbpedia.org/resource/Albert_Einstein> has the name "Albert Einstein". <http://dbpedia.org/resource/Albert_Einstein> was born on "March 14, 1879". <http://dbpedia.org/resource/Albert_Einstein> was born in <http://dbpedia.org/resource/Germany>. <http://dbpedia.org/resource/Albert_Einstein> has a picture at < http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg > .
URI references are also used to ensure that predicates are unambiguous; now we can be sure that 'birthplace', 'place of birth', 'Lieu de naissance' and so on, all mean the same thing:
<http://dbpedia.org/resource/Albert_Einstein> <http://xmlns.com/foaf/0.1/name> "Albert Einstein". <http://dbpedia.org/resource/Albert_Einstein> <http://dbpedia.org/property/dateOfBirth> "March 14, 1879". <http://dbpedia.org/resource/Albert_Einstein> <http://dbpedia.org/property/birthPlace> <http://dbpedia.org/resource/Germany>. <http://dbpedia.org/resource/Albert_Einstein> <http://xmlns.com/foaf/0.1/depiction> <http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg>.
Although URI resources are always used for subjects and predicates, the object part of a triple can be either a URI or a literal . In the example triples, Einstein's name is represented by a plain literal , which means that it is a basic string with no type or language information:
<http://dbpedia.org/resource/Albert_Einstein>
<http://xmlns.com/foaf/0.1/name>
"Albert
Einstein"
.
Some
literals,
such
as
dates
and
numbers,
have
very
specific
meanings,
so
RDF
provides
a
mechanism
for
indicating
the
type
of
a
literal.
A
typed
literal
is
indicated
by
attaching
a
URI
to
the
end
of
a
plain
literal
,
and
this
URI
indicates
the
literal's
datatype.
This
URI
is
usually
based
on
datatypes
defined
in
the
XML
Schema
Datatypes
specification
[
XMLSCHEMA-2
].
The
following
syntax
would
be
used
to
unambiguously
express
Einstein's
date
of
birth
as
a
literal
of
type
http://www.w3.org/2001/XMLSchema#date
:
<http://dbpedia.org/resource/Albert_Einstein>
<http://dbpedia.org/property/dateOfBirth>
"1879-03-14"
^^<http://www.w3.org/2001/XMLSchema#date>
.
RDF itself does not have one set way to express triples, since the key ideas of RDF are the triple and the use of URIs, and not any particular syntax. However, there are a number of mechanisms for expressing triples, such as RDF/XML [ RDF-SYNTAX-GRAMMAR ], Turtle [ TURTLE ], and of course RDFa. Many discussions of RDF make use of the Turtle syntax to explain their ideas, since it is quite compact. The examples we have just seen are already using this syntax, and we'll continue to use it throughout this document when we need to talk about the RDF that could be generated from some RDFa. Turtle allows long URIs to be abbreviated by using a URI mapping, which can be used to express a compact URI as follows:
@prefix dbp: <http://dbpedia.org/property/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://dbpedia.org/resource/Albert_Einstein> foaf:name "Albert Einstein" . <http://dbpedia.org/resource/Albert_Einstein> dbp:birthPlace <http://dbpedia.org/resource/Germany> .
Here 'dbp:' has been mapped to the URI for DBPedia and 'foaf:' has been mapped to the URI for the 'Friend of a Friend' taxonomy.
Any URI in Turtle could be abbreviated in this way. This means that we could also have used the same technique to abbreviate the identifier for Einstein, as well as the datatype indicator:
@prefix dbp: <http://dbpedia.org/property/> . @prefix dbr: <http://dbpedia.org/resource/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . dbr:Albert_Einstein dbp:dateOfBirth "1879-03-14"^^xsd:date . dbr:Albert_Einstein foaf:depiction <http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg> .
When writing examples, you will often see the following URI in the Turtle representation:
<>
This indicates the 'current document', i.e., the document being processed. In reality there would always be a full URI based on the document's location, but this abbreviation serves to make examples more compact. Note in particular that the whole technique of abbreviation is merely a way to make examples more compact, and the actual triples generated would always use the full URIs.
A collection of triples is called a graph . All of the triples that are defined by this specification are contained in the default graph by an RDFa Processor. For more information on graphs and other RDF concepts, see [ RDF-CONCEPTS ].
In order to allow for the compact expression of RDF statements, RDFa allows the contraction of most URI reference s into a form called a 'compact URI', or CURIE . A detailed discussion of this mechanism is in the section CURIE and URI Processing .
Note that CURIEs are only used in the markup and Turtle examples, and will never appear in the generated triple s, which are defined by RDF to use URI reference s.
Full details on how CURIEs are processed are in the section titled CURIE Processing .
A growing use of embedded metadata is to take fragments of markup and move them from one document to another. This may happen through the use of tools, such as drag-and-drop in a browser, or through snippets of code provided to authors for inclusion in their documents. (A good example of the latter is the licensing fragment provided by Creative Commons.)
However,
those
involved
in
creating
fragments
(either
by
building
tools,
or
authoring
snippets),
should
be
aware
that
this
specification
does
not
say
how
fragments
containing
RDFa
markup
should
be
processed
whilst
they
are
processed.
Specifically,
the
processing
of
a
fragment
'outside'
of
a
complete
document
(although
future
is
undefined
because
RDFa
processing
is
largely
about
context.
Future
versions
of
this
or
related
specifications
may
do
so).
more
to
define
this
behavior.
Developers
of
tools
that
process
fragments,
or
authors
of
fragments
for
manual
inclusion,
should
also
bear
in
mind
what
will
happen
to
their
fragment
once
it
is
included
in
a
complete
document,
and
are
advised
to
document.
They
should
carefully
consider
the
amount
of
'context'
information
that
will
be
needed
in
order
to
ensure
a
correct
interpretation
of
their
fragment.
The following is a brief description of RDFa in terms of the RDF terminology introduced here. It may be useful to readers with an RDF background:
The aim of RDFa is to allow a single RDF graph to be carried in various types of document markup. An RDF graph comprises node s linked by relationships. The basic unit of an RDF graph is a triple , in which a subject node is linked to an object node via a predicate . The subject node is always either a URI reference or a blank node (or bnode) , the predicate is always a URI reference , and the object of a statement can be a URI reference , a literal , or a bnode .
In RDFa, a subject URI reference is generally indicated using @about , and predicates are represented using one of @property , @rel , or @rev . Objects which are URI reference s are represented using @href , @resource or @src , whilst objects that are literal s are represented either with @content or the content of the element in question (with an optional datatype expressed using @datatype , and an optional language expressed using a Host Language-defined mechanism such as @xml:lang ).
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words must , must not , required , should , should not , recommended , may , and optional in this specification are to be interpreted as described in [ RFC2119 ].
A conforming RDFa Processor must make available to a consuming application a single RDF graph containing all possible triples generated by using the rules in the Processing Model section. This specification uses the term default graph to mean all of the triples asserted by a document according to the Processing Model section.
A conforming RDFa Processor may make available additional triples that have been generated using rules not described here, but these triples must not be made available in the default graph . (Whether these additional triples are made available in one or more additional RDF graph s is implementation-specific, and therefore not defined here.)
A conforming RDFa Processor must preserve whitespace in both plain literal s and XML literals . However, it may be the case that the architecture in which a processor operates does not make all whitespace available. It is therefore advisable for authors who would like to make their documents consumable across different processors, to remove any unnecessary whitespace in their markup.
Host Languages that incorporate RDFa must adhere to the following:
This specification defines a number of attributes and the way in which the values of those attributes are to be interpreted when generating RDF triples. This section defines the attributes and the syntax of their values.
CDATA
string,
for
supplying
machine-readable
content
for
a
literal
(a
'plain
literal
object',
in
RDF
terminology);
NCName ': ' xs:anyURI
This section looks at a generic set of processing rules for creating a set of triples that represent the structured data present in an RDFa document. Processing need not follow the DOM traversal technique outlined here, although the effect of following some other manner of processing must be the same as if the processing outlined here were followed. The processing model is explained using the idea of DOM traversal which makes it easier to describe (particularly in relation to the evaluation context ).
Parsing
Evaluating
a
document
for
RDFa
triples
is
carried
out
by
starting
at
the
document
object,
and
then
visiting
each
of
its
child
elements
in
turn,
in
document
order,
applying
processing
rules.
Processing
is
recursive
in
that
for
each
child
element
the
processor
also
visits
each
of
its
child
elements,
and
applies
the
same
processing
rules.
(Note that in some environments there will be little difference between starting at the root element of the document, and starting at the document object itself. However, we define it this way since in some environments important information is present at the document object level which is not present on the root element.)
As processing continues, rules are applied which may generate triples, and may also change the evaluation context information that will then be used when processing descendant elements.
Note
that
we
don't
say
anything
about
what
should
happen
to
the
triples
generated,
or
whether
more
triples
might
be
generated
during
processing
than
are
outlined
here.
However,
to
be
conformant,
an
RDFa
processor
needs
to
act
as
if
at
a
minimum
the
rules
in
this
section
are
applied,
and
a
single
[RDF
graph]
RDF
graph
produced.
As
described
in
the
RDFa
Processor
Conformance
section,
any
additional
triples
generated
must
not
appear
in
the
default
graph
.
During
processing,
each
rule
is
applied
using
information
provided
by
an
evaluation
context
.
An
initial
context
is
created
when
processing
begins,
with
begins.
That
context
has
the
following
set
of
values:
members:
base
element.
The
important
thing
is
that
it
establishes
a
URL
against
which
relative
paths
can
be
resolved.
During
the
course
of
processing
processing,
new
evaluation
context
s
are
created
which
are
passed
to
each
child
element.
The
rules
described
below
will
determine
the
values
of
the
items
in
the
context.
Additionally,
some
rules
will
cause
new
triples
to
be
created
by
combining
information
provided
by
an
element
with
information
from
the
evaluation
context
.
During the course of processing a number of locally scoped values are needed, as follows:
false
would
have
that
effect.
RDFa
has
the
notion
of
Statement
chaining
which
aims
is
an
RDFa
feature
that
allows
the
author
to
combine
link
RDF
statements
together
in
as
intuitive
a
way
as
possible,
so
as
avoid
while
avoiding
unnecessary
repetition
of
repetitive
markup.
For
example,
if
an
author
were
to
add
statements
as
children
of
an
object
that
was
a
resource,
these
statements
should
be
interpreted
as
being
about
that
resource:
<div about="http://dbpedia.org/resource/Albert_Einstein"> <span property="foaf:name">Albert Einstein</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span> <div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany"> <span property="dbp:conventionalLongName">Federal Republic of Germany</span> </div> </div>
In this example we can see that an object resource ('Germany'), has become the subject for nested statements. This markup also illustrates the basic chaining pattern of 'A has a B has a C' (i.e., Einstein has a birth place of Germany, which has a long name of "Federal Republic of Germany").
It's also possible for the subject of nested statements to provide the object for containing statements — essentially the reverse of the example we have just seen. To illustrate, we'll take an example of the type of chaining just described, and show how it could be marked up more efficiently. To start, we mark up the fact that Albert Einstein had both German and American citizenship:
<div about="http://dbpedia.org/resource/Albert_Einstein"> <div rel="dbp:citizenship" resource="http://dbpedia.org/resource/Germany"></div> <div rel="dbp:citizenship" resource="http://dbpedia.org/resource/United_States"></div> </div>
Now, we show the same information, but this time we create an incomplete triple from the citizenship part, and then use any number of further subjects to 'complete' that triple, as follows:
<div about="http://dbpedia.org/resource/Albert_Einstein" rel="dbp:citizenship"> <span about="http://dbpedia.org/resource/Germany"></span> <span about="http://dbpedia.org/resource/United_States"></span> </div>
In this example, the incomplete triple actually gets completed twice, once for Germany and once for the USA, giving exactly the same information as we had in the earlier example:
<http://dbpedia.org/resource/Albert_Einstein> dbp:citizenship <http://dbpedia.org/resource/Germany> . <http://dbpedia.org/resource/Albert_Einstein> dbp:citizenship <http://dbpedia.org/resource/United_States> .
Chaining
can
sometimes
involve
elements
containing
relatively
minimal
markup,
for
example
showing
only
one
resource,
or
only
one
predicate.
Here
the
img
element
is
used
to
carry
a
picture
of
Einstein:
<div about="http://dbpedia.org/resource/Albert_Einstein"><div rel="foaf:depiction"><div rel="foaf:depiction"> <img src="http://en.wikipedia.org/wiki/Image:Albert_Einstein_Head.jpg" /> </div> </div>
When such minimal markup is used, any of the resource-related attributes could act as a subject or an object in the chaining:
<div about="http://dbpedia.org/resource/Albert_Einstein"> <div rel="dbp:citizenship"> <span about="http://dbpedia.org/resource/Germany"></span> <span about="http://dbpedia.org/resource/United_States"></span> </div> </div>
Since RDFa is ultimately a means for transporting RDF, a key concept is the resource and its manifestation as a URI. Since RDF deals with complete URIs (not relative paths), then when converting RDFa to triples, any relative URIs will need to be resolved relative to the base URI, using the algorithm defined in section 5 of RFC 3986 [ URI ], Reference Resolution .
Many of the attributes that hold URIs are also able to carry 'compact URIs' or CURIEs. A CURIE is a convenient way to represent a long URI, by replacing a leading section of the URI with a substitution token. It's possible for authors to define as many substitution tokens as they see fit; the full URI is obtained by locating the mapping defined by a token from a list of in-scope tokens, and then simply concatenating the second part of the CURIE onto the mapped value.
For example, the full URI for Albert Einstein on DPPedia is:
http://dbpedia.org/resource/Albert_Einstein
This can be shortened by authors to make the information easier to manage, using a CURIE. The first step is for the author to create a prefix mapping that links a prefix to some leading segment of the URI. In RDFa these mappings are expressed using the XML namespace syntax:
<div prefix="db: http://dbpedia.org/">
...
</div>
Once the prefix has been established, an author can then use it to shorten a URI as follows:
<div prefix="db: http://dbpedia.org/"> <div about="db:resource/Albert_Einstein"> ... </div> </div>
The
author
is
free
to
break
split
the
URI
at
any
point,
as
long
as
it
begins
at
the
left
end.
However,
since
a
common
use
of
CURIEs
is
to
make
available
libraries
of
terms
and
values,
the
prefix
will
usually
be
mapped
to
some
common
segment
that
provides
the
most
re-use,
often
provided
by
those
who
manage
the
library
of
terms.
For
example,
since
DBPedia
contains
an
enormous
list
of
resources,
it
is
more
efficient
to
create
a
prefix
mapping
that
uses
the
base
location
of
the
resources:
<div prefix="dbr: http://dbpedia.org/resource/"> <div about="dbr:Albert_Einstein"> ... </div><div about=""><div about="dbr:Baruch_Spinoza"> ... </div> </div>
CURIE prefix mappings are defined on the current element and its descendants. For example, the URIs expressed by the following two CURIEs are different, despite the common prefix, because the prefix mappings are locally scoped:
<div prefix="dbr: http://dbpedia.org/resource/"> <div about="dbr:Albert_Einstein"> ... </div> </div><div > <div about=""><div prefix="dbr: http://someotherdb.org/resource/"> <div about="dbr:Albert_Einstein"> ... </div> </div>
There are a number of ways that attributes make use of CURIEs, and they need to be dealt with differently. These are:
An example of an attribute that can contain a URIorCURIE is @about . To express a URI directly, an author might do this:
<div about="http://dbpedia.org/resource/Albert_Einstein">
...
</div>
whilst to express the URL above as a CURIE they would do this:
<div about="dbr:Albert_Einstein">
...
</div>
The author could also use a safe CURIE, as follows:
<div about="[dbr:Albert_Einstein]">
...
</div>
Since
non-CURIE
values
must
be
ignored,
the
following
value
in
@about
would
not
set
a
new
subject,
since
the
CURIE
has
no
prefix
separator,
'Albert_Einstein'
is
not
a
term
that
has
been
defined
via
an
RDFa
Profile,
and
we
have
not
defined
a
default
vocabulary
via
@vocab
.
separator.
<div about="[Albert_Einstein]">
...
</div>
However, this markup would set a subject, since it is not a CURIE, but a valid relative URI:
<div about="Albert_Einstein">
...
</div>
Note that several RDFa attributes are able to also take terms as their value. This is discussed in the next section.
Some
RDFa
attributes
have
a
datatype
that
permits
a
'term'
term
to
be
referenced.
RDFa
defines
a
term
as
follows:
nterm := NCName
sterm := '[' nterm ']'
term := sterm | term
term := sterm | term
When an RDFa attribute permits the use of a term, and the value being evaluated matches one of the productions above, it is transformed to a URI using the following logic:
term
is
in
the
local
term
.
term
has
no
associated
URI
and
must
be
ignored.
The general rules discussed in the previous sections apply to the RDFa attributes in the following ways:
Note that any value that matches a defined term must be expanded into a reference to the corresponding URI. For example in [ XHTML-RDFA ] the following examples:
<link rel="next" href="http://example.org/page2.html" /> <link rel=" xhv:next " href="http://example.org/page2.html" />
would
each
generate
this
the
following
triple:
<> <http://www.w3.org/1999/xhtml/vocab#next> <http://example.org/page2.html> .
In
RDFa,
it
is
possible
to
establish
relationships
using
various
types
of
resource
references,
including
bnode
s.
If
a
subject
or
object
is
defined
using
a
CURIE,
and
that
CURIE
explicitly
names
a
bnode
,
then
a
Conforming
Parser
Processor
must
create
the
bnode
when
it
is
encountered
during
parsing.
The
parser
RDFa
Processor
must
also
ensure
that
no
bnode
created
automatically
(as
a
result
of
chaining
)
has
a
name
that
collides
with
a
bnode
that
is
defined
by
explicit
reference
in
a
CURIE.
Consider the following example:
<link about="_:john" rel="foaf:mbox" href="mailto:john@example.org" /><link about="_:sue" rel="foaf:mbox"<link about="_:sue" rel="foaf:mbox" href="mailto:sue@example.org" /><link about="_:john" rel="foaf:knows"<link about="_:john" rel="foaf:knows" resource="_:sue" />
In the above fragment, two bnodes are explicitly created as the subject of triples. Those bnodes are then referenced to demonstrate the relationship between the parties. After processing, the following triples will be generated:
_:john foaf:mbox <mailto:john@example.org> . _:sue foaf:mbox <mailto:sue@example.org> . _:john foaf:knows _:sue .
Processing
would
normally
begin
after
the
document
to
be
parsed
has
been
completely
loaded.
However,
there
is
no
requirement
for
this
to
be
the
case,
and
it
is
certainly
possible
to
use
a
stream-based
approach,
such
as
SAX
[
SAX
]
to
extract
the
RDFa
information.
However,
if
some
approach
other
than
the
DOM
traversal
technique
defined
here
is
used,
it
is
important
to
ensure
that
any
meta
or
link
elements
processed
in
the
head
of
the
document
honor
any
occurrences
of
base
which
may
appear
after
those
elements.
(In
other
words,
HTML
processing
rules
must
still
be
applied,
even
if
document
processing
takes
place
in
a
non-HTML
environment
such
as
a
search
indexer.)
At the beginning of processing, an initial evaluation context is created, as follows:
base
element);
Processing begins by applying the processing rules below to the document object, in the context of this initial evaluation context . All elements in the tree are also processed according to the rules described below, depth-first, although the evaluation context used for each set of rules will be based on previous rules that may have been applied.
This
specification
assumes
that
certain
elements
are
present
in
the
Host
Language
(e.g.,
head
).
If
these
elements
are
not
supported
in
the
Host
Language,
then
the
corresponding
processing
rules
are
not
relevant
for
that
language.
The processing rules are:
If no URI is provided by a resource attribute, then the first match from the following rules will apply:
head
or
body
element
then
act
as
if
there
is
an
empty
@about
present,
and
process
it
according
to
the
rule
for
@about
,
above;
The
rule
for
@about
means
that
if
@about
is
set
on
the
root
element,
it
will
be
overridden
working
group
has
not
reached
consensus
on
the
whether
elements
that
are
specific
to
host
languages
(e.g.,
body
and
head
elements.
Is
that
what
we
want?
head)
should
have
special
rules
in
this
document
or
whether
those
rules
should
be
defined
in
the
relevant
Host
Language
specifications.
If no URI is provided then the first match from the following rules will apply:
head
or
body
element
then
act
as
if
there
is
an
empty
@about
present,
and
process
it
according
to
the
rule
for
@about
,
above;
Then the current object resource is set to the URI obtained from the first match from the following rules:
Note that final value of the current object resource will either be null (from initialization) or a full URI.
rdf:XMLLiteral
.
The actual literal is either the value of @content (if present) or a string created by concatenating the value of all descendant text nodes, of the current element in turn. The final string includes the datatype URI, as described in [ RDF-CONCEPTS ], which will have been obtained according to the section on CURIE and URI Processing .
Additionally, if there is a value for current language then the value of the plain literal should include this language information, as described in [ RDF-CONCEPTS ]. The actual literal is either the value of @content (if present) or a string created by concatenating the text content of each of the descendant elements of the current element in document order.
rdf:XMLLiteral
.
The
value
of
the
XML
literal
is
a
string
created
by
serializing
to
text,
all
nodes
that
are
descendants
of
the
current
element
,
i.e.,
not
including
the
element
itself,
and
giving
it
a
datatype
of
rdf:XMLLiteral
.
The
format
of
the
resulting
serialized
content
is
as
defined
in
Exclusive
XML
Canonicalization
Version
[
XML-EXC-C14N
].
The current object literal is then used with each predicate to generate a triple as follows:
Once
the
triple
has
been
created,
if
the
datatype
of
the
current
object
literal
is
rdf:XMLLiteral
,
then
the
recurse
flag
is
set
to
false
.
This section provides an in-depth examination of the processing steps described in the previous section. It also includes examples which may help clarify some of the steps involved.
The key to processing is that a triple is generated whenever a predicate/object combination is detected. The actual triple generated will include a subject that may have been set previously, so this is tracked in the current evaluation context and is called the parent subject . Since the subject will default to the current document if it hasn't been set explicitly, then a predicate/object combination is always enough to generate one or more triples.
The
attributes
for
setting
a
predicate
are
@rel
,
@rev
and
@property
,
whilst
the
attributes
for
setting
an
object
are
@resource
,
@href
,
@content
,
and
@src
.
@typeof
is
unique
in
that
it
sets
both
a
predicate
and
an
object
at
the
same
time
(and
also
a
subject
when
it
appears
in
the
absence
of
other
attributes
that
would
set
a
subject).
Inline
content
might
also
set
an
object,
if
@content
is
not
present,
but
@property
is.
is
present.
When
triples
are
created
they
will
always
be
in
relation
to
a
subject
resource
which
is
provided
either
by
new
subject
(if
there
are
rules
on
the
current
element
that
have
set
a
subject)
or
parent
subject
,
as
passed
in
via
the
evaluation
context
.
This
section
looks
at
the
specific
ways
in
which
these
values
are
set.
Note
that
it
doesn't
matter
how
the
subject
is
arrived
at,
set,
so
in
this
section
we
use
the
idea
of
the
current
subject
which
may
be
either
new
subject
or
parent
subject
.
When
parsing
begins,
the
current
subject
will
be
the
URI
of
the
document
being
parsed,
or
a
value
as
set
by
a
Host
Language-provided
mechanism
such
as
the
base
element
in
(X)HTML.
This
means
that
any
metadata
found
in
the
head
of
the
document
will
concern
the
document
itself:
<html> <head> <title>Jo's Friends and Family Blog</title> <link rel="foaf:primaryTopic" href="#bbq" /> <meta property="dc:creator" content="Jo" /> </head> <body> ... </body> </html>
This would generate the following triples:
<> foaf:primaryTopic <#bbq> . <> dc:creator "Jo" .
It is possible for the data to appear elsewhere in the document:
<html>
<head>
<title>Jo's Blog</title>
</head>
<body>
<h1><span property="dc:creator">Jo</span>'s blog</h1>
<p>
Welcome to my blog.
</p>
</body>
</html>
which would still generate the triple:
<> dc:creator "Jo" .
In
(X)HTML
the
value
of
base
may
change
the
initial
value
of
current
subject
:
<html>
<head>
<base href="http://www.example.org/jo/blog" />
<title>Jo's Friends and Family Blog</title>
<link rel="foaf:primaryTopic" href="#bbq" />
<meta property="dc:creator" content="Jo" />
</head>
<body>
...
</body>
</html>
A
parser
An
RDFa
Processor
should
now
generate
the
following
triples,
regardless
of
the
URL
from
which
the
document
is
served:
<http://www.example.org/jo/blog> foaf:primaryTopic <#bbq> . <http://www.example.org/jo/blog> dc:creator "Jo" .
As
processing
progresses,
any
@about
attributes
will
change
the
current
subject
.
The
value
of
@about
is
a
URI
or
a
CURIE.
If
it
is
a
relative
URI
then
it
needs
to
be
resolved
against
the
current
base
value.
To
illustrate
how
this
affects
the
statements,
note
in
this
markup
how
the
properties
inside
the
(X)HTML
body
element
become
part
of
a
new
calendar
event
object,
rather
than
referring
to
the
document
as
they
do
in
the
head
of
the
document:
<html> <head> <title>Jo's Friends and Family Blog</title> <link rel="foaf:primaryTopic" href="#bbq" /> <meta property="dc:creator" content="Jo" /> </head> <body> <p about="#bbq" typeof="cal:Vevent"> I'm holding <span property="cal:summary"> one last summer barbecue </span>, on<span content="2007-09-16T16:00:00-05:00"<span property="cal:dtstart" content="2015-09-16T16:00:00-05:00" datatype="xsd:dateTime"> September 16th at 4pm </span>. </p> </body> </html>
With
this
markup
a
parser
should
an
RDFa
Processor
will
generate
the
following
triples:
<> foaf:primaryTopic <#bbq> . <> dc:creator "Jo" . <#bbq> rdf:type cal:Vevent . <#bbq> cal:summary "one last summer barbecue" . <#bbq> cal:dtastart"2007-09-16T16:00:00-05:00"^^xsd:dateTime"2015-09-16T16:00:00-05:00"^^xsd:dateTime .
Other kinds of resources can be used to set the current subject , not just references to web-pages. Although not advised, email addresses might be used to represent a person:
John knows <a about="mailto:john@example.org" rel="foaf:knows" href="mailto:sue@example.org">Sue</a>. Sue knows <a about="mailto:sue@example.org" rel="foaf:knows" href="mailto:jim@example.org">Jim</a>.
This should generate the following triples:
<mailto:john@example.org> foaf:knows <mailto:sue@example.org> . <mailto:sue@example.org> foaf:knows <mailto:jim@example.org> .
Similarly, authors may make statements about images:
<div about="photo1.jpg">
this photo was taken by
<span property="dc:creator">Mark Birbeck</span>
</div>
which should generate the following triples:
<photo1.jpg> dc:creator "Mark Birbeck" .
If @about is not present, then @src is next in priority order, for setting the subject of a statement. A typical use would be to indicate the licensing type of an image:
<img src="photo1.jpg" rel="license"
resource="http://creativecommons.org/licenses/by/2.0/"
/>
Since there is no difference between @src and @about , then the information expressed in the last example in the section on @about (the creator of an image), could be expressed as follows:
<img src="photo1.jpg"
rel="license" resource="http://creativecommons.org/licenses/by/2.0/"
property="dc:creator" content="Mark Birbeck"
/>
Since normal chaining rules will apply, the image URL can also be used to complete hanging triples:
<div about="http://www.blogger.com/profile/1109404" rel="foaf:img">
<img src="photo1.jpg"
rel="license" resource="http://creativecommons.org/licenses/by/2.0/"
property="dc:creator" content="Mark Birbeck"
/>
</div>
The complete markup yields three triples:
<http://www.blogger.com/profile/1109404> foaf:img <photo1.jpg> . <photo1.jpg> xhv:license <http://creativecommons.org/licenses/by/2.0/> . <photo1.jpg> dc:creator "Mark Birbeck" .
Whilst
@about
explicitly
creates
a
new
context
for
statements,
@typeof
does
so
implicitly.
@typeof
works
differently
to
other
ways
of
setting
a
predicate
since
the
predicate
is
always
rdf:type
,
which
means
that
the
processor
only
requires
one
attribute,
the
value
of
the
type.
Since @typeof is setting the type of an item, this means that if no item exists one should automatically be created. This involves generating a new bnode , and is examined in more detail below; it is mentioned here because the bnode used by the new item will become the subject for further statements.
For example, an author may wish to create markup for a person using the FOAF vocabulary, but without having a clear identifier for the item:
<div typeof="foaf:Person">
<span property="foaf:name">Albert Einstein</span>
<span property="foaf:givenname">Albert</span>
</div>
This
markup
would
cause
a
bnode
to
be
created
which
has
a
'type'
of
foaf:Person
,
as
well
as
name
and
given
name
properties:
_:a rdf:type foaf:Person . _:a foaf:name "Albert Einstein" . _:a foaf:givenname "Albert" .
_:a
as
being
distinct
from
_:b
.
But
by
not
exposing
these
values
to
any
external
software,
it
is
possible
to
have
complete
control
over
the
identifier,
as
well
as
preventing
further
statements
being
made
about
the
item.
As described in the previous two sections, @about will always take precedence and mark a new subject, but if no @about value is available then @typeof will do the same job, although using an implied identifier, i.e., a bnode .
But if neither @about or @typeof are present, there are a number of ways that the subject could be arrived at. One of these is to 'inherit' the subject from the containing statement, with the value to be inherited set either explicitly, or implicitly.
The most usual way that an inherited subject might get set would be when the parent statement has an object that is a resource. Returning to the earlier example, in which the long name for Germany was added, the following markup was used:
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany" />
<span about="http://dbpedia.org/resource/Germany"
property="dbp:conventionalLongName">Federal Republic of Germany</span>
</div>
In an earlier illustration the subject and object for Germany were elided by removing the @resource , relying on the @about to set the object:
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace">
<span about="http://dbpedia.org/resource/Germany"
property="dbp:conventionalLongName">Federal Republic of Germany</span>
</div>
</div>
but it is also possible for authors to achieve the same effect by removing the @about and leaving the @resource :
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany">
<span property="dbp:conventionalLongName">Federal Republic of Germany</span>
</div>
</div>
In this situation, all statements that are 'contained' by the object resource representing Germany (the value in @resource ) will have the same subject, making it easy for authors to add additional statements:
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany">
<span property="dbp:conventionalLongName">Federal Republic of Germany</span>
<span rel="dbp:capital" resource="http://dbpedia.org/resource/Berlin" />
</div>
</div>
Looking
at
the
triples
that
a
parser
an
RDFa
Processor
would
generate,
we
can
see
that
we
actually
have
two
groups
of
statements;
the
first
group
are
set
to
refer
to
the
@about
that
contains
them:
<http://dbpedia.org/resource/Albert_Einstein> foaf:name "Albert Einstein" . <http://dbpedia.org/resource/Albert_Einstein> dbp:dateOfBirth "1879-03-14"^^xsd:date . <http://dbpedia.org/resource/Albert_Einstein> dbp:birthPlace <http://dbpedia.org/resource/Germany> .
whilst the second group refer to the @resource that contains them:
<http://dbpedia.org/resource/Germany> dbp:conventionalLongName "Federal Republic of Germany" . <http://dbpedia.org/resource/Germany> dbp:capital <http://dbpedia.org/resource/Berlin> .
Note also that the same principle described here applies to @src and @href .
There will be occasions when the the author wants to elide the subject and object as shown above, but is not concerned to name the resource that is common to the two statements (i.e., the object of the first statement, which is the subject of the second). For example, to indicate that Einstein was influenced by Spinoza the following markup could well be used:
<div about="http://dbpedia.org/resource/Baruch_Spinoza" rel="dbp:influenced"> <div about="http://dbpedia.org/resource/Albert_Einstein"> <span property="foaf:name">Albert Einstein</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span> </div> </div>
A
parser
should
An
RDFa
Processor
will
generate
the
following
triples:
<http://dbpedia.org/resource/Baruch_Spinoza> dbp:influenced <http://dbpedia.org/resource/Albert_Einstein> . <http://dbpedia.org/resource/Albert_Einstein> foaf:name "Albert Einstein" . <http://dbpedia.org/resource/Albert_Einstein> dbp:dateOfBirth "1879-03-14"^^xsd:date .
However, an author could just as easily say that Spinoza influenced something by the name of Albert Einstein, that was born on March 14th, 1879 :
<div about="http://dbpedia.org/resource/Baruch_Spinoza" rel="dbp:influenced"> <div> <span property="foaf:name">Albert Einstein</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span> </div> </div>
In RDF terms, the item that 'represents' Einstein is anonymous , since it has no URI to identify it. However, the item is given an automatically generated bnode , and it is onto this idenfifier that all child statements are attached:
A
parser
should
An
RDFa
Processor
will
generate
the
following
triples:
<http://dbpedia.org/resource/Baruch_Spinoza> dbp:influenced _:a . _:a foaf:name "Albert Einstein" . _:a dbp:dateOfBirth "1879-03-14"^^xsd:date .
Note
that
the
div
is
superfluous,
and
a
parser
should
an
RDFa
Processor
will
create
the
intermediate
object
even
if
the
element
is
removed:
<div about="http://dbpedia.org/resource/Baruch_Spinoza" rel="dbp:influenced"> <span property="foaf:name">Albert Einstein</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span> </div>
An
alternative
pattern
is
to
keep
the
div
and
move
the
@rel
onto
it:
<div about="http://dbpedia.org/resource/Baruch_Spinoza">
<div rel="dbp:influenced">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
</div>
</div>
From
the
point
of
view
of
the
markup,
this
latter
layout
is
to
be
preferred,
since
it
draws
attention
to
the
'hanging
rel'.
But
from
the
point
of
view
of
a
parser,
an
RDFa
Processor,
all
of
these
permutations
need
to
be
supported.
When a new subject is calculated, it is also used to complete any incomplete triples that are pending. This situation arises when the author wants to 'chain' a number of statements together. For example, an author could have a statement that Albert Einstein was born in Germany:
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany" />
</div>
and then a further statement that the 'long name' for Germany is the Federal Republic of Germany :
<span about="http://dbpedia.org/resource/Germany" property="dbp:conventionalLongName">Federal Republic of Germany</span>
RDFa allows authors to insert this statement as a self-contained unit into other contexts:
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany" />
<span about="http://dbpedia.org/resource/Germany"
property="dbp:conventionalLongName">Federal Republic of Germany</span>
</div>
But it also allows authors to avoid unnecessary repetition and to 'normalize' out duplicate identifiers, in this case the one for Germany:
<div about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name">Albert Einstein</span>
<span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
<div rel="dbp:birthPlace">
<span about="http://dbpedia.org/resource/Germany"
property="dbp:conventionalLongName">Federal Republic of Germany</span>
</div>
</div>
When
this
happens
the
@rel
for
'birth
place'
is
regarded
as
a
'hanging
rel'
because
it
has
not
yet
generated
any
triples,
but
these
'incomplete
triples'
are
completed
by
the
@about
that
appears
on
the
next
line.
The
first
step
is
therefore
to
store
the
two
parts
of
the
triple
that
the
parser
RDFa
Processor
does
have,
but
without
an
object:
<http://dbpedia.org/resource/Albert_Einstein>
dbp:birthPlace
?
.
Then
as
processing
continues,
the
parser
RDFa
Processor
encounters
the
subject
of
the
statement
about
the
long
name
for
Germany,
and
this
is
used
in
two
ways.
First
it
is
used
to
complete
the
'incomplete
triple':
<http://dbpedia.org/resource/Albert_Einstein>
dbp:birthPlace
<http://dbpedia.org/resource/Germany>
.
and second it is used to generate its own triple:
<http://dbpedia.org/resource/Germany> dbp:conventionalLongName "Federal Republic of Germany" .
Note that each occurrence of @about will complete any incomplete triples. For example, to mark up the fact that Albert Einstein had both German and American citizenship, an author need only specify one @rel value that is then used with multiple @about values:
<div about="http://dbpedia.org/resource/Albert_Einstein" rel="dbp:citizenship"> <span about="http://dbpedia.org/resource/Germany" /> <span about="http://dbpedia.org/resource/United_States" /> </div>
In this example there is one incomplete triple:
<http://dbpedia.org/resource/Albert_Einstein>
dbp:citizenship
?
.
When the processor meets each of the @about values, this triple is completed, giving:
<http://dbpedia.org/resource/Albert_Einstein> dbp:citizenship <http://dbpedia.org/resource/Germany> . <http://dbpedia.org/resource/Albert_Einstein> dbp:citizenship <http://dbpedia.org/resource/United_States> .
These examples show how @about completes triples, but there are other situations that can have the same effect. For example, when @typeof creates a new bnode (as described above), that will be used to complete any 'incomplete triples'. To illustrate, to indicate that Spinoza influenced both Einstein and Schopenhauer, the following markup could be used:
<div about="http://dbpedia.org/resource/Baruch_Spinoza"> <div rel="dbp:influenced"> <div typeof="foaf:Person"> <span property="foaf:name">Albert Einstein</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span> </div> <div typeof="foaf:Person"> <span property="foaf:name">Arthur Schopenhauer</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1788-02-22</span> </div> </div> </div>
First the following incomplete triple is stored:
<http://dbpedia.org/resource/Baruch_Spinoza>
dbp:influenced
?
.
Then
when
the
parser
RDFa
Processor
processes
the
two
occurences
of
@typeof
,
each
generates
a
bnode
,
which
is
used
to
both
complete
the
'incomplete
triple',
and
to
set
the
subject
for
further
statements:
<http://dbpedia.org/resource/Baruch_Spinoza"> dbp:influenced _:a . _:a rdf:type foaf:Person . _:a foaf:name "Albert Einstein" . _:a dbp:dateOfBirth "1879-03-14"^^xsd:date . <http://dbpedia.org/resource/Baruch_Spinoza"> dbp:influenced _:b . _:b rdf:type foaf:Person . _:b foaf:name "Arthur Schopenhauer" . _:b dbp:dateOfBirth "1788-02-22"^^xsd:date .
Triples are also 'completed' if any one of @property , @rel or @rev are present. However, unlike the situation when @about or @typeof are present, all predicates are attached to one bnode :
<div about="http://dbpedia.org/resource/Baruch_Spinoza" rel="dbp:influenced"> <span property="foaf:name">Albert Einstein</span> <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span> <div rel="dbp:citizenship"> <span about="http://dbpedia.org/resource/Germany" /> <span about="http://dbpedia.org/resource/United_States" /> </div> </div>
This example has two 'hanging rels', and so two situations when 'incomplete triples' will be created. Processing would proceed as follows; first an incomplete triple is stored:
<http://dbpedia.org/resource/Baruch_Spinoza>
dbp:influenced
?
.
Next,
the
parser
RDFa
Processor
processes
the
predicate
values
for
foaf:name
,
dbp:dateOfBirth
and
dbp:citizenship
,
but
note
that
only
the
first
needs
to
'complete'
the
'hanging
rel'.
So
processing
foaf:name
generates
two
triples:
<http://dbpedia.org/resource/Baruch_Spinoza> dbp:influenced _:a . _:a foaf:name "Alber Einstein" .
but
processing
dbp:dateOfBirth
generates
only
one:
_:a
dbp:dateOfBirth
"1879-03-14"^^xsd:date
.
Processing
dbp:citizenship
also
uses
the
same
bnode
,
but
note
that
it
also
generates
its
own
'incomplete
triple':
_:a
dbp:citizenship
?
.
As before, the two occurrences of @about complete the 'incomplete triple', once each:
_:a dbp:citizenship <http://dbpedia.org/resource/Germany> . _:a dbp:citizenship <http://dbpedia.org/resource/United_States> .
The
entire
set
of
triples
that
a
parser
an
RDFa
Processor
should
generate
are
as
follows:
<http://dbpedia.org/resource/Baruch_Spinoza> dbp:influenced _:a . _:a foaf:name "Alber Einstein" . _:a dbp:dateOfBirth "1879-03-14"^^xsd:date . _:a dbp:citizenship <http://dbpedia.org/resource/Germany> . _:a dbp:citizenship <http://dbpedia.org/resource/United_States> .
Although objects have been discussed in the previous sections, as part of the explanation of subject resolution, chaining, evaluation contexts, and so on, this section will look at objects in more detail.
There are two types of object, URI resource s and literal s.
A literal object can be set by using @property to express a predicate , and then using either @content , or the inline text of the element that @property is on. Note that the use of @content prohibits the inclusion of rich markup in your literal. If the inline content of an element accurately represents the object, then documents should rely upon that rather than duplicating that data using the @content .
A URI resource object can be set using one of @rel or @rev to express a predicate , and then either using one of @href , @resource or @src to provide an object resource explicitly, or using the chaining techniques described above to obtain an object from a nested subject, or from a bnode .
An object literal will be generated when @property is present. @property provides the predicate, and the following sections describe how the actual literal to be generated is determined.
@content can be used to indicate a plain literal , as follows:
<meta about="http://internet-apps.blogspot.com/"
property="dc:creator"
content="Mark
Birbeck"
/>
The plain literal can also be specified by using the content of the element:
<span about="http://internet-apps.blogspot.com/"
property="dc:creator">
Mark
Birbeck
</span>
Both of these examples give the following triple:
<http://internet-apps.blogspot.com/> dc:creator "Mark Birbeck" .
The
value
of
@content
is
given
precedence
over
any
element
content,
so
the
following
would
give
exactly
the
same
triple:
triple
as
shown
above:
<span about="http://internet-apps.blogspot.com/"
property="dc:creator"
content="Mark
Birbeck"
>John
Doe</span>
RDF allows plain literal s to have a language tag, as illustrated by the following example from [ RDF-TESTCASES ]:
<http://example.org/node>
<http://example.org/property>
"chat"
@fr
.
In RDFa the Host Language may provide a mechanism for setting the language tag. In XHTML +RDFa [ XHTML-RDFA ], for example, the XML language attribute @xml:lang or the attribute @lang is used to add this information, whether the plain literal is designated by @content , or by the inline text of the element:
<meta about="http://example.org/node"
property="ex:property"
xml:lang="fr"
content="chat"
/>
Note that the language value can be inherited as defined in [ XML10-4e ], so the following syntax will give the same triple as above:
<html xmlns="http://www.w3.org/1999/xhtml"xmlns:ex="http://www.example.com/ns/" >prefix="ex: http://www.example.com/ns/" xml:lang="fr"> <head> <title xml:lang="en">Example</title> <meta about="http://example.org/node" property="ex:property" content="chat" /> </head> ... </html>
Literals can be given a data type using @datatype .
This can be represented in RDFa as follows:
<span property="cal:dtstart" content="2015-09-16T16:00:00-05:00"
datatype="xsd:dateTime">
September 16th at 4pm
</span>.
The triples that this markup generates include the datatype after the literal:
<> cal:dtstart"2007-09-16T16:00:00-05:00"^^"2015-09-16T16:00:00-05:00"^^ xsd:dateTime .
XML documents cannot contain XML markup in their attributes, which means it is not possible to represent XML within @content (the following would cause an XML parser to generate an error):
<head>
<meta property="dc:title"
content="E = mc<sup>2</sup>: The Most Urgent Problem of Our Time" />
</head>
It does not help to escape the content, since the output would simply be a string of text containing numerous ampersands:
<>
dc:title
"E
=
mc
<sup>2&lt;/sup>
:
The
Most
Urgent
Problem
of
Our
Time"
.
RDFa therefore supports the use of normal markup to express XML literals, by using @datatype :
<h2 property="dc:title" datatype="rdf:XMLLiteral">
E = mc<sup>2</sup>: The Most Urgent Problem of Our Time
</h2>
This would generate the following triple, with the XML preserved in the literal:
<> dc:title "E = mc<sup>2</sup>: The Most Urgent Problem of Our Time"^^rdf:XMLLiteral .
Note
that
this
requires
that
a
URI
mapping
for
the
prefix
rdf
has
been
defined.
To
make
authoring
easier,
if
there
are
child
elements
and
no
@datatype
attribute,
then
the
effect
is
the
same
as
if
@datatype
have
been
explicitly
set
to
rdf:XMLLiteral
:
<h2 property="dc:title"> E = mc<sup>2</sup>: The Most Urgent Problem of Our Time </h2>
In
the
examples
given
here
the
sup
element
is
actually
part
of
the
meaning
of
the
literal,
but
there
will
be
situations
where
the
extra
markup
means
nothing,
and
can
therefore
be
ignored.
In
this
situation
an
empty
@datatype
value
can
be
used
to
override
the
XML
literal
behaviour:
<p>You searched for <strong>Einstein</strong>:</p>
<p about="http://dbpedia.org/resource/Albert_Einstein">
<span property="foaf:name" datatype="">Albert <strong>Einstein</strong></span>
(b. March 14, 1879, d. April 18, 1955) was a German-born theoretical physicist.
</p>
Although the rendering of this page has highlighted the term the user searched for, setting @datatype to nothing ensures that the data is interpreted as a plain literal, giving the following triples:
<http://dbpedia.org/resource/Albert_Einstein>
foaf:name
"Albert
Einstein"
.
Note that the value of this XML Literal is the exclusive canonicalization [ XML-EXC-C14N ] of the RDFa element's value.
Although the RDFa processing model requires visiting each element in the tree, if the processor meets an XML literal then it must not process any further down the tree. This is to prevent triples being generated from markup that is not actually in the hierarchy. For example, we might want to set the title of something to some markup that itself includes RDFa:
<h2 property="dc:title">
Example 3: <span about="#bbq" typeof="cal:Vevent">...</span>
</h2>
In this example the nested RDFa should not be parsed. This effectively means that the presence of @property without @content will inhibit any further processing, so authors should watch out for stray attributes, especially if they find that they are getting fewer triples than they had expected.
Most of the rules governing the processing of objects that are resources are to be found in the processing descriptions given above, since they are important for establishing the subject. This section aims to highlight general concepts, and anything that might have been missed.
One or more URI object s are needed when @rel or @rev is present. Each attribute will cause triples to be generated when used with @href , @resource or @src , or with the subject value of any nested statement if none of these attributes are present.
@rel and @rev are essentially the inverse of each other; whilst @rel establishes a relationship between the current subject as subject, and the current object resource as the object, @rev does the exact opposite, and uses the current object resource as the subject, and the current subject as the object.
RDFa provides the @resource attribute as a way to set the object of statements. This is particularly useful when referring to resources that are not themselves navigable links:
<html>
<head>
<title>On Crime and Punishment</title>
<base href="http://www.example.com/candp.xhtml" />
</head>
<body>
<blockquote about="#q1" rel="dc:source" resource="urn:ISBN:0140449132" >
<p id="q1">
Rodion Romanovitch! My dear friend! If you go on in this way
you will go mad, I am positive! Drink, pray, if only a few drops!
</p>
</blockquote>
</body>
</html>
The
blockquote
element
generates
the
following
triple:
<http://www.example.com/candp.xhtml#q1> <http://purl.org/dc/elements/1.1/source> <urn:ISBN:0140449132> .
If no @resource is present, then @href is next in priority order, for setting the object.
When a predicate has been expressed using @rel , the @href on the [RDFa statement]'s element is used to identify the object with a [URI reference]. Its type is a URI:
<link about="mailto:john@example.org"
rel="foaf:knows"
href="mailto:sue@example.org"
/>
It's also possible to use both @rel and @rev at the same time on an element. This is particularly useful when two things stand in two different relationships with each other, for example when a picture is taken by Mark, but that picture also depicts him:
<img src="photo1.jpg" rel="dc:creator" rev="foaf:img"
href="http://www.blogger.com/profile/1109404"
/>
which then yields two triples:
<photo1.jpg> dc:creator <http://www.blogger.com/profile/1109404> . <http://www.blogger.com/profile/1109404> foaf:img <photo1.jpg> .
When a triple predicate has been expressed using @rel or @rev , but no @href , @src , or @resource exists on the same element, there is a 'hanging rel'. This causes the current subject and all possible predicates (with an indicator of whether they are 'forwards, i.e., @rel values, or not, i.e., @rev values), to be stored as 'incomplete triples' pending discovery of a subject that could be used to 'complete' those triples.
This process is described in more detail in Completing 'Incomplete Triples' .
The key component of RDF is the URI, but these are usually long and unwieldy. RDFa therefore supports a mechanism by which URIs can be abbreviated, called 'compact URIs' or simply, CURIEs.
A
CURIE
is
comprised
of
two
components,
a
prefix
and
a
reference
.
The
prefix
is
separated
from
the
reference
by
a
colon
(
:
).
In
general
use
it
is
possible
to
omit
the
prefix,
and
so
create
a
CURIE
that
makes
use
of
the
'default
prefix'
mapping;
in
RDFa
the
'default
prefix'
mapping
is
http://www.w3.org/1999/xhtml/vocab#
.
It's
also
possible
to
omit
both
the
prefix
and
the
colon,
and
so
create
a
CURIE
that
contains
just
a
reference
which
makes
use
of
the
'no
prefix'
mapping.
This
spefication
does
not
define
a
default
'no
prefix'
mapping.
However,
Host
Languages
may
define
a
default.
This
mapping
may
be
changed
via
@vocab
.
The general syntax of a CURIE can be summarised as follows:
curie := [ [ prefix ] ':' ] reference prefix := NCName reference := irelative-ref (as defined in [RFC3987])
In some situations an attribute will allow either a CURIE, or a normal URI. A URI that uses a scheme that is not an in-scope mapping cannot be confused with a CURIE. However, since there may be situations where authors would like to make it explicit that they are using a CURIE, the CURIE syntax adds the notion of a safe CURIE . The syntax is simply to surround the CURIE with square brackets:
safe_curie := '[' curie ']'
In normal evaluation of CURIEs the following context information would need to be provided:
:p
);
p
);
_:p
).
In RDFa these values are defined as follows:
A CURIE is a representation of a full URI. The rules for determining that URI are:
prefix
and
a
reference
,
the
URI
is
obtained
by
taking
the
current
default
prefix
mapping
and
concatenating
it
with
the
reference
.
If
there
is
no
current
default
prefix
mapping,
then
this
is
not
a
valid
CURIE
and
must
be
ignored.
prefix
and
reference
,
and
if
there
is
an
in-scope
mapping
for
prefix
,
then
the
URI
is
created
by
using
that
mapping,
and
concatenating
it
with
the
reference
.
prefix
,
the
original
value
is
used
as
the
URI.
RDFa Profiles are optional external documents that define collections of terms and/or prefix mappings. These documents must be defined in an approved RDFa Host Language (currently [[ XHTML +RDFa]]). They may also be defined in other RDF serializations as well (e.g., RDF/XML [ RDF-SYNTAX-GRAMMAR ] or Turtle [ TURTLE ]). RDFa Profiles are referenced via @profile , and can be used by document authors to simplify the task of adding semantic markup. When an RDFa document includes @profile , the value of the attribute is evaluated in order. For each URI in the value, do the following:
rdfa:prefix
and
an
rdfa:uri
predicate,
create
a
mapping
from
the
object
literal
of
the
rdfa:prefix
predicate
to
the
object
literal
of
the
rdfa:uri
predicate.
Add
or
update
this
mapping
in
the
local
list
of
URI
mappings
after
transforming
the
'prefix'
component
to
lower-case.
rdfa:term
and
an
rdfa:uri
predicate,
create
a
mapping
from
the
object
literal
of
the
rdfa:term
predicate
to
the
object
literal
of
the
rdfa:uri
predicate.
Add
or
update
this
mapping
in
the
local
Once all the URIs in the @profile value have been processed, continue with the normal processing of the current element .
It is possible that a referenced RDFa document will in turn reference other documents via @profile . Regardless of the depth to which such references might go, only the triples in the top level document effect current processing.
RDFa
Processor
developers
are
permitted
and
encouraged
to
cache
the
relevant
triples
retrieved
via
this
mechanism.
mechanism,
including
embedding
definitions
for
well
known
vocabularies
in
the
implementation
if
appropriate.
If
one
of
the
objects
is
not
a
Literal
or
if
there
are
additional
rdfa:uri
or
rdfa:term
predicates
sharing
the
same
subject,
no
mapping
is
created.
This section is non-normative.
In
order
to
facilitate
the
use
of
CURIEs
in
markup
languages,
this
specification
defines
some
additional
datatypes
in
the
XHTML
datatype
space
(
http://www.w3.org/1999/xhtml/datatypes/
).
Markup
languages
that
use
XHTML
Modularization
can
find
these
normative
definitions
in
the
Modularization
support
file
"datatypes"
for
their
schema
grammar:
Specifically, the following datatypes are introduced:
The following informative XML Schema definition for these datatypes is included as an example:
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml/datatypes/" xmlns:xh11d="http://www.w3.org/1999/xhtml/datatypes/" targetNamespace="http://www.w3.org/1999/xhtml/datatypes/" elementFormDefault="qualified" > <xs:simpleType name="CURIE"> <xs:restriction base="xs:string"> <xs:pattern value="(([\i-[:]][\c-[:]]*)?:)?.+" /> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="CURIEs"> <xs:list itemType="xh11d:CURIE"/> </xs:simpleType> <xs:simpleType name="SafeCURIE"> <xs:restriction base="xs:string"> <xs:pattern value="\[(([\i-[:]][\c-[:]]*)?:)?.+\]" /> <xs:minLength value="3"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="SafeCURIEs"> <xs:list itemType="xh11d:SafeCURIE"/> </xs:simpleType> <xs:simpleType name="URIorCURIE"> <xs:union memberTypes="xs:anyURI xh11d:CURIE" /> </xs:simpleType> <xs:simpleType name="URIorCURIEs"> <xs:list itemType="xh11d:URIorCURIE"/> </xs:simpleType> <xs:simpleType name="URIorSafeCURIE"> <xs:union memberTypes="xs:anyURI xh11d:SafeCURIE" /> </xs:simpleType> <xs:simpleType name="URIorSafeCURIEs"> <xs:list itemType="xh11d:URIorSafeCURIE"/> </xs:simpleType> </xs:schema>
The following informative XML DTD definition for these datatypes is included as an example:
<!ENTITY % CURIE.datatype "CDATA" > <!ENTITY % CURIEs.datatype "CDATA" > <!ENTITY % SafeCURIE.datatype "CDATA" > <!ENTITY % SafeCURIEs.datatype "CDATA" > <!ENTITY % URIorCURIE.datatype "CDATA" > <!ENTITY % URIorCURIEs.datatype "CDATA" > <!ENTITY % URIorSafeCURIE.datatype "CDATA" > <!ENTITY % URIorSafeCURIEs.datatype "CDATA" >
The
RDFa
Term
Assignment
Vocabulary
is
used
to
modify
RDFa
processing
behavior.
Its
URI
is
http://www.w3.org/ns/rdfa#
.
The Vocabulary includes the following term definitions (shown here in Turtle [ TURTLE ] format):
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdfa: <http://www.w3.org/ns/rdfa#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . rdfa:VocabularyMapping a rdfs:Class . rdfa:PrefixMapping a rdfs:Class; rdfs:subClassOf rdfa:VocabularyMapping . rdfa:TermMapping a rdfs:Class . rdfs:subClassOf rdfa:VocabularyMapping . [ a owl:AllDisjointClasses ; owl:members ( rdfa:PrefixMapping rdfa:TermMapping ) . ] rdfa:uri a rdf:Property, owl:FunctionalProperty, owl:DatatypeProperty . rdfs:range xsd:anyURI ; rdfs:domain rdfa:VocabularyMapping . rdfa:prefix a rdf:Property, owl:FunctionalProperty, owl:DatatypeProperty . rdfs:range xsd:NMTOKEN ; rdfs:domain rdfa:PrefixMapping . rdfa:term a rdf:Property, owl:FunctionalProperty, owl:DatatypeProperty . rdfs:range xsd:NMTOKEN ; rdfs:domain rdfa:TermMapping .
This vocabulary is also available in an separate file in Turtle format.
These predicates can be used to 'pair' URI strings and their usage in the form of a prefix and/or a term as part of, eg, a blank node. An example can be as follows:
[ rdfa:uri "http://xmlns.com/foaf/0.1/name" ; rdfa:prefix "foaf" ]
which defines a prefix for the foaf URI.
This section is non-normative.
2010-02-25: Split into RDFa Core and XHTML +RDFa.
2010-01-01: Applied changes to start production of version 1.1. This includes the re-integration of datatype URIorCURIE.
2008-10-19: Added appendix with XML Schema implementation.
2008-06-03: Added informative section on XHTML Fragments. Also ensured that we say "namespace" when we mean XML Namespace, and "prefix" when we mean the front part of a CURIE. [ShaneMcCarron]
2008-05-15: Moved section on bnode references in CURIEs into Chapter 5 (which is normative). Also fixed some term definitions that referred to "document" to refer to "resource". [ShaneMcCarron]
2008-05-12: Changed processing rules 4 and 5 to look for the presence of @rel and @rev, rather than whether they have valid values. That is checked later. [MarkBirbeck]
2008-05-09: Removed reference to "reserved values" in the context of @about : about does not take reserved values. [ShaneMcCarron]
2008-05-08: Added informative reference to the XHTML Vocabulary definition document. [ShaneMcCarron]
2008-05-01: Changed datatype name from URIorCURIE to URIorSafeCURIE. Added datatype implementation in Appendix B. Added text about preferring inline content to @content so you do not lose ability to have rich markup. [ShaneMcCarron]
2008-04-29: Changed processing rules so as to allow the generation of triples that have objects which are bnodes, even if those bnodes never appear in a triple as a subject. [MarkBirbeck]
2008-04-28: The processing rules have been updated so that elements that do not contain any RDFa attributes have no effect. At one point this step omitted to check for @property , meaning that elements that contained only @property were being ignored. [MarkBirbeck]
2008-04-03:
Changed
instanceof
to
@typeof
.
[ShaneMcCarron]
2008-01-23: Updated to reflect latest task-force thinking re- the processing of legacy values in @rel and @rev . As part of this work, made the whole processing of CURIEs and URIs much clearer. [MarkBirbeck]
2008-01-03:
Updated
to
reflect
latest
task-force
thinking
re-
the
processing
model,
in
particular
regarding
'chaining',
and
the
behaviour
of
instanceof
.
[MarkBirbeck]
2007-10-19: Updated to reflect latest task-force thinking re: processing model. Integrated XHTML Module definition and hybrid markup language. Completed development as First Public Working Draft. [ShaneMcCarron], [MarkBirbeck]
2007-09-04: Migrated to XHTML 2 Working Group Publication System. Converted to a format that is consistent with REC-Track documents. Updated to reflect current processing model. Added normative definition of CURIEs. Started updating prose to be consistent with current task force agremeents. [ShaneMcCarron], [StevenPemberton], [MarkBirbeck]
2007-04-06: fixed some of the language to talk about "structure" rather than metadata. Added note regarding space-separated values in predicate-denoting attributes. [BenAdida]
2006-01-16: made the use of CURIE type for @rel , @rev , @property consistent across document (particularly section 2.4 was erroneous). [BenAdida]
This section is non-normative.
At the time of publication, the members of the Semantic Web Deployment Working Group were:
At the time of publication, the members in the XHTML 2 Working Group were: