You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1702 lines
106 KiB
1702 lines
106 KiB
<?xml version='1.0' encoding='UTF-8'?>
|
|
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML+RDFa 1.0//EN' 'http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd'>
|
|
<html dir="ltr" about="" property="dcterms:language" content="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:dcterms='http://purl.org/dc/terms/' xmlns:bibo='http://purl.org/ontology/bibo/' xmlns:foaf='http://xmlns.com/foaf/0.1/' xmlns:xsd='http://www.w3.org/2001/XMLSchema#'>
|
|
<head>
|
|
<title>RDFa 1.1 Primer</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
<!--
|
|
=== NOTA BENE === For the three scripts below, if your spec resides on dev.w3 you can check them out in the same tree and use relative links so that they'll work offline, -->
|
|
|
|
<style type="text/css">
|
|
code { font-family: monospace; }
|
|
span.hilite { color: red; /* font-weight: bold */ }
|
|
a.figurelink:hover { background:white !important}
|
|
div.figure { font-size: 90%}
|
|
</style>
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
/*****************************************************************
|
|
* ReSpec CSS
|
|
* Robin Berjon (robin at berjon dot com)
|
|
* v0.05 - 2009-07-31
|
|
*****************************************************************/
|
|
|
|
|
|
/* --- INLINES --- */
|
|
em.rfc2119 {
|
|
text-transform: lowercase;
|
|
font-variant: small-caps;
|
|
font-style: normal;
|
|
color: #900;
|
|
}
|
|
|
|
h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
|
|
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
|
|
border: none;
|
|
}
|
|
|
|
dfn {
|
|
font-weight: bold;
|
|
}
|
|
|
|
a.internalDFN {
|
|
color: inherit;
|
|
border-bottom: 1px solid #99c;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a.externalDFN {
|
|
color: inherit;
|
|
border-bottom: 1px dotted #ccc;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a.bibref {
|
|
text-decoration: none;
|
|
}
|
|
|
|
code {
|
|
color: #ff4500;
|
|
}
|
|
|
|
|
|
/* --- WEB IDL --- */
|
|
pre.idl {
|
|
border-top: 1px solid #90b8de;
|
|
border-bottom: 1px solid #90b8de;
|
|
padding: 1em;
|
|
line-height: 120%;
|
|
}
|
|
|
|
pre.idl::before {
|
|
content: "WebIDL";
|
|
display: block;
|
|
width: 150px;
|
|
background: #90b8de;
|
|
color: #fff;
|
|
font-family: initial;
|
|
padding: 3px;
|
|
font-weight: bold;
|
|
margin: -1em 0 1em -1em;
|
|
}
|
|
|
|
.idlType {
|
|
color: #ff4500;
|
|
font-weight: bold;
|
|
text-decoration: none;
|
|
}
|
|
|
|
/*.idlModule*/
|
|
/*.idlModuleID*/
|
|
/*.idlInterface*/
|
|
.idlInterfaceID, .idlDictionaryID {
|
|
font-weight: bold;
|
|
color: #005a9c;
|
|
}
|
|
|
|
.idlSuperclass {
|
|
font-style: italic;
|
|
color: #005a9c;
|
|
}
|
|
|
|
/*.idlAttribute*/
|
|
.idlAttrType, .idlFieldType, .idlMemberType {
|
|
color: #005a9c;
|
|
}
|
|
.idlAttrName, .idlFieldName, .idlMemberName {
|
|
color: #ff4500;
|
|
}
|
|
.idlAttrName a, .idlFieldName a, .idlMemberName a {
|
|
color: #ff4500;
|
|
border-bottom: 1px dotted #ff4500;
|
|
text-decoration: none;
|
|
}
|
|
|
|
/*.idlMethod*/
|
|
.idlMethType {
|
|
color: #005a9c;
|
|
}
|
|
.idlMethName {
|
|
color: #ff4500;
|
|
}
|
|
.idlMethName a {
|
|
color: #ff4500;
|
|
border-bottom: 1px dotted #ff4500;
|
|
text-decoration: none;
|
|
}
|
|
|
|
/*.idlParam*/
|
|
.idlParamType {
|
|
color: #005a9c;
|
|
}
|
|
.idlParamName {
|
|
font-style: italic;
|
|
}
|
|
|
|
.extAttr {
|
|
color: #666;
|
|
}
|
|
|
|
/*.idlConst*/
|
|
.idlConstType {
|
|
color: #005a9c;
|
|
}
|
|
.idlConstName {
|
|
color: #ff4500;
|
|
}
|
|
.idlConstName a {
|
|
color: #ff4500;
|
|
border-bottom: 1px dotted #ff4500;
|
|
text-decoration: none;
|
|
}
|
|
|
|
/*.idlException*/
|
|
.idlExceptionID {
|
|
font-weight: bold;
|
|
color: #c00;
|
|
}
|
|
|
|
.idlTypedefID, .idlTypedefType {
|
|
color: #005a9c;
|
|
}
|
|
|
|
.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
|
|
color: #c00;
|
|
font-weight: normal;
|
|
}
|
|
|
|
.excName a {
|
|
font-family: monospace;
|
|
}
|
|
|
|
.idlRaises a.idlType, .excName a.idlType {
|
|
border-bottom: 1px dotted #c00;
|
|
}
|
|
|
|
.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
|
|
width: 45px;
|
|
text-align: center;
|
|
}
|
|
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; }
|
|
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; }
|
|
|
|
.idlImplements a {
|
|
font-weight: bold;
|
|
}
|
|
|
|
dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
|
|
margin-left: 2em;
|
|
}
|
|
|
|
.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
|
|
font-weight: normal;
|
|
}
|
|
|
|
.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
|
|
font-weight: bold;
|
|
color: #000;
|
|
font-family: monospace;
|
|
}
|
|
|
|
.attributes dt code, .fields dt code, .dictionary-members dt code {
|
|
background: #ffffd2;
|
|
}
|
|
|
|
.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
|
|
color: #005a9c;
|
|
background: transparent;
|
|
font-family: inherit;
|
|
font-weight: normal;
|
|
font-style: italic;
|
|
}
|
|
|
|
.methods dt code {
|
|
background: #d9e6f8;
|
|
}
|
|
|
|
.constants dt code {
|
|
background: #ddffd2;
|
|
}
|
|
|
|
.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
|
|
margin-bottom: 1em;
|
|
}
|
|
|
|
table.parameters, table.exceptions {
|
|
border-spacing: 0;
|
|
border-collapse: collapse;
|
|
margin: 0.5em 0;
|
|
width: 100%;
|
|
}
|
|
table.parameters { border-bottom: 1px solid #90b8de; }
|
|
table.exceptions { border-bottom: 1px solid #deb890; }
|
|
|
|
.parameters th, .exceptions th {
|
|
color: #fff;
|
|
padding: 3px 5px;
|
|
text-align: left;
|
|
font-family: initial;
|
|
font-weight: normal;
|
|
text-shadow: #666 1px 1px 0;
|
|
}
|
|
.parameters th { background: #90b8de; }
|
|
.exceptions th { background: #deb890; }
|
|
|
|
.parameters td, .exceptions td {
|
|
padding: 3px 10px;
|
|
border-top: 1px solid #ddd;
|
|
vertical-align: top;
|
|
}
|
|
|
|
.parameters tr:first-child td, .exceptions tr:first-child td {
|
|
border-top: none;
|
|
}
|
|
|
|
.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
|
|
width: 100px;
|
|
}
|
|
|
|
.parameters td.prmType {
|
|
width: 120px;
|
|
}
|
|
|
|
table.exceptions table {
|
|
border-spacing: 0;
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
}
|
|
|
|
/* --- TOC --- */
|
|
.toc a {
|
|
text-decoration: none;
|
|
}
|
|
|
|
a .secno {
|
|
color: #000;
|
|
}
|
|
|
|
/* --- TABLE --- */
|
|
table.simple {
|
|
border-spacing: 0;
|
|
border-collapse: collapse;
|
|
border-bottom: 3px solid #005a9c;
|
|
}
|
|
|
|
.simple th {
|
|
background: #005a9c;
|
|
color: #fff;
|
|
padding: 3px 5px;
|
|
text-align: left;
|
|
}
|
|
|
|
.simple th[scope="row"] {
|
|
background: inherit;
|
|
color: inherit;
|
|
border-top: 1px solid #ddd;
|
|
}
|
|
|
|
.simple td {
|
|
padding: 3px 10px;
|
|
border-top: 1px solid #ddd;
|
|
}
|
|
|
|
.simple tr:nth-child(even) {
|
|
background: #f0f6ff;
|
|
}
|
|
|
|
/* --- DL --- */
|
|
.section dd > p:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.section dd > p:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.section dd {
|
|
margin-bottom: 1em;
|
|
}
|
|
|
|
.section dl.attrs dd, .section dl.eldef dd {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
/* --- EXAMPLES --- */
|
|
pre.example {
|
|
border-top: 1px solid #ff4500;
|
|
border-bottom: 1px solid #ff4500;
|
|
padding: 1em;
|
|
margin-top: 1em;
|
|
}
|
|
|
|
pre.example::before {
|
|
content: "Example";
|
|
display: block;
|
|
width: 150px;
|
|
background: #ff4500;
|
|
color: #fff;
|
|
font-family: initial;
|
|
padding: 3px;
|
|
font-weight: bold;
|
|
margin: -1em 0 1em -1em;
|
|
}
|
|
|
|
/* --- EDITORIAL NOTES --- */
|
|
.issue {
|
|
padding: 1em;
|
|
margin: 1em 0em 0em;
|
|
border: 1px solid #f00;
|
|
background: #ffc;
|
|
}
|
|
|
|
.issue::before {
|
|
content: "Issue";
|
|
display: block;
|
|
width: 150px;
|
|
margin: -1.5em 0 0.5em 0;
|
|
font-weight: bold;
|
|
border: 1px solid #f00;
|
|
background: #fff;
|
|
padding: 3px 1em;
|
|
}
|
|
|
|
.note {
|
|
margin: 1em 0em 0em;
|
|
padding: 1em;
|
|
border: 2px solid #cff6d9;
|
|
background: #e2fff0;
|
|
}
|
|
|
|
.note::before {
|
|
content: "Note";
|
|
display: block;
|
|
width: 150px;
|
|
margin: -1.5em 0 0.5em 0;
|
|
font-weight: bold;
|
|
border: 1px solid #cff6d9;
|
|
background: #fff;
|
|
padding: 3px 1em;
|
|
}
|
|
|
|
/* --- Best Practices --- */
|
|
div.practice {
|
|
border: solid #bebebe 1px;
|
|
margin: 2em 1em 1em 2em;
|
|
}
|
|
|
|
span.practicelab {
|
|
margin: 1.5em 0.5em 1em 1em;
|
|
font-weight: bold;
|
|
font-style: italic;
|
|
}
|
|
|
|
span.practicelab { background: #dfffff; }
|
|
|
|
span.practicelab {
|
|
position: relative;
|
|
padding: 0 0.5em;
|
|
top: -1.5em;
|
|
}
|
|
|
|
p.practicedesc {
|
|
margin: 1.5em 0.5em 1em 1em;
|
|
}
|
|
|
|
@media screen {
|
|
p.practicedesc {
|
|
position: relative;
|
|
top: -2em;
|
|
padding: 0;
|
|
margin: 1.5em 0.5em -1em 1em;
|
|
}
|
|
}
|
|
|
|
/* --- SYNTAX HIGHLIGHTING --- */
|
|
pre.sh_sourceCode {
|
|
background-color: white;
|
|
color: black;
|
|
font-style: normal;
|
|
font-weight: normal;
|
|
}
|
|
|
|
pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; } /* language keywords */
|
|
pre.sh_sourceCode .sh_type { color: #666; } /* basic types */
|
|
pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
|
|
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
|
|
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
|
|
pre.sh_sourceCode .sh_specialchar { color: #ffc0cb; font-family: monospace; } /* e.g., \n, \t, \\ */
|
|
pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; } /* comments */
|
|
pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
|
|
pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; } /* e.g., #include, import */
|
|
pre.sh_sourceCode .sh_symbol { color: blue; } /* e.g., *, + */
|
|
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
|
|
pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
|
|
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; } /* TODO and FIXME */
|
|
|
|
/* Predefined variables and functions (for instance glsl) */
|
|
pre.sh_sourceCode .sh_predef_var { color: #00008B; }
|
|
pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }
|
|
|
|
/* for OOP */
|
|
pre.sh_sourceCode .sh_classname { color: teal; }
|
|
|
|
/* line numbers (not yet implemented) */
|
|
pre.sh_sourceCode .sh_linenum { display: none; }
|
|
|
|
/* Internet related */
|
|
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
|
|
|
|
/* for ChangeLog and Log files */
|
|
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
|
|
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
|
|
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }
|
|
|
|
/* for Prolog, Perl... */
|
|
pre.sh_sourceCode .sh_variable { color: #006400; }
|
|
|
|
/* for LaTeX */
|
|
pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
|
|
pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
|
|
pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
|
|
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
|
|
pre.sh_sourceCode .sh_argument { color: #006400; }
|
|
pre.sh_sourceCode .sh_optionalargument { color: purple; }
|
|
pre.sh_sourceCode .sh_math { color: orange; }
|
|
pre.sh_sourceCode .sh_bibtex { color: blue; }
|
|
|
|
/* for diffs */
|
|
pre.sh_sourceCode .sh_oldfile { color: orange; }
|
|
pre.sh_sourceCode .sh_newfile { color: #006400; }
|
|
pre.sh_sourceCode .sh_difflines { color: blue; }
|
|
|
|
/* for css */
|
|
pre.sh_sourceCode .sh_selector { color: purple; }
|
|
pre.sh_sourceCode .sh_property { color: blue; }
|
|
pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }
|
|
|
|
/* other */
|
|
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
|
|
pre.sh_sourceCode .sh_paren { color: red; }
|
|
pre.sh_sourceCode .sh_attribute { color: #006400; }
|
|
|
|
</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css" charset="utf-8" /></head>
|
|
<body style="display: inherit; "><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C" /></a></p><h1 property="dcterms:title" class="title" id="title">RDFa 1.1 Primer</h1><h2 property="bibo:subtitle" id="subtitle">Rich Structured Data Markup for Web Documents</h2><h2 property="dcterms:issued" datatype="xsd:dateTime" content="2011-12-08T10:57:36+0000" id="w3c-working-draft-08-december-2011"><acronym title="World Wide Web Consortium">W3C</acronym> Working Draft 08 December 2011</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2011/WD-rdfa-primer-20111208/">http://www.w3.org/TR/2011/WD-rdfa-primer-20111208/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/rdfa-primer/">http://www.w3.org/TR/rdfa-primer/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://www.w3.org/2010/02/rdfa/sources/rdfa-primer/">http://www.w3.org/2010/02/rdfa/sources/rdfa-primer/</a></dd><dt>Previous version:</dt><dd><a rel="dcterms:replaces" href="http://www.w3.org/TR/2011/WD-rdfa-primer-20110419/">http://www.w3.org/TR/2011/WD-rdfa-primer-20110419/</a></dd><dt>Editors:</dt><dd rel="bibo:editor"><span typeof="foaf:Person"><a rel="foaf:homepage" property="foaf:name" content="Ben Adida" href="http://ben.adida.net/">Ben Adida</a>, <a rel="foaf:workplaceHomepage" href="http://creativecommons.org/">Creative Commons</a></span>
|
|
</dd>
|
|
<dd rel="bibo:editor"><span typeof="foaf:Person"><a rel="foaf:homepage" property="foaf:name" content="Ivan Herman" href="http://www.w3.org/People/Ivan/">Ivan Herman</a>, <a rel="foaf:workplaceHomepage" href="http://www.w3.org"><acronym title="World Wide Web Consortium">W3C</acronym></a></span>
|
|
</dd>
|
|
<dd rel="bibo:editor"><span typeof="foaf:Person"><a rel="foaf:homepage" property="foaf:name" content="Manu Sporny" href="http://manu.sporny.org">Manu Sporny</a>, <a rel="foaf:workplaceHomepage" href="http://digitalbazaar.com/">Digital Bazaar</a></span>
|
|
</dd>
|
|
<dt>Author:</dt><dd rel="dcterms:contributor"><span typeof="foaf:Person"><a rel="foaf:homepage" property="foaf:name" content="Mark Birbeck" href="http://webbackplane.com/mark-birbeck">Mark Birbeck</a>, <a rel="foaf:workplaceHomepage" href="http://webbackplane.com/">webBackPlane.com</a></span>
|
|
</dd>
|
|
<dt>Alternates:</dt><dd><a href="diff-20110419.html">Diff-marked version</a></dd>
|
|
</dl><p class="copyright"><a rel="license" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2010-2011 <span rel="dcterms:publisher"><span typeof="foaf:Organization"><a rel="foaf:homepage" property="foaf:name" content="World Wide Web Consotrium" href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup></span></span> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr /></div>
|
|
<div id="abstract" class="introductory section" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" about="#abstract"><h2>Abstract</h2>
|
|
<p> The last couple of years have witnessed a fascinating
|
|
evolution: while the Web was initially built predominantly for
|
|
human consumption, web content is increasingly consumed by
|
|
machines which expect some amount of structured data. Sites have
|
|
started to identify a page’s title, content type, and preview
|
|
image to provide appropriate information in a user’s newsfeed
|
|
when she clicks the “Like” button. Search engines have started
|
|
to provide richer search results by extracting fine-grained
|
|
structured details from the Web pages they crawl. In turn, web
|
|
publishers are producing increasing amounts of structured data
|
|
within their Web content to improve their standing with search
|
|
engines. </p>
|
|
<p> A key enabling technology behind these developments is the
|
|
ability to add structured data to HTML pages directly. RDFa
|
|
(Resource Description Framework in Attributes) is a technique
|
|
that allows just that: it provides a set of markup attributes to
|
|
augment the visual information on the Web with machine-readable
|
|
hints. In this Primer, we show how to express data using RDFa in
|
|
HTML, and in particular how to mark up existing human-readable
|
|
Web page content to express machine-readable data. </p>
|
|
<p> This document provides only a Primer to RDFa. The complete
|
|
specification of RDFa, with further examples, can be found in
|
|
the RDFa 1.1 Core [<cite><a class="bibref" rel="biblioentry" href="#bib-RDFA-CORE">RDFA-CORE</a></cite>], the XHTML+RDFa 1.1
|
|
[<cite><a class="bibref" rel="biblioentry" href="#bib-XHTML-RDFA">XHTML-RDFA</a></cite>], and the HTML5+RDFa 1.1 [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML-RDFA">HTML-RDFA</a></cite>]
|
|
specifications. </p>
|
|
</div><div id="sotd" class="introductory section" typeof="bibo:Chapter" about="#sotd"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports index</a> at http://www.w3.org/TR/.</em></p><p>This document was published by the <a href="http://www.w3.org/2010/02/rdfa/">RDF Web Applications Working Group</a> as a Working Draft. This document is intended to become a <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation. If you wish to make comments regarding this document, please send them to <a href="mailto:public-rdfa-wg@w3.org">public-rdfa-wg@w3.org</a> (<a href="mailto:public-rdfa-wg-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-rdfa-wg/">archives</a>). All feedback is welcome.</p><p>Publication as a Working Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> 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.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>. <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/44350/status" rel="disclosure">public list of any patent disclosures</a> 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 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.</p></div><div id="toc" typeof="bibo:Chapter" about="#toc" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#html-vs.-xhtml" class="tocxref"><span class="secno">1.1 </span>HTML vs. XHTML</a></li><li class="tocline"><a href="#validation" class="tocxref"><span class="secno">1.2 </span>Validation</a></li></ul></li><li class="tocline"><a href="#adding-machine-readable-hints-to-web-pages" class="tocxref"><span class="secno">2. </span>Adding Machine-Readable Hints to Web Pages</a><ul class="toc"><li class="tocline"><a href="#hints-on-social-networking-sites" class="tocxref"><span class="secno">2.1 </span>Hints on Social Networking Sites</a></li><li class="tocline"><a href="#indicating-title-in-the-text" class="tocxref"><span class="secno">2.2 </span>Indicating Title in the Text</a></li><li class="tocline"><a href="#links-with-flavor-1" class="tocxref"><span class="secno">2.3 </span>Links with Flavor</a></li><li class="tocline"><a href="#setting-a-default-vocabulary" class="tocxref"><span class="secno">2.4 </span>Setting a Default Vocabulary</a></li><li class="tocline"><a href="#multiple-items-per-page" class="tocxref"><span class="secno">2.5 </span>Multiple Items per Page</a></li></ul></li><li class="tocline"><a href="#going-deeper" class="tocxref"><span class="secno">3. </span>Going Deeper</a><ul class="toc"><li class="tocline"><a href="#contact-information" class="tocxref"><span class="secno">3.1 </span>Contact Information</a></li><li class="tocline"><a href="#describing-social-networks" class="tocxref"><span class="secno">3.2 </span>Describing Social Networks</a></li><li class="tocline"><a href="#internal-references" class="tocxref"><span class="secno">3.3 </span>Internal References</a></li><li class="tocline"><a href="#using-multiple-vocabularies" class="tocxref"><span class="secno">3.4 </span>Using Multiple Vocabularies</a><ul class="toc"><li class="tocline"><a href="#default-prefixes--initial-context" class="tocxref"><span class="secno">3.4.1 </span>Default Prefixes (Initial Context)</a></li></ul></li></ul></li><li class="tocline"><a href="#rdfa-tools" class="tocxref"><span class="secno">4. </span>RDFa Tools</a></li><li class="tocline"><a href="#some-more-advanced-rdfa-examples" class="tocxref"><span class="secno">5. </span>Some More Advanced RDFa Examples</a><ul class="toc"><li class="tocline"><a href="#importing-data" class="tocxref"><span class="secno">5.1 </span>Importing Data</a></li><li class="tocline"><a href="#automatic-summaries" class="tocxref"><span class="secno">5.2 </span>Automatic Summaries</a></li><li class="tocline"><a href="#address-visualization" class="tocxref"><span class="secno">5.3 </span>Address Visualization</a></li><li class="tocline"><a href="#linked-data-mashups" class="tocxref"><span class="secno">5.4 </span>Linked Data Mashups</a></li><li class="tocline"><a href="#enhanced-browser-interfaces" class="tocxref"><span class="secno">5.5 </span>Enhanced Browser Interfaces</a></li><li class="tocline"><a href="#publication-lists" class="tocxref"><span class="secno">5.6 </span>Publication lists</a></li></ul></li><li class="tocline"><a href="#you-said-something-about-rdf" class="tocxref"><span class="secno">6. </span>You Said Something about RDF?</a><ul class="toc"><li class="tocline"><a href="#custom-vocabularies" class="tocxref"><span class="secno">6.1 </span>Custom Vocabularies</a></li></ul></li><li class="tocline"><a href="#acknowledgments" class="tocxref"><span class="secno">7. </span>Acknowledgments</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.2 </span>Informative references</a></li></ul></li></ul></div>
|
|
<div id="introduction" typeof="bibo:Chapter" about="#introduction" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">1. </span>Introduction</h2>
|
|
<p> The web is a rich, distributed repository of interconnected
|
|
information. Until recently, it was organized primarily for
|
|
human consumption. On a typical web page, an HTML author might
|
|
specify a headline, then a smaller sub-headline, a block of
|
|
italicized text, a few paragraphs of average-size text, and,
|
|
finally, a few single-word links. Web browsers will follow these
|
|
presentation instructions faithfully. However, only the human
|
|
mind understands what the headline expresses—a blog post title.
|
|
The sub-headline indicates the author, the italicized text is
|
|
the article's publication date, and the single-word links are
|
|
subject categories. Computers do not understand the nuances
|
|
between the information; the gap between what programs and
|
|
humans understand is large. </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a class="figurelink" href="diagrams/presentation-vs-semantics.svg"><img src="diagrams/presentation-vs-semantics.png" alt="presentation vs. semantics" /></a>
|
|
<p><a id="fig1"><em>Figure 1</em></a>: On the left, what
|
|
browsers see. On the right, what humans see. Can we bridge the
|
|
gap so that browsers see more of what we see?</p>
|
|
</div>
|
|
<p> What if the browser, or any machine consumer such as a Web
|
|
crawler, received information on the meaning of a web page’s
|
|
visual elements? A dinner party announced on a blog could be
|
|
easily copied to the user’s calendar, an author’s complete
|
|
contact information to the user’s address book. Users could
|
|
automatically recall previously browsed articles according to
|
|
categorization labels (i.e., tags). A photo copied and pasted
|
|
from a web site to a school report would carry with it a link
|
|
back to the photographer, giving him proper credit. A link
|
|
shared by a user to his social network contacts would
|
|
automatically carry additional data pulled from the original web
|
|
page: a thumbnail, an author, and a specific title. When web
|
|
data meant for humans is augmented with hints meant for computer
|
|
programs, these programs become significantly more helpful,
|
|
because they begin to understand the data’s structure. </p>
|
|
<p> RDFa allows HTML authors to do just that. Using a few simple
|
|
HTML attributes, authors can mark up human-readable data with
|
|
machine-readable indicators for browsers and other programs to
|
|
interpret. A web page can include markup for items as simple as
|
|
the title of an article, or as complex as a user's complete
|
|
social network. </p>
|
|
<p> RDFa benefits from the power of RDF [<cite><a class="bibref" rel="biblioentry" href="#bib-RDF-PRIMER">RDF-PRIMER</a></cite>], the <acronym title="World Wide Web Consortium">W3C</acronym>’s
|
|
standard for interoperable machine-readable data. However,
|
|
readers of this document are not expected to understand RDF,
|
|
only a basic level of HTML. </p>
|
|
<div id="html-vs.-xhtml" typeof="bibo:Chapter" about="#html-vs.-xhtml" class="section">
|
|
<h3><span class="secno">1.1 </span>HTML vs. XHTML</h3>
|
|
<p> Historically, RDFa 1.0 [<cite><a class="bibref" rel="biblioentry" href="#bib-RDFA-SYNTAX">RDFA-SYNTAX</a></cite>] was specified only
|
|
for XHTML. RDFa 1.1 [<cite><a class="bibref" rel="biblioentry" href="#bib-RDFA-CORE">RDFA-CORE</a></cite>] is the newest version and
|
|
the one used in this document. RDFa 1.1 is specified for both
|
|
XHTML [<cite><a class="bibref" rel="biblioentry" href="#bib-XHTML-RDFA">XHTML-RDFA</a></cite>] and HTML5 [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML-RDFA">HTML-RDFA</a></cite>]. In fact, RDFa
|
|
1.1 also works for any XML-based languages like SVG [<cite><a class="bibref" rel="biblioentry" href="#bib-SVG12">SVG12</a></cite>].
|
|
This document uses HTML in all of the examples; for
|
|
simplicity, we use the term “HTML” throughout this document to
|
|
refer to all of the HTML-family languages. </p>
|
|
</div>
|
|
<div id="validation" typeof="bibo:Chapter" about="#validation" class="section">
|
|
<h3><span class="secno">1.2 </span>Validation</h3>
|
|
<p>RDFa is based on attributes. While some of the HTML
|
|
attributes (e.g., <code>href</code>, <code>rel</code>) have
|
|
been re-used, other RDFa 1.1 attributes are new. This is
|
|
important because some of the (X)HTML validators may not
|
|
properly validate the HTML code until they are updated to
|
|
recognize the new RDFa 1.1 attributes. This is rarely a
|
|
problem in practice since browsers simply ignore attributes
|
|
that they do not recognize. None of the RDFa-specific
|
|
attributes have any effect on the visual display of the HTML
|
|
content. Authors do not have to worry about pages marked up
|
|
with RDFa looking any different to a human being from pages
|
|
not marked up with RDFa.</p>
|
|
</div>
|
|
</div>
|
|
<div id="adding-machine-readable-hints-to-web-pages" typeof="bibo:Chapter" about="#adding-machine-readable-hints-to-web-pages" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">2. </span>Adding Machine-Readable Hints to Web Pages</h2>
|
|
<p>Consider Alice, a blogger who publishes a mix of professional
|
|
and personal articles at <code>http://example.com/alice</code>.
|
|
We will construct markup examples to illustrate how Alice can
|
|
use RDFa. The complete markup of these examples are available <a href="http://www.w3.org/2010/02/rdfa/sources/rdfa-primer/alice-example.html">on a dedicated page</a>. </p>
|
|
<div id="hints-on-social-networking-sites" typeof="bibo:Chapter" about="#hints-on-social-networking-sites" class="section">
|
|
<h3><span class="secno">2.1 </span>Hints on Social Networking Sites</h3>
|
|
<p>Alice publishes a blog and would like to provide extra
|
|
structural information on her pages like the publication date
|
|
or the subject. She would like to use the terms defined in the
|
|
Dublin Core vocabulary [<cite><a class="bibref" rel="biblioentry" href="#bib-DC11">DC11</a></cite>], a set of terms that are
|
|
widely used by, for example, the publishing industry or
|
|
libraries. She can do this easily by using RDFa:</p>
|
|
<pre class="example"><html>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/created" content="2011-09-10"</span> />
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/subject" content="photography"</span> />
|
|
...
|
|
</head>
|
|
...</pre>
|
|
<p>(Notice the markup colored in red: these are the RDFa
|
|
“hints”.)</p>
|
|
<p> One useful way to visualize the structured data is: </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a class="figurelink" href="diagrams/title-and-author.svg"> <img src="diagrams/title-and-author.png" alt="relationship value is text" />
|
|
</a>
|
|
<p><a id="fig2"><em>Figure 2</em></a>: A visualization of the
|
|
structured data for a blog post with a title of “The Trouble
|
|
with Bob”, a creation date and a subject.</p>
|
|
</div>
|
|
<p> It is worth emphasizing that RDFa uses URLs to identify just about everything.
|
|
This is why, instead of just using properties like <code>title</code>
|
|
and <code>created</code>, we use <code>http://purl.org/dc/terms/title</code>
|
|
and <code>http://purl.org/dc/terms/created</code>. The reason
|
|
behind this design decision is rooted in data portability,
|
|
consistency, and information sharing. Using URLs removes the
|
|
possibility for ambiguities in terminology. Without ensuring
|
|
that there is no ambiguity, the term “title” might mean “the
|
|
title of a work”, “a job title”, or “the deed for real-estate
|
|
property”. When each vocabulary term is a URL, a detailed
|
|
explanation for the vocabulary term is just one click away. It
|
|
allows anything, humans or machines, to follow the link to
|
|
find out what a particular vocabulary term means. By using a
|
|
URL to identify a particular type of title, for example <a href="http://purl.org/dc/terms/date">http://purl.org/dc/terms/created</a>,
|
|
both humans and machines can understand that the URL
|
|
unambiguously refers to the “Date of creation of the
|
|
resource”, such as a web page.</p>
|
|
<p> By using URLs as identifiers, RDFa provides a solid way of
|
|
disambiguating vocabulary terms. It becomes trivial to
|
|
determine whether or not vocabulary terms used in different
|
|
documents mean the same thing. If the URLs are the same, the
|
|
vocabulary terms mean the same thing. It also becomes very
|
|
easy to create new vocabulary terms and vocabulary documents.
|
|
If one can publish a document to the Web, one automatically
|
|
has the power to create a new vocabulary document containing
|
|
new vocabulary terms. </p>
|
|
</div>
|
|
<div id="indicating-title-in-the-text" typeof="bibo:Chapter" about="#indicating-title-in-the-text" class="section">
|
|
<h3><span class="secno">2.2 </span>Indicating Title in the Text</h3>
|
|
<p> As Alice adds her Dublin Core metadata, she notices that the
|
|
title of her page is already in the visible markup: </p>
|
|
<pre class="example"><div>
|
|
<h2>The trouble with Bob</h2>
|
|
<h3>Alice</h3>
|
|
...
|
|
</div></pre>
|
|
<p> Alice can use the RDFa <code>property</code> attribute on
|
|
the <code>h2</code> HTML element to indicate that this
|
|
existing rendered text should also be machine-readable text
|
|
indicating the page’s title: </p>
|
|
<pre class="example"><div>
|
|
<h2 <span class="hilite">property="http://purl.org/dc/terms/title"</span>>The trouble with Bob</h2>
|
|
<h3>Alice</h3>
|
|
...
|
|
</div></pre>
|
|
<p> Note that in the example above, Alice did not need to use
|
|
the <code>content</code> attribute, but could instead use the
|
|
text that already existed in the document. The <code>property</code>
|
|
attribute can be used on <em>any</em> element; by default, it
|
|
takes the text content of that element except if the <code>content</code>
|
|
attribute is present which then takes priority.</p>
|
|
</div>
|
|
<div id="links-with-flavor-1" typeof="bibo:Chapter" about="#links-with-flavor-1" class="section">
|
|
<h3><span class="secno">2.3 </span><span id="links-with-flavor">Links with Flavor</span></h3>
|
|
<p> The previous example demonstrated how Alice can markup text
|
|
to make it machine readable. She would also like to mark up
|
|
the links in a machine-readable way, to express the type of
|
|
link being described. RDFa lets the publisher add a “flavor”
|
|
to an existing clickable link that machine processors can
|
|
understand. This makes the same markup help both humans and
|
|
machines. </p>
|
|
<p> In her blog’s footer, Alice already declares her content to
|
|
be freely reusable, as long as she receives due credit when
|
|
her articles are cited. The HTML includes a link to a Creative
|
|
Commons [<cite><a class="bibref" rel="biblioentry" href="#bib-CC-ABOUT">CC-ABOUT</a></cite>] license: </p>
|
|
<pre class="example"><p>All content on this site is licensed under
|
|
<a href="http://creativecommons.org/licenses/by/3.0/">
|
|
a Creative Commons License</a>.</p></pre>
|
|
<p> A human clearly understands this sentence, in particular the
|
|
<em>meaning</em> of the link with respect to the current
|
|
document: it indicates the document’s license, the conditions
|
|
under which the page’s contents are distributed.
|
|
Unfortunately, when Bob visits Alice’s blog, his browser sees
|
|
only a plain link that could just as well point to one of
|
|
Alice’s friends or to her CV. For Bob’s browser to understand
|
|
that this link actually points to the document’s licensing
|
|
terms, Alice needs to add some <em>flavor</em>, some
|
|
indication of what <em>kind</em> of link this is. </p>
|
|
<p> She can add this flavor using again the <code>property</code>
|
|
attribute. Indeed, when the element contains the <code>href</code> attribute,
|
|
<code>property</code> is automatically associated with the value of this attribute
|
|
rather than the textual content of the <code>a</code> element. The value of the
|
|
attribute is the <code>http://creativecommons.org/ns#license</code>,
|
|
defined by the Creative Commons: </p>
|
|
<pre class="example"><p>All content on this site is licensed under
|
|
<a <span class="hilite">property="http://creativecommons.org/ns#license"</span> href="http://creativecommons.org/licenses/by/3.0/">
|
|
a Creative Commons License</a>.</p></pre>
|
|
<p> With this small update, Bob’s browser will now understand
|
|
that this link has a flavor: it indicates the blog’s license:
|
|
</p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a class="figurelink" href="diagrams/license.svg"> <img src="diagrams/license.png" alt="two Web pages connected by a link labeled 'license' and two notes with a 'license' relationship" />
|
|
</a>
|
|
<p><a id="fig3"><em>Figure 3</em></a>: A link with flavor: the
|
|
link indicates the web page’s license. We can represent web
|
|
pages as nodes, the link as an arrow connecting those nodes,
|
|
and the link’s flavor as the label on that arrow.</p>
|
|
</div>
|
|
<p> Alice is quite pleased that she was able to add only
|
|
structured-data hints via RDFa, never having to repeat the
|
|
content of her text or the URL of her clickable links. </p>
|
|
</div>
|
|
<div id="setting-a-default-vocabulary" typeof="bibo:Chapter" about="#setting-a-default-vocabulary" class="section">
|
|
<h3><span class="secno">2.4 </span>Setting a Default Vocabulary</h3>
|
|
<p> In a number of simple use cases, such as our example with
|
|
Alice’s blog, HTML authors will predominantly use a single
|
|
vocabulary. On the other hand, while generating full URLs via
|
|
a CMS system is not a particular problem, typing these by hand
|
|
may be error prone and tedious for humans. To alleviate this
|
|
problem RDFa introduces the <code>vocab</code> attribute to
|
|
let the author declare a single vocabulary for a chunk of
|
|
HTML. Thus, instead of:</p>
|
|
<pre class="example"><html>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/created" content="2011-09-10"</span> />
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/subject" content="photography"</span> />
|
|
...
|
|
</head>
|
|
...</pre>
|
|
<p> Alice can write: </p>
|
|
<pre class="example"><html <span class="hilite">vocab="http://purl.org/dc/terms/"</span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="created" content="2011-09-10"</span> />
|
|
<meta <span class="hilite">property="subject" content="photography"</span> />
|
|
...
|
|
</head>
|
|
...</pre>
|
|
<p> Note how the property values are single “terms” now; these
|
|
are simply concatenated to the URL defined via the <code>vocab</code>
|
|
attribute. The attribute can be placed on any HTML element
|
|
(i.e., not only on the <code>html</code> element like in the
|
|
example) and its effect is valid for all the elements below
|
|
that point. </p>
|
|
<p>Default vocabularies and full URIs can be mixed at any time.
|
|
I.e., Alice could have written:</p>
|
|
<pre class="example"><html <span class="hilite">vocab="http://purl.org/dc/terms/"</span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="created" content="2011-09-10"</span> />
|
|
<meta <span class="hilite">property="http://purl.org/dc/terms/subject" content="photography"</span> />
|
|
...
|
|
</head>
|
|
...</pre>
|
|
<p>Perhaps a more interesting example is the combination of the
|
|
header with the licensing segment of her web page:</p>
|
|
<pre class="example"><html <span class="hilite">vocab="http://purl.org/dc/terms/"</span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="created" content="2011-09-10"</span> />
|
|
<meta <span class="hilite">property="subject" content="photography"</span> />
|
|
...
|
|
</head>
|
|
<body>
|
|
...
|
|
<p>All content on this site is licensed under
|
|
<a <span class="hilite">property="http://creativecommons.org/ns#license"</span> href="http://creativecommons.org/licenses/by/3.0/">
|
|
a Creative Commons License</a>.</p>
|
|
</body>
|
|
</html></pre>
|
|
<p>The full URL for the license term is necessary to avoid
|
|
mixing vocabularies. Of course, Alice could have also written:</p>
|
|
<pre class="example"><html <span class="hilite">vocab="http://purl.org/dc/terms/"</span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="created" content="2011-09-10"</span> />
|
|
<meta <span class="hilite">property="subject" content="photography"</span> />
|
|
...
|
|
</head>
|
|
<body>
|
|
...
|
|
<p <span class="hilite">vocab="http://creativecommons.org/ns#"</span>>All content on this site is licensed under
|
|
<a <span class="hilite">property="license"</span> href="http://creativecommons.org/licenses/by/3.0/">
|
|
a Creative Commons License</a>.</p>
|
|
</body>
|
|
</html></pre>
|
|
<p>because the <code>vocab</code> in the license paragraph
|
|
overrides the definition inherited from the top of the
|
|
document.</p>
|
|
</div>
|
|
<div id="multiple-items-per-page" typeof="bibo:Chapter" about="#multiple-items-per-page" class="section">
|
|
<h3><span class="secno">2.5 </span>Multiple Items per Page</h3>
|
|
<p> Alice’s blog contains, of course, multiple entries.
|
|
Sometimes, Alice’s sister Eve guest blogs, too. The front page
|
|
of the blog lists the 10 most recent entries, each with its
|
|
own title, author, and introductory paragraph. How, then,
|
|
should Alice mark up the title of each of these entries
|
|
individually even though they all appear within the same web
|
|
page? RDFa provides <code>about</code>, an attribute for
|
|
specifying the exact URL to which the contained RDFa markup
|
|
applies: </p>
|
|
<pre class="example"><div <span class="hilite">vocab="http://purl.org/dc/terms/"</span>>
|
|
|
|
<div <span class="hilite">about="/alice/posts/trouble_with_bob"</span>>
|
|
<h2 <span class="hilite">property="title"</span>>The trouble with Bob</h2>
|
|
<h3 <span class="hilite">property="creator"</span>>Alice</h3>
|
|
...
|
|
</div>
|
|
|
|
<div <span class="hilite">about="/alice/posts/jos_barbecue"</span>>
|
|
<h2 <span class="hilite">property="title"</span>>Jo's Barbecue</h2>
|
|
<h3 <span class="hilite">property="creator"</span>>Eve</h3>
|
|
...
|
|
</div>
|
|
|
|
...
|
|
|
|
</div> </pre>
|
|
<p>(Note that we used relative URLs in the example; the value of
|
|
<code>about</code> could have been <em>any</em> URLs,
|
|
relative or absolute.) We can represent this, once again, as a
|
|
diagram connecting URLs to properties: </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/multiple-blog-entries.svg" class="figurelink">
|
|
<img src="diagrams/multiple-blog-entries.png" alt="two separate nodes, each with two properties" />
|
|
</a>
|
|
<p><a id="fig4"><em>Figure 4</em></a>: Multiple Items per
|
|
Page: each blog entry is represented by its own node, with
|
|
properties attached to each. </p>
|
|
</div>
|
|
<p> Alice can use the same technique to give her friend Bob
|
|
proper credit when she posts one of his photos: </p>
|
|
<pre class="example"><div <span class="hilite">about="/alice/posts/trouble_with_bob"</span>>
|
|
<h2 <span class="hilite">property="title"</span>>The trouble with Bob</h2>
|
|
|
|
The trouble with Bob is that he takes much better photos than I do:
|
|
|
|
<div <span class="hilite">about="http://example.com/bob/photos/sunset.jpg"</span>>
|
|
<img src="http://example.com/bob/photos/sunset.jpg" />
|
|
<span <span class="hilite">property="title"</span>>Beautiful Sunset</span>
|
|
by <span <span class="hilite">property="creator"</span>>Bob</span>.
|
|
</div>
|
|
</div> </pre>
|
|
<p> Notice how the innermost <code>about</code> value, <code>http://example.com/bob/photos/sunset.jpg</code>,
|
|
“overrides” the outer value <code>/alice/posts/trouble_with_bob</code>
|
|
for all markup inside the innermost <code>div</code>. And,
|
|
once again, here is a diagram that abstractly represents the
|
|
underlying data of this new portion of markup: </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/image-about.svg" class="figurelink"> <img src="diagrams/image-about.png" alt="two separate nodes, each with two properties" /> </a>
|
|
<p><a id="fig5"><em>Figure 5</em></a>: Describing a Photo</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="going-deeper" typeof="bibo:Chapter" about="#going-deeper" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">3. </span>Going Deeper</h2>
|
|
<div id="contact-information" typeof="bibo:Chapter" about="#contact-information" class="section">
|
|
<h3><span class="secno">3.1 </span>Contact Information</h3>
|
|
<p> Alice would also like to make information about herself,
|
|
such as her email address, phone number, and other details,
|
|
easily available to her friends’ contact management software.
|
|
This time, instead of describing the properties of a web page,
|
|
she’s going to describe the properties of a person: herself.
|
|
To do this, she adds deeper structure, so that she can connect
|
|
multiple items that themselves have properties. </p>
|
|
<p> Alice already has contact information displayed on her blog.
|
|
</p>
|
|
<pre class="example"><span>
|
|
Alice Birpemswick,
|
|
Email: <a href="mailto:alice@example.com">alice@example.com</a>,
|
|
Phone: <a href="tel:+1-617-555-7332">+1 617.555.7332</a>
|
|
</span></pre>
|
|
<p> The Dublin Core vocabulary does not provide property names
|
|
for describing contact information, but the Friend-of-a-Friend
|
|
[<cite><a class="bibref" rel="biblioentry" href="#bib-FOAF">FOAF</a></cite>] vocabulary does. Alice decides to use the FOAF
|
|
vocabulary and declares a FOAF “Person”. For this purpose,
|
|
Alice uses <code>typeof</code>, an RDFa attribute that is
|
|
specifically meant to declare a new data item with a certain
|
|
type: </p>
|
|
<pre class="example"><span <span class="hilite">typeof="http://xmlns.com/foaf/0.1/Person"</span>>
|
|
...</pre>
|
|
<p> Alice realizes that she only intends to use the FOAF
|
|
vocabulary at this point, so she uses the <code>vocab</code>
|
|
attribute to further simplify her markup (and overriding the
|
|
effects of any <code>vocab</code> attributes that may have
|
|
been used in, for example, the <code>html</code> element at
|
|
the top). </p>
|
|
<pre class="example"><span <span class="hilite">vocab="http://xmlns.com/foaf/0.1/" typeof="Person"</span>>
|
|
...</pre>
|
|
<p> Then, Alice indicates which content on the page represents
|
|
her full name, email address, and phone number: </p>
|
|
<pre class="example"><span <span class="hilite">vocab="http://xmlns.com/foaf/0.1/" typeof="Person"</span>>
|
|
<span <span class="hilite">property="name"</span>>Alice Birpemswick</span>,
|
|
Email: <a <span class="hilite">property="mbox"</span> href="mailto:alice@example.com">alice@example.com</a>,
|
|
Phone: <a <span class="hilite">property="phone"</span> href="tel:+1-617-555-7332">+1 617.555.7332</a>
|
|
</span></pre>
|
|
<p> Note how Alice did not specify <code>about</code> like she
|
|
did when adding blog entry metadata. If she is not declaring
|
|
what she is talking about, how does the RDFa Processor know
|
|
what she’s identifying? In RDFa, in the absence of an <code>about</code> attribute, the <code>typeof</code>
|
|
attribute on the enclosing <code>div</code> implicitly sets
|
|
the subject of the properties marked up within that <code>div</code>.
|
|
That is, the name, email address, and phone number are
|
|
associated with a new node of type <code>Person</code>. This
|
|
node has no URL to identify it, so it is called a <em>blank
|
|
node</em> as shown on the figure: </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/contact-info.svg" class="figurelink"> <img src="diagrams/contact-info.png" alt="single 'blank' node with 4 properties" />
|
|
</a>
|
|
<p><a id="fig6"><em>Figure 6</em></a>: A Blank Node: blank
|
|
nodes are not identified by URL. Instead, many of them have
|
|
an RDFa <code>typeof</code> attribute that identifies the
|
|
type of data they represent. <br />
|
|
(We’ve used a short-hands to label the arrows, in order to
|
|
save space and clarify the diagram. The actual labels are
|
|
always the full URLs.)</p>
|
|
</div>
|
|
<p>Of course, Alice could also decide to use a real URI for
|
|
herself instead of a blank node. Adding an <code>about</code>
|
|
attribute would do just that:</p>
|
|
<pre class="example"><span <span class="hilite">vocab="http://xmlns.com/foaf/0.1/" about="#me" typeof="Person"</span>>
|
|
<span <span class="hilite">property="name"</span>>Alice Birpemswick</span>,
|
|
Email: <a <span class="hilite">property="mbox"</span> href="mailto:alice@example.com">alice@example.com</a>,
|
|
Phone: <a <span class="hilite">property="phone"</span> href="tel:+1-617-555-7332">+1 617.555.7332</a>
|
|
</span></pre>
|
|
<p>It is considered as a good practice to use real URIs whenever possible, i.e., Alice’s second alternative
|
|
should be preferred. If a real URI is used, then it becomes possible to unambigously refer to that particular
|
|
node, whereas that becomes much more complicated with blank nodes.</p>
|
|
|
|
<p class="note">The <code>about="#me"</code> markup is a FOAF
|
|
convention: the URL that represents the <em>person</em> Alice
|
|
is <code>http://example.com/alice#me</code>. It should not be
|
|
confused with Alice’s homepage, <code>http://example.com/alice</code>.
|
|
</p>
|
|
</div>
|
|
<div id="describing-social-networks" typeof="bibo:Chapter" about="#describing-social-networks" class="section">
|
|
<h3><span class="secno">3.2 </span>Describing Social Networks</h3>
|
|
<p> Alice continues to mark up her page by adding information
|
|
about her friends, including at least their names and
|
|
homepages. She starts with plain old HTML: </p>
|
|
<pre class="example"><div>
|
|
<ul>
|
|
<li>
|
|
<a href="http://example.com/bob/">Bob</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://example.com/eve/">Eve</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://example.com/manu/">Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div></pre>
|
|
<p>First, Alice indicates that the friends she is describing are
|
|
people, as opposed to animals or imaginary friends, by using
|
|
the type <code>Person</code> in <code>typeof</code>
|
|
attributes. </p>
|
|
<pre class="example"><div <span class="hilite">vocab="http://xmlns.com/foaf/0.1/"</span>>
|
|
<ul>
|
|
<li <span class="hilite">typeof="Person"</span>>
|
|
<a href="http://example.com/bob/">Bob</a>
|
|
</li>
|
|
<li <span class="hilite">typeof="Person"</span>>
|
|
<a href="http://example.com/eve/">Eve</a>
|
|
</li>
|
|
<li <span class="hilite">typeof="Person"</span>>
|
|
<a href="http://example.com/manu/">Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div> </pre>
|
|
<p>Beyond declaring the type of data we are dealing with, each <code>typeof</code>
|
|
creates a new blank node with its own distinct properties, all
|
|
without having to provide URL identifiers. Thus, Alice can
|
|
easily indicate each friend’s homepage: </p>
|
|
<pre class="example"><div vocab="http://xmlns.com/foaf/0.1/">
|
|
<ul>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">property="homepage"</span> href="http://example.com/bob/">Bob</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">property="homepage"</span> href="http://example.com/eve/">Eve</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">property="homepage"</span> href="http://example.com/manu/">Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div> </pre>
|
|
<p>Alice would also like to improve the markup by expressing each person’s name using
|
|
RDFa, too. However, the <code>property</code> attribute cannot be used for this purpose; indeed,
|
|
<code>property</code> is automatically associated with <code>href</code> in this case. Instead,
|
|
Alice can use the <code>rel</code> attribute. This attribute will pick up the value of
|
|
<code>href</code> and, in the presence of <code>rel</code>, <code>property</code> will
|
|
use the textual content of the element instead. I.e., Alice can write:</p>
|
|
<pre class="example"><div vocab="http://xmlns.com/foaf/0.1/">
|
|
<ul>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">rel="homepage"</span> href="http://example.com/bob/" <span class="hilite">property="name"</span>>Bob</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">rel="homepage"</span> href="http://example.com/eve/" <span class="hilite">property="name"</span>>Eve</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">rel="homepage"</span> href="http://example.com/manu/" <span class="hilite">property="name"</span>>Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div> </pre>
|
|
<p> Using <code>property</code>, Alice has specified that the
|
|
linked text (“Bob”, “Eve”, and “Manu”) are her friends’ names; with <code>rel</code>;
|
|
with <code>rel</code>, she indicates that the clickable links
|
|
are her friends’ homepages. She could not have used <code>rel</code>
|
|
to be associated with the linked text; this attribute can be used
|
|
<em>exclusively</em> with links like the one in the <code>href</code> attribute.
|
|
</p>
|
|
<p>Note that <code>rel</code> can be used at any time, not only in association with <code>property</code>.
|
|
It can also be used <em>instead of</em> <code>property</code> when used with <code>href</code>; i.e.,
|
|
the example above, without the linked texts, could have been written as:
|
|
</p>
|
|
<pre class="example"><div vocab="http://xmlns.com/foaf/0.1/">
|
|
<ul>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">rel="homepage"</span> href="http://example.com/bob/">Bob</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">rel="homepage"</span> href="http://example.com/eve/">Eve</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a <span class="hilite">rel="homepage"</span> href="http://example.com/manu/">Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div> </pre>
|
|
|
|
<p>Alice is happy that, with so
|
|
little additional markup, she’s able to fully express both a
|
|
pleasant human-readable page and a machine-readable dataset. </p>
|
|
<p> Alice is a member of 5 different social networking sites.
|
|
She is tired of repeatedly entering information about her
|
|
friends in each new social networking site, so she decides to
|
|
list her friends in one place—on her website. With RDFa, she
|
|
can indicate her friendships on her own web page and let
|
|
social networking sites read it automatically. So far, Alice
|
|
has listed three individuals but has not specified her
|
|
relationship with them; they might be her friends, or they
|
|
might be her favorite 17th century poets. To indicate that she
|
|
knows them, she uses the FOAF property <code>foaf:knows</code>:
|
|
</p>
|
|
<pre class="example"><div vocab="http://xmlns.com/foaf/0.1/" <span class="hilite">about="#me"</span> >
|
|
<ul>
|
|
<li <span class="hilite">property="knows"</span> typeof="Person">
|
|
<a rel="homepage" href="http://example.com/bob" property="name">Bob</a>
|
|
</li>
|
|
<li <span class="hilite">property="knows"</span> typeof="Person">
|
|
<a rel="homepage" href="http://example.com/eve" property="name">Eve</a>
|
|
</li>
|
|
<li <span class="hilite">property="knows"</span> typeof="Person">
|
|
<a rel="homepage" href="http://example.com/manu" property="name">Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div> </pre>
|
|
<p>With this, Alice could describe here social network:</p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/social-network.svg" class="figurelink"> <img src="diagrams/social-network.png" alt="8 node network with 12 relationships" />
|
|
</a>
|
|
<p><a id="fig7"><em>Figure 7</em></a>: Alice’s social network</p>
|
|
</div>
|
|
<p>Note that Alice had to repeat the <code>property="knows"</code>. When there are only a few persons in her
|
|
social network, that may be fine, but it might become error prone in some other cases: she may forget to
|
|
add that attribute. An alternative is to use the <code>rel</code> attribute instead. In most of the
|
|
cases <code>rel</code> has a similar behavior to <code>property</code>, but it also has the concept of
|
|
<em>chaining</em> that can be used as follows:</p>
|
|
<pre class="example"><div vocab="http://xmlns.com/foaf/0.1/" about="#me" <span class="hilite">rel="knows"</span>>
|
|
<ul>
|
|
<li typeof="Person">
|
|
<a rel="homepage" href="http://example.com/bob" property="name">Bob</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a rel="homepage" href="http://example.com/eve" property="name">Eve</a>
|
|
</li>
|
|
<li typeof="Person">
|
|
<a rel="homepage" href="http://example.com/manu" property="name">Manu</a>
|
|
</li>
|
|
</ul>
|
|
</div> </pre>
|
|
<p>Using <code>rel="knows"</code> <em>once</em> at the
|
|
top-most <code>div</code> is enough to connect Bob, Eve, and
|
|
Manu to Alice. This is achieved thanks
|
|
<em>chaining</em>: because the top-level <code>rel</code> is
|
|
without a corresponding <code>href</code>, it connects to any
|
|
contained node. In this case the three nodes defined by <code>typeof</code>.
|
|
</p>
|
|
</div>
|
|
<div id="internal-references" typeof="bibo:Chapter" about="#internal-references" class="section">
|
|
<h3><span class="secno">3.3 </span>Internal References</h3>
|
|
<p>Alice may want to add her personal data to her individual
|
|
blog items, too. She decides to combine her FOAF data with the
|
|
blog items, i.e.:</p>
|
|
<pre class="example"><div vocab="http://purl.org/dc/terms/">
|
|
|
|
<div about="/alice/posts/trouble_with_bob">
|
|
<h2 property="title">The trouble with Bob</h2>
|
|
<h3 <span class="hilite">rel="creator"</span>>
|
|
<span vocab="http://xmlns.com/foaf/0.1/" <span class="hilite">about="#me"</span> typeof="Person">
|
|
<span property="name">Alice Birpemswick</span>,
|
|
Email: <a rel="mbox" href="mailto:alice@example.com">alice@example.com</a>,
|
|
Phone: <a rel="phone" href="tel:+1-617-555-7332">+1 617.555.7332</a>
|
|
</span>
|
|
</h3>
|
|
...
|
|
</div>
|
|
...
|
|
</div> </pre>
|
|
<p>Note the usage of the <code>rel</code> attribute instead of
|
|
<code>property</code> for the Dublin Core <code>creator</code>
|
|
term; this is because the data now involves more than just a
|
|
simple text. The structured data she generates looks like
|
|
this:</p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/blog-with-foaf.svg" class="figurelink"> <img src="diagrams/blog-with-foaf.png" alt="The simple blog structure extended with Alice's foaf data" />
|
|
</a>
|
|
<p><a id="fig8"><em>Figure 8</em></a>: Alice’s blog item with
|
|
data about herself.</p>
|
|
</div>
|
|
<p>Unfortunately, this solution is not optimal. Indeed, Alice
|
|
would like to design her Web page so that her personal data
|
|
would not appear on the page in each individual blog item but,
|
|
rather, in one place like a footnote or a sidebar. What she
|
|
would like to see is something like:</p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<img src="diagrams/blog-screenshot.jpg" alt="Mock-up of Alice's blog page design, with blogs on the left and personal data on the right" />
|
|
<p><a id="fig9"><em>Figure 9</em></a>: Structure of Alice’s
|
|
Site: individual blog items on the left, personal data, linked from the blog using RDFa terms, in a
|
|
sidebar.</p>
|
|
</div>
|
|
<p>If the FOAF data is included into each blog item, Alice would
|
|
have to create a complex set of CSS rules to achieve the
|
|
visual effect she wants. Instead, Alice decides to use another
|
|
RDFa attribute, namely <code>resource</code>:</p>
|
|
<pre class="example"><div vocab="http://purl.org/dc/terms/">
|
|
<div about="/alice/posts/trouble_with_bob">
|
|
<h2 property="title">The trouble with Bob</h2>
|
|
<h3 <span class="hilite">rel="creator" resource="#me"</span>>Alice</h3>
|
|
...
|
|
</div>
|
|
</div>
|
|
...
|
|
<div class="sidebar">
|
|
...
|
|
<span vocab="http://xmlns.com/foaf/0.1/" <span class="hilite">about="#me"</span> typeof="Person">
|
|
<span property="name">Alice Birpemswick</span>,
|
|
Email: <a rel="mbox" href="mailto:alice@example.com">alice@example.com</a>,
|
|
Phone: <a rel="phone" href="tel:+1-617-555-7332">+1 617.555.7332</a>
|
|
</span>
|
|
</div> </pre>
|
|
<p>The <code>resource</code> attribute plays exactly the same role as <code>href</code>
|
|
but does not provide a clickable link to the browser like <code>href</code>
|
|
does. Also, <code>resource</code> can be used on <em>any</em>
|
|
HTML element, in contrast to <code>href</code>. In this case,
|
|
usage of this attribute allows Alice to “distribute” the
|
|
various parts of the structured data on her page, although the
|
|
data itself is identical to the one on the previous example,
|
|
shown on <a href="#fig8">Figure 8</a>.</p>
|
|
</div>
|
|
<div id="using-multiple-vocabularies" typeof="bibo:Chapter" about="#using-multiple-vocabularies" class="section">
|
|
<h3><span class="secno">3.4 </span>Using Multiple Vocabularies</h3>
|
|
<p>The previous examples show that, for more complex cases,
|
|
multiple vocabularies have to be used to express the various
|
|
aspects of structured data. We have seen Alice using the
|
|
Dublin Core, as well as the FOAF and the Creative Commons
|
|
vocabularies, but there may be more. For example:</p>
|
|
<ul>
|
|
<li>She plans to install a plugin into her blog software so
|
|
that her social networking site’s “Like” button appears at
|
|
the bottom of each of her posts. In order to give her social
|
|
networking site information about her blog posts’ title,
|
|
thumbnail, and content type, she may want to use the Open
|
|
Graph Protocol [<cite><a class="bibref" rel="biblioentry" href="#bib-OGP">OGP</a></cite>] vocabulary to mark up her content.</li>
|
|
<li>She may want to add more information on her blog, to make
|
|
use of <a href="http://rdfs.org/sioc/applications/">specialized
|
|
engines</a> that can process the SIOC
|
|
(Semantically-Interlinked Online Communities) vocabulary
|
|
[<cite><a class="bibref" rel="biblioentry" href="#bib-SIOC">SIOC</a></cite>], a vocabulary that has been developed for the
|
|
Social Web.
|
|
</li>
|
|
</ul>
|
|
<p>Of course, Alice can use either full URLs for all the terms,
|
|
or can use the <code>vocab</code> attribute to abbreviate the
|
|
terms for the predominant vocabulary. But, in some cases, the
|
|
vocabularies cannot be separated easily, which means that <code>vocab</code>
|
|
may not solve all the problems. Here is, for example, the type
|
|
of HTML she might end up with:</p>
|
|
<pre class="example"><html <span class="hilite">vocab="http://purl.org/dc/terms/"</span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="http://ogp.me/ns#title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="http://ogp.me/ns#type" content="text"</span> />
|
|
<meta <span class="hilite">property="http://ogp.me/ns#image" content="http://example.com/alice/bob-ugly.jpg"</span> />
|
|
<meta <span class="hilite">property="subject" content="photography"</span> />
|
|
<meta <span class="hilite">property="created" content="2011-09-10"</span> />
|
|
...
|
|
</head>
|
|
<body>
|
|
<div <span class="hilite">typeof="http://rdfs.org/sioc/ns#Post"</span>>
|
|
<h2 <span class="hilite">property="title"</span>>The trouble with Bob</h2>
|
|
<h3 <span class="hilite">property="creator"</span>>Alice</h3>
|
|
<p <span class="hilite">property="http://rdfs.org/sioc/ns#content"</span>>The trouble with Bob is that he takes much better photos than I do:</p>
|
|
...
|
|
</div>
|
|
...
|
|
</body>
|
|
</html></pre>
|
|
<p>Note that the SIOC and the Dublin Core terms are intertwined
|
|
for a specific blog, and it becomes an arbitrary choice to use
|
|
<code>vocab</code> for <code>http://purl.org/dc/terms/</code>
|
|
or for <code>http://rdfs.org/sioc/ns#</code>. The same holds
|
|
for the header, which contains both Dublin Core and Open Graph
|
|
Protocol terms.</p>
|
|
<p>To alleviate this problem, RDFa offers the possibility of using <em>prefixed</em>
|
|
terms: a special <code>prefix</code> attribute can assign
|
|
prefixes to represent URLs and, using those prefixes, the
|
|
vocabulary elements themselves can be abbreviated. The <code>prefix:reference</code>
|
|
syntax is used: the URL associated with <code>prefix</code>
|
|
is simply concatenated to <code>reference</code> to create a
|
|
full URL. Here is how the HTML of the previous example looks
|
|
like when prefixes are used:</p>
|
|
<pre class="example"><html <span class="hilite">prefix="dc: http://purl.org/dc/terms/ sioc: http://rdfs.org/sioc/ns# og: http://ogp.me/ns#" </span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="og:title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="og:type" content="text"</span> />
|
|
<meta <span class="hilite">property="og:image" content="http://example.com/alice/bob-ugly.jpg"</span> />
|
|
<meta <span class="hilite">property="dc:subject" content="photography"</span> />
|
|
<meta <span class="hilite">property="dc:created" content="2011-09-10"</span> />
|
|
...
|
|
</head>
|
|
<body>
|
|
<div <span class="hilite">typeof="sioc:Post"</span>>
|
|
<h2 <span class="hilite">property="dc:title"</span>>The trouble with Bob</h2>
|
|
<h3 <span class="hilite">property="dc:creator"</span>>Alice</h3>
|
|
<p <span class="hilite">property="sioc:content"</span>>The trouble with Bob is that he takes much better photos than I do:</p>
|
|
...
|
|
</div>
|
|
</body>
|
|
</html></pre>
|
|
<p>The usage of prefixes can greatly reduce possible errors by
|
|
concentrating the vocabulary choices to one place in the code.
|
|
Just like <code>vocab</code>, the <code>prefix</code>
|
|
attribute can appear anywhere in the HTML file, only affecting
|
|
the elements below. <code>prefix</code> and <code>vocab</code> can also be mixed, for example:</p>
|
|
|
|
<pre class="example"><html <span class="hilite">vocab="http://purl.org/dc/terms/"</span> <span class="hilite">prefix="sioc: http://rdfs.org/sioc/ns# og: http://ogp.me/ns#" </span>>
|
|
<head>
|
|
<title>The Trouble with Bob</title>
|
|
<meta <span class="hilite">property="og:title" content="The Trouble with Bob"</span> />
|
|
<meta <span class="hilite">property="og:type" content="text"</span> />
|
|
<meta <span class="hilite">property="og:image" content="http://example.com/alice/bob-ugly.jpg"</span> />
|
|
<meta <span class="hilite">property="subject" content="photography"</span> />
|
|
<meta <span class="hilite">property="created" content="2011-09-10"</span> />
|
|
...
|
|
</head>
|
|
<body>
|
|
<div <span class="hilite">typeof="sioc:Post"</span>>
|
|
<h2 <span class="hilite">property="dc:title"</span>>The trouble with Bob</h2>
|
|
<h3 <span class="hilite">property="creator"</span>>Alice</h3>
|
|
<p <span class="hilite">property="sioc:content"</span>>The trouble with Bob is that he takes much better photos than I do:</p>
|
|
...
|
|
</div>
|
|
</body>
|
|
</html></pre>
|
|
<div class="note"> An important issue may arise if the <code>html</code>
|
|
element contains a large number of prefix declarations. The
|
|
character encoding (i.e., UTF-8, UTF-16, ascii, etc.) used for an HTML5 file is declared using a meta
|
|
element in the header. In HTML5 this meta declaration must
|
|
fall within the first 512 bytes of the page, or the HTML5
|
|
processor (browser, parser, etc.) will try to detect the
|
|
encoding some using heuristics. A very “long” <code>html</code>
|
|
tag may therefore lead to problems. One way of avoiding the
|
|
issue is to place most of the prefix declarations on the <code>body</code>
|
|
element.</div>
|
|
<div id="default-prefixes--initial-context" typeof="bibo:Chapter" about="#default-prefixes--initial-context" class="section">
|
|
<h4><span class="secno">3.4.1 </span><span id="default-profiles">Default Prefixes (Initial Context)</span></h4>
|
|
<p>A number of vocabularies
|
|
are very widely used by the Web community with well-known prefixes—the Dublin Core
|
|
vocabulary is a good example. These common vocabularies tend
|
|
to be defined over and over again, and sometimes Web page
|
|
authors forget to declare them altogether.</p>
|
|
<p>To alleviate this issue, RDFa 1.1 has the concept of an <em>initial
|
|
context</em> that defined a set of default prefixes.
|
|
These prefixes, whose list is maintained and regularly updated (i.e., new prefixes added) by the <acronym title="World Wide Web Consortium">W3C</acronym>,
|
|
provide a number of pre-defined prefixes that are known to
|
|
the RDFa processor. Prefix declarations in a document always
|
|
override declarations made through the defaults, but if a
|
|
web page author forgets to declare a common vocabulary such
|
|
as Dublin Core or FOAF, the RDFa Processor will fall back to
|
|
those. The list of default prefixes are, of course,
|
|
<a href="http://www.w3.org/2011/rdfa-context/rdfa-1.1">available on the Web</a> for everyone to read.</p>
|
|
<p>For example, the following example does <em>not</em>
|
|
declare the <code>dc:</code> prefix using a <code>prefix</code>
|
|
attribute:</p>
|
|
<pre class="example"><html>
|
|
<head>
|
|
<meta <span class="hilite">property="dc:title"</span> content="The trouble with Bob" />
|
|
<meta <span class="hilite">property="dc:created"</span> content="2011-09-10" />
|
|
...
|
|
</head
|
|
...
|
|
</html></pre>
|
|
<p>However, an RDFa processor still recognizes the <code>dc:title</code>
|
|
and <code>dc:creator</code> short-hands and expands the
|
|
values to the corresponding URLs. The RDFa processor is able
|
|
to do this because the <code>dc</code> prefix is part of
|
|
the default prefixes in the initial
|
|
<a href="http://www.w3.org/2011/rdfa-context/rdfa-1.1"><code>http://www.w3.org/2011/rdfa-context/rdfa-1.1</code></a>
|
|
context.</p>
|
|
<p class="note">Default prefixes are used as a mechanism to
|
|
correct RDFa documents where authors accidentally forgot to
|
|
declare common prefixes. While authors may rely on these
|
|
to be available for RDFa 1.1 documents, the
|
|
prefixes may change over the course of 5-10 years, although
|
|
the policy of <acronym title="World Wide Web Consortium">W3C</acronym> is that once a prefix is defined as part
|
|
of a default profile, that particular prefix will <em>not</em>
|
|
be changed or removed. Nevertheless, the best way to ensure
|
|
that the prefixes that document authors use always map to
|
|
the intent of the author is to use the <code>prefix</code>
|
|
attribute to declare these prefixes. </p>
|
|
<p>Since default prefixes are meant to be a last-resort
|
|
mechanism to help novice document authors, the markup above
|
|
is not recommended. The rest of this document will utilize
|
|
authoring best practices by declaring all prefixes in order
|
|
to make the document author’s intentions explicit.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="rdfa-tools" typeof="bibo:Chapter" about="#rdfa-tools" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">4. </span>RDFa Tools</h2>
|
|
<p>There is a wide variety of tools that can be used to generate
|
|
or process RDFa data. Good sources for these are the <a href="http://www.w3.org/2001/sw/wiki/RDFa">RDFa
|
|
page of the <acronym title="World Wide Web Consortium">W3C</acronym> Semantic Web Wiki</a>, or the <a href="http://rdfa.info/rdfa-implementations/">RDFa
|
|
Wiki’s implementation page</a>. The RDFa Wiki also contains
|
|
further examples and information on how to get involved.</p>
|
|
</div>
|
|
<div id="some-more-advanced-rdfa-examples" typeof="bibo:Chapter" about="#some-more-advanced-rdfa-examples" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">5. </span>Some More Advanced RDFa Examples</h2>
|
|
<p>This section contains a set of more advanced RDFa examples.
|
|
They are provided to help the reader understand a few more RDFa
|
|
usage patterns. Many of these examples describe not only how to
|
|
encode data into RDF but also what an application might try to
|
|
do with the data. Note that the implementation of those examples
|
|
may require programmatic access to the RDFa content.</p>
|
|
<div id="importing-data" typeof="bibo:Chapter" about="#importing-data" class="section">
|
|
<h3><span class="secno">5.1 </span>Importing Data</h3>
|
|
<p> Amy has enriched her band’s web-site to include event
|
|
information. Google Rich Snippets are used to mark up
|
|
information for search engines to use when displaying enhanced
|
|
search results. Amy also uses some JavaScript code that automatically extracts the event
|
|
information from a page and adds an entry into a personal
|
|
calendar. </p>
|
|
<p> Brian finds Amy’s web-site through Google and opens the
|
|
band’s page. He decides that he wants to go to the next
|
|
concert. Brian is able to add the details to his calendar by
|
|
clicking on the link that is automatically generated by the
|
|
JavaScript tool. The JavaScript extracts the RDFa from the web
|
|
page using, and places the event into
|
|
Brian's personal calendaring software—Google Calendar. Amy
|
|
automatically extracts
|
|
the event information from a page and adds an entry into
|
|
her personal calendar using some JavaScript code.
|
|
</p>
|
|
<pre class="example"><div <span class="hilite">vocab="http://rdf.data-vocabulary.org/#"</span> <span class="hilite">typeof="Event"</span>>
|
|
<a <span class="hilite">rel="url"</span> <span class="hilite">href="http://amyandtheredfoxies.example.com/events"</span>
|
|
<span class="hilite">property="summary"</span>>Tour Info: Amy And The Red Foxies</a>
|
|
<span <span class="hilite">property="location"</span> <span class="hilite">typeof="Organization"</span>>
|
|
<a <span class="hilite">property="url"</span> <span class="hilite">href="http://www.kammgarn.de/"</span>><span <span class="hilite">property="name"</span>>Kammgarn</span></a>
|
|
</span>
|
|
<div><img <span class="hilite">property="photo"</span> <span class="hilite">src="foxies.jpg"</span>/></div>
|
|
<span <span class="hilite">property="summary"</span>>Hey K-Town, Amy And The Red Foxies will rock Kammgarn in October.</span>
|
|
When:
|
|
<span <span class="hilite">property="startDate"</span> <span class="hilite">content="2009-10-15T19:00"</span>>15. Oct., 7:00 pm</span>-
|
|
<span <span class="hilite">property="endDate"</span> <span class="hilite">content="2009-10-15T21:00"</span>>9:00 pm</span>
|
|
Category: <span <span class="hilite">property="eventType"</span>>concert</span>
|
|
</div></pre>
|
|
<p>Note that this example also uses the <code>src</code>
|
|
attribute; just <code>href</code> is recognized by RDFa, so
|
|
is <code>src</code>. The example relates, via a link with
|
|
“flavor” to the image whose URL is <code>foxies.jpg</code>. Note also that, when using <code>rel</code> and <code>property</code>
|
|
on the same element, <code>property</code> is used to generate a literal object, whereas the <code>rel</code> is used to add
|
|
the “flavor” to the link. Finally, the example makes use of the fact that <code>property</code> (or <code>rel</code>),
|
|
when used with <code>typeof</code>, creates a blank node that becomes the subject for the statements in the subtree.</p>
|
|
</div>
|
|
<div id="automatic-summaries" typeof="bibo:Chapter" about="#automatic-summaries" class="section">
|
|
<h3><span class="secno">5.2 </span>Automatic Summaries</h3>
|
|
<p> Mary is responsible for keeping the projects section of her
|
|
company’s home page up-to-date. She wants to display
|
|
info-boxes that summarize details about the members associated
|
|
with each project. The information should appear when hovering
|
|
the mouse over the link to each member's homepage. Since each
|
|
member’s homepage is annotated with RDFa, Mary writes a script
|
|
that requests the page’s content and extracts necessary
|
|
information via the RDFa API. </p>
|
|
<p>To use unique identification for the different interest
|
|
areas, Mary decides to use URLs rather than simple text. She
|
|
chooses to use the terms defined by <a href="http://dbpedia.org">DBpedia</a>.
|
|
DBPedia is a dump of Wikipedia data that is expressed as a
|
|
vocabulary. It is widely used on the Semantic Web for
|
|
identifying concepts in the human world. The usage of the <code>resource</code>
|
|
allows her to add a reference to the human readable version of
|
|
the interest page on Wikipedia. Indeed, since both the <code>resource</code>
|
|
and the <code>href</code> attributes may appear on the same
|
|
element, the former takes precedence in RDFa while the latter
|
|
can be used to re-direct the person viewing the page to a
|
|
human-readable form of the DBPedia entry. Finally Mary uses
|
|
an RDFa script to extract this kind of information
|
|
from the HTML source in order to populate the infoboxes.</p>
|
|
<pre class="example"><div <span class="hilite">prefix="dc: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/"</span>
|
|
<span class="hilite">about="#me"</span> <span class="hilite">typeof="foaf:Person"</span>>
|
|
<span <span class="hilite">property="foaf:name"</span> <span class="hilite">content="Bob"</span>>My</span> interests are:
|
|
<ol <span class="hilite">about="#me"</span> <span class="hilite">typeof="foaf:Person"</span> <span class="hilite">rel="foaf:interest"</span>>
|
|
<li><a <span class="hilite">resource="http://dbpedia.org/resource/Semantic_Web"</span>
|
|
href="http://en.wikipedia.org/wiki/Semantic_Web">
|
|
<span <span class="hilite">property="dc:title"</span>>Semantic Web</span>
|
|
</a>
|
|
</li>
|
|
<li><a <span class="hilite">resource="http://dbpedia.org/resource/Facebook"</span>
|
|
href="http://en.wikipedia.org/wiki/Facebook">
|
|
<span <span class="hilite">property="dc:title"</span>>Facebook</span>
|
|
</a>
|
|
</li>
|
|
<li><a <span class="hilite">resource="http://dbpedia.org/resource/Twitter"</span>
|
|
href="http://en.wikipedia.org/wiki/Twitter">
|
|
<span <span class="hilite">property="dc:title"</span>>Twitter</span>
|
|
</a>
|
|
</li>
|
|
</ol>
|
|
</div></pre>
|
|
<p>Mary also uses the chaining, via the <code>rel</code> attribute, to avoid repeating that attribute on
|
|
all the entry on her interests and to set the right subject for the textual explanation of those.</p>
|
|
</div>
|
|
<div id="address-visualization" typeof="bibo:Chapter" about="#address-visualization" class="section">
|
|
<h3><span class="secno">5.3 </span>Address Visualization</h3>
|
|
<p> Richard has created a site that lists his favorite
|
|
restaurants and their locations. He doesn’t want to generate
|
|
code specific to the various mapping services on the Web.
|
|
Instead of creating specific markup for Yahoo Maps, Google
|
|
Maps, MapQuest, and Google Earth, he instead adds address
|
|
information via RDFa to each restaurant entry. This enables
|
|
him to build a general tool that extracts the address
|
|
information and access the mapping tool the user wishes. </p>
|
|
<pre class="example"><div <span class="hilite">vocab="http://www.w3.org/2006/vcard/ns#"</span> <span class="hilite">typeof="VCard"</span>>
|
|
<span <span class="hilite">property="fn"</span>>Wong Kei</span>
|
|
<span <span class="hilite">property="street-address"</span>>41-43 Wardour Street</span>
|
|
<span <span class="hilite">property="locality"</span>>London</span>, <span property="country-name">United Kingdom</span>
|
|
<span <span class="hilite">property="tel"</span>>020 74373071</span>
|
|
</div></pre>
|
|
</div>
|
|
<div id="linked-data-mashups" typeof="bibo:Chapter" about="#linked-data-mashups" class="section">
|
|
<h3><span class="secno">5.4 </span>Linked Data Mashups</h3>
|
|
<p> Marie is a chemist, researching the effects of ethanol on
|
|
the spatial orientation of animals. She writes about her
|
|
research on her blog and often makes references to chemical
|
|
compounds. She would like any reference to these compounds to
|
|
automatically have a picture of the compound's structure shown
|
|
as a tooltip, and a link to the compound’s entry on the
|
|
National Center for Biotechnology Information [NCBI] Web site.
|
|
Similarly, she would like visitors to be able to visualize the
|
|
chemical compound in the page using a new HTML5 canvas widget
|
|
she has found on the web that combines data from different
|
|
chemistry websites. </p>
|
|
<pre class="example"><div <span class="hilite">vocab="http://rdf.freebase.com/rdf/"</span>>
|
|
My latest study about the effects of
|
|
<span <span class="hilite">about="en.ethanol"</span>
|
|
<span class="hilite">typeof="http://dbpedia.org/ontology/ChemicalCompound"</span>
|
|
<span class="hilite">property="chemistry.chemical_compound.pubchem_id"</span>
|
|
<span class="hilite">content="702"</span>>ethanol</span> on mice's spatial orientation show that ...
|
|
</div></pre>
|
|
|
|
<!-- http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=702 -->
|
|
|
|
</div>
|
|
<div id="enhanced-browser-interfaces" typeof="bibo:Chapter" about="#enhanced-browser-interfaces" class="section">
|
|
<h3><span class="secno">5.5 </span>Enhanced Browser Interfaces</h3>
|
|
<p> Dave is writing a browser plugin that filters product offers
|
|
in a web page and displays an icon to buy the product or save
|
|
it to a public wishlist. The plugin searches for any mention
|
|
of product names, thumbnails, and offered prices. The
|
|
information is listed in the URL bar as an icon, and upon
|
|
clicking the icon, displayed in a sidebar in the browser. He
|
|
can then add each item to a list that is managed by the
|
|
browser plugin and published on a wishlist website. </p>
|
|
<p>Because many of his pages make use of the Good Relation
|
|
ontology [<cite><a class="bibref" rel="biblioentry" href="#bib-GR">GR</a></cite>], which is widely used to markup products, Dave
|
|
decides to make use of the <code>vocab</code> facility of
|
|
RDFa to simplify his code. He also forgets to declare the <code>rdfs</code>
|
|
prefix, but since it is defined by the RDFa default profile,
|
|
the data that he intended to express using the <code>rdfs</code>
|
|
prefix will still be extracted by all conforming RDFa
|
|
processors.</p>
|
|
<pre class="example"><div <span class="hilite">prefix="foaf: http://xmlns.com/foaf/0.1/"</span>>
|
|
|
|
<div <span class="hilite">vocab="http://purl.org/goodrelations/v1#"</span> <span class="hilite">about="#offering"</span> <span class="hilite">typeof="Offering"</span>>
|
|
<div <span class="hilite">property="foaf:page"</span> <span class="hilite">resource="http://www.amazon.com/Harry-Potter-Deathly-Hallows-Book/dp/0545139708"</span>></div>
|
|
<div <span class="hilite">property="rdfs:label"</span>>Harry Potter and the Deathly Hallows</div>
|
|
<div <span class="hilite">property="rdfs:comment"</span>>In this final, seventh installment of the Harry Potter series, J.K. Rowling
|
|
unveils in spectactular fashion the answers to the many questions that have been so eagerly
|
|
awaited. The spellbinding, richly woven narrative, which plunges, twists and turns at a
|
|
breathtaking pace, confirms the author as a mistress of storytelling, whose books will be read,
|
|
reread and read again.</div>
|
|
<div>
|
|
<img <span class="hilite">property="foaf:depiction"</span> src="http://ecx.images-amazon.com/images/I/51ynI7I-qnL._SL500_AA300_.jpg" />
|
|
</div>
|
|
<div <span class="hilite">property="hasBusinessFunction"</span> <span class="hilite">resource=http://purl.org/goodrelations/v1#Sell"</span>></div>
|
|
<div <span class="hilite">property="hasPriceSpecification" typeof="UnitPriceSpecification"</span>>Buy for
|
|
<span <span class="hilite">property="hasCurrency"</span> <span class="hilite">content="USD"</span>>$</span>
|
|
<span <span class="hilite">property="hasCurrencyValue"</span>>7.49</span>
|
|
</div> Pay via:
|
|
<span <span class="hilite">property="acceptedPaymentMethods"</span> <span class="hilite">resource="http://purl.org/goodrelations/v1#PayPal"</span>>PayPal</span>
|
|
<span <span class="hilite">property="acceptedPaymentMethods"</span> <span class="hilite">resource="http://purl.org/goodrelations/v1#MasterCard"</span>>MasterCard</span>
|
|
</div>
|
|
</div>
|
|
|
|
</div></pre>
|
|
</div>
|
|
<div id="publication-lists" typeof="bibo:Chapter" about="#publication-lists" class="section">
|
|
<h3><span class="secno">5.6 </span>Publication lists</h3>
|
|
<p>Mark wants to publish his publication list, which contains references to articles, books, book chapters, etc.
|
|
He can use the Bibliographic Ontology [<cite><a class="bibref" rel="biblioentry" href="#bib-BIBO">BIBO</a></cite>] for that purpose. However, the problem he has is that many of his
|
|
publications have co-authors and, in the publication world, the <em>order</em> of the authors in a citation is
|
|
important. </p>
|
|
<p>Mark can use the <code>inlist</code> feature of RDFa. Using this feature guarantees that the order of the
|
|
resources, as they appear in the HTML text, is preserved in terms of structured data, too:</p>
|
|
|
|
<pre class="example"><p prefix="bibo: http://purl.org/ontology/bibo/ dc: http://purl.org/dc/terms/ typeof="bibo:Chapter">
|
|
“<span property="dc:title">Semantic Annotation and Retrieval</span>”, by
|
|
<span <span class="hilite">inlist</span> property="dc:creator">Ben Adida</span>,
|
|
<span <span class="hilite">inlist</span> property="dc:creator">Mark Birbeck</span>, and
|
|
<span <span class="hilite">inlist</span> property="dc:creator">Ivan Herman</span>.
|
|
</p></pre>
|
|
</div>
|
|
</div>
|
|
<div id="you-said-something-about-rdf" typeof="bibo:Chapter" about="#you-said-something-about-rdf" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">6. </span>You Said Something about RDF?</h2>
|
|
<p> RDF, the Resource Description Framework, is the abstract data
|
|
representation we have drawn out as graphs in the examples
|
|
above. Each arrow in the graph is represented as a
|
|
subject-property-object triple: the subject is the node at the
|
|
start of the arrow, the property is the arrow itself, and the
|
|
object is the node or literal at the end of the arrow. A set of
|
|
such RDF triples is often called an “RDF graph”, and is
|
|
typically stored in what is often called a “Triple Store” or a
|
|
“Graph Store”. </p>
|
|
<p> Consider the first example graph: </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/title-and-author.svg" class="figurelink"> <img src="diagrams/title-and-author.png" alt="relationship value is text" />
|
|
</a> </div>
|
|
<p> The three RDF triples for this graph are written, using the
|
|
Turtle syntax [<cite><a class="bibref" rel="biblioentry" href="#bib-TURTLE">TURTLE</a></cite>], as follows: </p>
|
|
<pre class="example"><http://www.example.com/alice/posts/trouble_with_bob>
|
|
<http://purl.org/dc/terms/title> "The Trouble with Bob" ;
|
|
<http://purl.org/dc/terms/subject> "photography" ;
|
|
<http://purl.org/dc/terms/created> "2011-09-10" .</pre>
|
|
<p> Also, the <strong>TYPE</strong> arrows we drew are no
|
|
different from other arrows. The <strong>TYPE</strong> is just
|
|
another property that happens to be a core RDF property, namely
|
|
<code>rdf:type</code>. The <code>rdf</code> vocabulary is
|
|
located at <code>http://www.w3.org/1999/02/22-rdf-syntax-ns</code>.
|
|
The contact information example from above should thus be
|
|
diagrammed as: </p>
|
|
<div style="margin: 0pt auto; text-align: center;" class="figure">
|
|
<a href="diagrams/type.svg" class="figurelink"> <img src="diagrams/type.png" alt="blank node with rdf:type foaf:Person" /> </a> </div>
|
|
<p> The point of RDF is to provide a universal language for
|
|
expressing data. A unit of data can have any number of
|
|
properties that are expressed as URLs. These URLs can be reused
|
|
by any publisher, much like any web publisher can link to any
|
|
web page, even ones they did not create themselves. Given data,
|
|
in the form of RDF triples, collected from various locations,
|
|
and using the RDF query language SPARQL [<cite><a class="bibref" rel="biblioentry" href="#bib-RDF-SPARQL-QUERY">RDF-SPARQL-QUERY</a></cite>],
|
|
one can search for “friends of Alice’s who created items whose
|
|
title contains the word ‘Bob’,” whether those items are blog
|
|
posts, videos, calendar events, or other data types. </p>
|
|
<p> RDF is an abstract data model meant to maximize the reuse of
|
|
vocabularies. RDFa is a way to express RDF data within HTML, in
|
|
a way that is machine-readable, and by reusing the existing
|
|
human-readable data in the document. </p>
|
|
<div id="custom-vocabularies" typeof="bibo:Chapter" about="#custom-vocabularies" class="section">
|
|
<h3><span class="secno">6.1 </span>Custom Vocabularies</h3>
|
|
<p> As Alice marks up her page with RDFa, she may discover the
|
|
need to express data, such as her favorite photos, that is not
|
|
covered by existing vocabularies. If she needs to, Alice can
|
|
create a custom vocabulary suited for her needs. Once a
|
|
vocabulary is created, it can be used in RDFa markup like any
|
|
other vocabulary. </p>
|
|
<p> The instructions on how to create a vocabulary, also known
|
|
as an RDF Schema, are available in Section 5 of the RDF Primer
|
|
[<cite><a class="bibref" rel="biblioentry" href="#bib-RDF-SCHEMA">RDF-SCHEMA</a></cite>]. At a high level, the creation of a vocabulary
|
|
for RDFa involves: </p>
|
|
<ol>
|
|
<li>Selecting a URL where the vocabulary will reside, for
|
|
example: <code>http://example.com/photos/vocab#</code>.</li>
|
|
<li>Publishing the vocabulary document at the specified
|
|
vocabulary URL. The vocabulary document defines the classes
|
|
and properties that make up the vocabulary. For example,
|
|
Alice may want to define the classes <code>Photo</code> and
|
|
<code>Camera</code>, as well as the property <code>takenWith</code>
|
|
that relates a photo to the camera with which it was taken.</li>
|
|
<li>Using the vocabulary in an HTML document either with the <code>vocab</code>
|
|
attribute or with the prefix declaration mechanism. For
|
|
example: <code>prefix="photo:
|
|
http://example.com/photos/vocab#"</code> and <code>typeof="photo:Camera"</code>.</li>
|
|
</ol>
|
|
<p> It is worth noting that anyone who can publish a document on
|
|
the Web can publish a vocabulary and thus define new data
|
|
fields they may wish to express. RDF and RDFa allow fully
|
|
distributed extensibility of vocabularies. </p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="acknowledgments" typeof="bibo:Chapter" about="#acknowledgments" class="section">
|
|
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">7. </span>Acknowledgments</h2>
|
|
<p>At the time of publication, the active members of the RDF Web
|
|
Application Working Group were:</p>
|
|
<ul>
|
|
<li>Ben Adida, Creative Commons</li>
|
|
<li>Benjamin Adrian, German Research Center for Artificial
|
|
Intelligence (DFKI) GmbH</li>
|
|
<li>Mark Birbeck, webBackplane.com (Invited Expert)</li>
|
|
<li>Markus Gylling, DAISY Consortium</li>
|
|
<li>Stéphane Corlosquet, Massachusetts General Hospital</li>
|
|
<li>Jean-Pierre Evain, European Broadcasting Union</li>
|
|
<li>Ivan Herman, <acronym title="World Wide Web Consortium">W3C</acronym></li>
|
|
<li>Toby Inkster (Invited Expert)</li>
|
|
<li>Gregg Kellogg (Invited Expert)</li>
|
|
<li>Niklas Linström (Invited Expert)
|
|
</li>
|
|
<li>Shane McCarron, Applied Testing and Technology, Inc.
|
|
(Invited Expert)</li>
|
|
<li>Knud Möller, DERI Galway at the National University of
|
|
Ireland and Talis Group Ltd.</li>
|
|
<li>John O'Donovan, British Broadcasting Corporation</li>
|
|
<li>Steven Pemberton, Centre for Mathematics and Computer
|
|
Science (CWI)</li>
|
|
<li>Nathan Rixham (Invited Expert)</li>
|
|
<li>Thomas Steiner, Google, Inc.</li>
|
|
<li>Ted Thibodeau, OpenLink Software</li>
|
|
<li>Robert Weir, IBM Corporation</li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<div id="references" class="appendix section" typeof="bibo:Chapter" about="#references">
|
|
<!-- OddPage -->
|
|
<h2><span class="secno">A. </span>References</h2><div id="normative-references" typeof="bibo:Chapter" about="#normative-references" class="section"><h3><span class="secno">A.1 </span>Normative references</h3><p>No normative references.</p></div><div id="informative-references" typeof="bibo:Chapter" about="#informative-references" class="section"><h3><span class="secno">A.2 </span>Informative references</h3><dl class="bibliography" about=""><dt id="bib-BIBO">[BIBO]</dt><dd rel="dcterms:references">Frédérick Giasson and Bruce D'Arcus; <a href="http://bibliontology.com/"><cite>The Bibliographic Ontology</cite></a>. URL: <a href="http://bibliontology.com/">http://bibliontology.com/</a>
|
|
</dd><dt id="bib-CC-ABOUT">[CC-ABOUT]</dt><dd rel="dcterms:references"><a href="http://creativecommons.org/about/licenses/"><cite>Creative Commons: About Licenses</cite></a> URL: http://creativecommons.org/about/licenses/
|
|
</dd><dt id="bib-DC11">[DC11]</dt><dd rel="dcterms:references">Dublin Core metadata initiative. <a href="http://dublincore.org/documents/dcmi-terms/"><cite>Dublin Core metadata element set, version 1.1.</cite></a> July 1999. Dublin Core recommendation. URL: <a href="http://dublincore.org/documents/dcmi-terms/">http://dublincore.org/documents/dcmi-terms/</a>
|
|
</dd><dt id="bib-FOAF">[FOAF]</dt><dd rel="dcterms:references">Dan Brickley, Libby Miller. <a href="http://xmlns.com/foaf/spec/"><cite>FOAF Vocabulary Specification 0.98.</cite></a> 9 August 2010. URL: <a href="http://xmlns.com/foaf/spec/">http://xmlns.com/foaf/spec/</a>
|
|
</dd><dt id="bib-GR">[GR]</dt><dd rel="dcterms:references">Martin Hepp; <a href="http://purl.org/goodrelations/v1"><cite>GoodRelations Language Reference</cite></a>. URL: <a href="http://purl.org/goodrelations/v1">http://purl.org/goodrelations/v1</a>
|
|
</dd><dt id="bib-HTML-RDFA">[HTML-RDFA]</dt><dd rel="dcterms:references">Manu Sporny; et al. <a href="http://www.w3.org/TR/rdfa-in-html/"><cite>HTML+RDFa</cite></a> 25 May 2011. W3C Working Draft. URL: <a href="http://www.w3.org/TR/rdfa-in-html/">http://www.w3.org/TR/rdfa-in-html/</a>
|
|
</dd><dt id="bib-OGP">[OGP]</dt><dd rel="dcterms:references"><a href="http://ogp.me"> <cite>The Open Graph Protocol</cite></a>. December 2010. URL: <a href="http://ogp.me">http://ogp.me</a>
|
|
</dd><dt id="bib-RDF-PRIMER">[RDF-PRIMER]</dt><dd rel="dcterms:references">Frank Manola; Eric Miller. <a href="http://www.w3.org/TR/2004/REC-rdf-primer-20040210/"><cite>RDF Primer.</cite></a> 10 February 2004. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2004/REC-rdf-primer-20040210/">http://www.w3.org/TR/2004/REC-rdf-primer-20040210/</a>
|
|
</dd><dt id="bib-RDF-SCHEMA">[RDF-SCHEMA]</dt><dd rel="dcterms:references">Dan Brickley; Ramanathan V. Guha. <a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210"><cite>RDF Vocabulary Description Language 1.0: RDF Schema.</cite></a> 10 February 2004. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210">http://www.w3.org/TR/2004/REC-rdf-schema-20040210</a>
|
|
</dd><dt id="bib-RDF-SPARQL-QUERY">[RDF-SPARQL-QUERY]</dt><dd rel="dcterms:references">Andy Seaborne; Eric Prud'hommeaux. <a href="http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115"><cite>SPARQL Query Language for RDF.</cite></a> 15 January 2008. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115">http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115</a>
|
|
</dd><dt id="bib-RDFA-CORE">[RDFA-CORE]</dt><dd rel="dcterms:references">Shane McCarron; et al. <a href="http://www.w3.org/TR/2011/WD-rdfa-core-20110331"><cite>RDFa Core 1.1: Syntax and processing rules for embedding RDF through attributes.</cite></a> 31 March 2011. W3C Working Draft. URL: <a href="http://www.w3.org/TR/2011/WD-rdfa-core-20110331">http://www.w3.org/TR/2011/WD-rdfa-core-20110331</a>
|
|
</dd><dt id="bib-RDFA-SYNTAX">[RDFA-SYNTAX]</dt><dd rel="dcterms:references">Ben Adida, et al. <a href="http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014"><cite>RDFa in XHTML: Syntax and Processing.</cite></a> 14 October 2008. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014">http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014</a>
|
|
</dd><dt id="bib-SIOC">[SIOC]</dt><dd rel="dcterms:references">Uldis Bojārs and John G. Breslin; <a href="http://www.w3.org/Submission/2007/SUBM-sioc-spec-20070612/"><cite>SIOC Core Ontology Specification</cite></a>. W3C Member Submission. URL: <a href="http://www.w3.org/Submission/2007/SUBM-sioc-spec-20070612/">http://www.w3.org/Submission/2007/SUBM-sioc-spec-20070612/</a>
|
|
</dd><dt id="bib-SVG12">[SVG12]</dt><dd rel="dcterms:references">Craig Northway; Dean Jackson. <a href="http://www.w3.org/TR/2005/WD-SVG12-20050413"><cite>Scalable Vector Graphics (SVG) Full 1.2 Specification.</cite></a> 13 April 2005. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2005/WD-SVG12-20050413">http://www.w3.org/TR/2005/WD-SVG12-20050413</a>
|
|
</dd><dt id="bib-TURTLE">[TURTLE]</dt><dd rel="dcterms:references">David Beckett, Tim Berners-Lee. <a href="http://www.w3.org/TeamSubmission/turtle/"><cite>Turtle: Terse RDF Triple Language.</cite></a> January 2008. W3C Team Submission. URL: <a href="http://www.w3.org/TeamSubmission/turtle/">http://www.w3.org/TeamSubmission/turtle/</a>
|
|
</dd><dt id="bib-XHTML-RDFA">[XHTML-RDFA]</dt><dd rel="dcterms:references">Shane McCarron; et. al. <a href="http://www.w3.org/TR/2011/WD-xhtml-rdfa-20110331"><cite>XHTML+RDFa 1.1.</cite></a> 31 March 2011. W3C Working Draft. URL: <a href="http://www.w3.org/TR/2011/WD-xhtml-rdfa-20110331">http://www.w3.org/TR/2011/WD-xhtml-rdfa-20110331</a>
|
|
</dd></dl></div></div></body></html>
|