RDFa: an introduction Kai Li LIS 681 Metadata
Nov 17, 2014
RDFa: an introduction
Kai LiLIS 681 Metadata
What is RDFa?
• RDFa = RDF in attributes• RDFa Core is a “specification for attributes to
express structured data in any markup language.”– Including (X)HTML and XML and other languages– HTML/XML tree structure is used– Some attributes and text content is reused from
HTML/XML.
RDFa, Microformats and Microdata
For full comparison, see: http://manu.sporny.org/2011/uber-comparison-rdfa-md-uf/
RDFa, Microformats and Microdata (cont.)
• Google supports all three formats. • The latest Schema.org initiated by Google,
Bing and Yahoo! chose Microdata over RDFa.• However, the approach of Schema.org is
“Microdata and more”, which means the vocabularies in Schema.org can be mixed with other approaches.
It’s about integrating RDF triples into HTML
<http://nalsi.net/posts/20130124135526.html><http://purl.org/dc/elements/1.1/creator>
<http://nalsi.us/about#me><http://nalsi.net/posts/20130124135526.html>
<http://purl.org/dc/terms/created>“2013/01/24”
<div resource=“http://nalsi.net/posts/20130124135526.html”><p>Written by: <span
property=“http://purl.org/dc/elements/1.1/creator”>Kai</span></p>
<p>Time: <span property=“http://purl.org/dc/terms/created”>2013-01-24</span></p></div>
RDFa: datatypes
• CURIE(s): compact URI(s), being composed of a prefix and astring.– For example: <div about="dbr:Albert_Einstein">
• IRIs: Internationalized Resource Identifiers, which is an extension of the URI or URL, in which internationalized characters are allowed to use.
How to use RDFa: tags
• @about • @resource• @property• @href• @vocab• @prefix• @content• @typeof• And more tags…
@about and @resource
• Both attributes can serve to set the subject of the following statements. – The difference is, @about can be only used for
setting subject.– @resource, when combined with attribute
“property”, can be used to set the target, the object, for the statement.
@about and @resource (cont.)Example 1:<ul>
<li about="/alice/posts/trouble_with_bob" property="title">The trouble with Bob</li>
<li about="/alice/posts/jos_barbecue" property="title">Jo's Barbecue</li> ... </ul>
Example 2:<div about="http://dbpedia.org/resource/Albert_Einstein">
<div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/German_Empire">
<span property="dbp:conventionalLongName">the German Empire</span></div></div>
@property
• The relationship between the subject and either an object if given or some literal text.
Example:<body>
<h2 property="http://purl.org/dc/terms/title">The Trouble with Bob</h2> </body>
@href
• The partner resource of a relationship (object).
Example:<head>
<link rel="prev" href="page6.html" /> </head>
@prefix and @vocab
• Both of these two attributes define the namespace of the names used in the structured data. – @prefix defines the prefix of the value that will be
used; @vocab defines the default URL of the vocabulary.
@prefix and @vocab, cont.Example 1:<div vocab="http://xmlns.com/foaf/0.1/" about="#me">
My name is <span property="name">John Doe</span> and my blog is called
<a rel="homepage" href="http://example.org/blog/">Understanding Semantics</a>. </div>
Example 2:This document is licensed under the <a prefix="cc: http://creativecommons.org/ns#" rel="cc:license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" >Creative Commons By-NC-ND License</a>.
@content
• A string, to supply machine-readable content for a literal.
Example:<head>
<meta property="http://purl.org/dc/terms/creator" content="Mark Birbeck" /> </head>
@typeof
• RDF type(s) to associate with a subject.
Example:<span about="urn:ISBN:0091808189" typeof="bibo:Book" property="dc:title">Canteen Cuisine</span>
RDFa Use Cases
• W3C published the official RDFa Use Case in 2007 as a draft.– http://www.w3.org/TR/xhtml-rdfa-scenarios/
• The document explores “how publishers, tool builders, and consumers benefit from RDFa” by embedding RDF in HTML.
• Nine use cases are listed and discussed.
RDFa Use Cases, cont.
• Publishers– Mark the web pages with structured data so that
machines can consume these contents• Tool builders– Augment the metadata embedded in the HTML
files to facilitate using the data• Users– Better organize, sort and categorize related
information on the Internet
RDFa Use Cases, cont.
• Use Case Example:– Sarah is a information scientist who publishes her
recent study about metadata standards in her personal website. She uses RDFa to “mark up” this website, so that the results of the study as well as her rights toward the study can be not only meaningful to human readers, but also to machines.
Reference
• Birbeck, M. (2009, June 23). Introduction to RDFa. Retrieved April 1, 2013, from http://alistapart.com/article/introduction-to-rdfa
• Brickley, D. (2012, June 7). SemTech, RDFa, Microdata and more... Retrieved April 1, 2013, from http://blog.schema.org/2012/06/semtech-rdfa-microdata-and-more.html
• Sporny, M. (2013, February 23). An Uber-comparison of RDFa, Microdata and Microformats. Retrieved April 1, 2013, from http://manu.sporny.org/2011/uber-comparison-rdfa-md-uf/
Reference, cont.
• W3C. (2012, June 7). RDFa 1.1 Primer. Retrieved April 1, 2013, from http://www.w3.org/TR/xhtml-rdfa-primer/
• W3C. (2012, June 7). RDFa Core 1.1. Retrieved March 31, 2013, from http://www.w3.org/TR/2012/REC-rdfa-core-20120607/
• W3C. (2007, March 30). RDFa Use Cases: Scenarios for Embedding RDF in HTML. Retrieved April 1, 2013, from http://www.w3.org/TR/xhtml-rdfa-scenarios/
Thank you!