"RDFa - what, why and how?" by Mike Hewett and Shamod Lacoul


Published on

These slides define RDFa. It was a presentation for the Silicon Valley Code Camp 2010 held on Oct. 9-10, 2010.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • All of our examples in this talk use HTML.
  • This takes advantage of the billions of existing HTML web pages.
  • In the future, agents will access information for us.
  • Mention namespaceMention URL  URI  IRI
  • All of our examples in this talk use HTML.
  • Stress RDF
  • There are thousands more in all fields.
  • These examples illustrate perfectly that RDF is intended for machine consumption, not human consumption.
  • Microdata is related to HTML5
  • Using Property and Content, similar to RDFa. They have an RDF Schema definition of this.
  • "RDFa - what, why and how?" by Mike Hewett and Shamod Lacoul

    1. 1. What, Why and How<br />Silicon Valley CodeCamp 2010<br />October 9, 2010<br />Mike Hewett (mike@HewettResearch.com)<br />Shamod Lacoul (shamod@gmail.com)<br />Members of the League of Extraordinary Modelers (LEM)<br />Licensed under a Creative Commons Attribution-<br />Noncommercial-Share Alike 3.0 Unported License<br />
    2. 2. The Speakers<br />Mike Hewett has 25 years of experience in building AI systems, focusing on constructing knowledge bases and reasoning about knowledge. He is the author of the Algernon rule engine and the Jatha LISP library. Mike has a Masters in AI from Stanford University and a PhD in Computer Science from the University of Texas at Austin.<br />Shamod Lacoul is a software entrepreneur, developer and consultant. He has been working as a software consultant for 7 years, focusing on back-end and data integration technologies. He is an assistant organizer of the Silicon Valley Semantic Technologies (SVST) Meetup. He has a Masters in Software Engineering and Bachelors in Computer Science from San Jose State University.<br />
    3. 3. Outline<br /><ul><li>A quick overview of RDFa and a scenario setup
    4. 4. What is RDFa?
    5. 5. Why use RDFa?
    6. 6. How to use RDFa?
    7. 7. How is RDFa related to Semantic Web?
    8. 8. Current websites using RDFa</li></li></ul><li>Overview of RDFa<br />RDFa adds semantics to web page content.<br /> Semantics == Meaning<br />However, RDFa can be added to any XML-like<br />structured content.<br />
    9. 9. What is Semantics?<br />What does this sentence mean? <br /> “The Bears are in New York”<br />Bears are migrating to New York state.<br />Bears are migrating to New York City.<br />Chicago is playing the Giants in football.<br />Prices are lower on the NY Stock Exchange.<br />Is it the title of a book?<br />
    10. 10. Scenario: Lou’s Café hours<br />Scraping information from web pages.<br />Can a program find out when Lou’s Café is open on Saturday?<br />
    11. 11. Scenario: Lou’s Café hours<br />When is Lou’s Café open on Saturday?<br />The hours are hard to find by eye.<br />Even harder to find with a program.<br />But…<br />The hours could be annotated with RDFa tags.<br />Programs can easily find the information.<br />Easier than scraping the web page and guessing.<br />
    12. 12. Scraping information from the web<br />People often use programs to scrape information from web pages<br />Web Page<br />Web Server<br />Database<br />Copy<br />Find<br />Extract<br />Use<br />Program<br />
    13. 13. Scraping information is easier:<br />RDFa makes it easier to find and retrieve information from web pages<br />Web Page<br />Web Server<br />Database<br />Copy<br />Find<br />Extract<br />Use<br />Program<br />
    14. 14. The vision of the Semantic Web<br />Agents access information in DBs directly.<br />Web Page<br />Web Server<br />RDF<br />Database<br />Program<br />Query<br />Use<br />
    15. 15. What is RDF?<br />RDF is a data model where all data consists of 3-tuples of entities, commonly called triples.<br /><subject> <predicate> <object><br /><x:Person-9372> <x:firstName> “Don”<br /><x:Person-9372> <x:lastName> “Knuth”<br /><x:Person-9372> <x:friendOf> <x:Person-8614><br />
    16. 16. Outline<br /><ul><li>A quick overview of RDFa and a scenario setup
    17. 17. What is RDFa?
    18. 18. Why use RDFa?
    19. 19. How to use RDFa?
    20. 20. How is RDFa related to Semantic Web?
    21. 21. Current websites using RDFa</li></ul>Any questions?<br />
    22. 22. What is RDFa?<br />RDFa defines attributes for words or phrases that should be treated as semantic entities.<br /><div xmlns:v=“http://rdf.data-vocabulary.org/#”<br />typeof="v:Person"><br /> <span typeof="v:Address"> <br /> <span property="v:locality">Albuquerque</span><br /> <span property="v:region">NM</span><br /> </span><br /></div> <br />RDFa is a W3C recommendation<br />
    23. 23. RDFa example – metadata<br /><div about="/id/rdfa-course"><br /> <h3 property="dc:title">RDFa Course</h3><br /> <pproperty="dc:description" lang="en"><br />This course covers the basics of RDFa...<br /> </p><br />Last modified:<br /><span property="dc:modified" datatype="xsd:date” content="2009-02-06"><br />6th Feb 2009<br /></span><br /></div><br />Borrowed from a talk by JeniTennison at the XML Summer School<br />
    24. 24. RDFa attributes<br />The attributes map to RDF components<br /><div about=”rdfa-course"><br /> <h3 property="dc:title">RDFa Course</h3><br />
    25. 25. RDFa vocabulary<br />Provides the keywords and the semantics<br />Often called a microformat<br />Examples of vocabularies:<br />DC = Dublin Core<br />Describes document metadata<br />dc:title<br />dc:author<br />FOAF = Friend of a Friend<br />foaf:name<br />foaf:mbox<br />
    26. 26. Other useful vocabularies<br />hReview(recognized by Google): itemreviewed, rating, reviewer, dtreviewed, description, summary<br />hCard (Person) (rec. by Google): name, nickname, photo, title, role, url, affiliation, address, … <br />hCalendar (Event) (rec. by Google): summary, url, location, description, startDate, endDate, duration, eventType, geo, photo<br />Facebook Share & Yahoo SearchMonkeyRDFa (video) (rec. by Google): image_src, video_src, description, title, video_width, video_height, …<br />
    27. 27. RDFa example – person<br /><div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person"> <br />My name is <span property="v:name">Bob Smith</span>, but people call me <span property="v:nickname">Smithy</span>. <br />Here is my homepage: <a href="http://www.example.com" rel="v:url">www.example.com</a>.<br /> I live in <span rel="v:address"> <span typeof="v:Address"><br /> <span property="v:locality">Albuquerque</span>, <span property="v:region">NM</span> </span> </span><br /> and work as an <span property="v:title">engineer</span> <br />at <span property="v:affiliation">ACME Corp</span>. <br />My friends: <a href="http://darryl-blog.example.com" rel="v:friend">Darryl</a>, <a href="http://edna-blog.example.com" rel="v:friend">Edna</a> <br /></div> <br />
    28. 28. RDFa example – event<br /><div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Event"><br />    <a href="http://www.example.com/events/spinaltap" rel="v:url" property="v:summary">Spinal Tap</a> <br />   <imgsrc="spinal_tap.jpg" rel="v:photo" /> <br />   <span property="v:description">After their highly-publicized search for a new drummer, Spinal Tap kicks off their latest comeback tour with a San Francisco show. </span><br />   When:    <span property="v:startDate" content="2009-10-15T19:00-08:00">Oct 15, 7:00PM</span>—   <br /> <span property="v:endDate" content="2009-10-15T21:00-08:00">9:00PM</span>   <br /> Where:    <span rel="v:location">     <span typeof="v:Organization">      <br />  <span property="v:name">Warfield Theatre</span>,  <br />     <span rel="v:address">  <br />    <span typeof="v:Address">      <br />  <span property="v:street-address">982 Market St</span>,     <br />     <span property="v:locality">San Francisco</span>, <br />     <span property="v:region">CA</span>         </span>       </span>          <br />…<br />   Category: <span property="v:eventType">Concert</span> </div> <br />
    29. 29. Alternatives for adding Semantics<br />RDFa – W3C standard + validator<br />Microformat syntax<br />Microdata syntax<br />Proprietary tags and syntax<br />Facebook: Open Graph <br />
    30. 30. Microformat example – event<br /><div class="location vcard"> <br /> <span class="fn org">Warfield Theatre</span>,<br /> <span class="adr"> <br /> <span class="street-address">982 Market St </span>, <br /> <span class="locality">San Francisco</span>,<br /> <span class="region">CA</span> </span> <br /> </span> <br /></div> <br />
    31. 31. Microdata example - event<br /><span itemprop="location" itemscopeitemtype="http://data-vocabulary.org/Organization"><br />​<span itemprop="name">Warfield Theatre</span> ​<span itemprop="address" itemscopeitemtype="http://data-vocabulary.org/Address"><br /> <span itemprop="street-address">982 Market St</span>, <span itemprop="locality">San Francisco</span>, <span itemprop="region">CA</span> <br /> </span> <br /> </span> <br /></span> <br />
    32. 32. Outline<br /><ul><li>A quick overview of RDFaand a scenario setup
    33. 33. What is RDFa?
    34. 34. Why use RDFa?
    35. 35. How to use RDFa?
    36. 36. How is RDFa related to Semantic Web?
    37. 37. Current websites using RDFa</li></ul>Any questions?<br />
    38. 38. Why use RDFa?<br />Embed semantics in XHTML<br />Re-use attributes<br />The HTML and the RDF can exist in the same document<br />For Search Engine Optimization (SEO)<br />
    39. 39. Open Graph<br /><html xmlns="http://www.w3.org/1999/xhtml" <br />xmlns:og=http://opengraphprotocol.org/schema/<br />xmlns:fb="http://www.facebook.com/2008/fbml"><br /> <head> <title>The Rock (1996)</title><br /> <meta property="og:title" content="The Rock"/> <br /> <meta property="og:type" content="movie"/><br /> <meta property="og:url" <br /> content="http://www.imdb.com/title/tt0117500/"/> <br /> <meta property="og:image" <br /> content="http://ia.media-imdb.com/rock.jpg"/><br /> <meta property="og:site_name" content="IMDb"/><br /> <meta property="og:description" content="A group of U.S. Marines, under command of a renegade general, take over Alcatraz and threaten San Francisco Bay with biological weapons."/><br /> ... </head> ... </html> <br />
    40. 40. How<br />Better understanding of the content<br />Better ad placement<br />To build Rich Snippets:<br />Uses RDFa<br />
    41. 41. Outline<br /><ul><li>A quick overview of RDFaand a scenario setup
    42. 42. What is RDFa?
    43. 43. Why use RDFa?
    44. 44. How to use RDFa?
    45. 45. How is RDFa related to Semantic Web?
    46. 46. Current websites using RDFa</li></ul>Any questions?<br />
    47. 47. A sample webpage without RDFa<br />
    48. 48. A sample webpage with RDFa<br />
    49. 49. Can you tell the difference?<br />NO, it’s tough with your naked eye.<br />
    50. 50. Reasons:<br />RDFaattributes are meant for machines.<br />RDFaattributes are embedded inside HTML tags <br />invisible to the user.<br />
    51. 51. One quick way to find RDFa tags is by using a tool called RDFaDev<br />http://rdfadev.sourceforge.net/<br />RDFaDev is a Firefox plugin<br />enables you to examine the RDFa markup<br />allows you to query the data on the page using SPARQL<br />detects common pitfalls in the use of RDFa<br />
    52. 52. HTML without RDFa<br /><?xml version="1.0" encoding="UTF-8" ?><br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><br /><title>Silicon Valley Code Camp</title><br /></head><br /><body><br /><p> <br /><b>Weekend at the Silicon Valley Code Camp 2010</b><br /><br /><br />Starts on: <span>10-09-2010</span><br /> <br />Ends on: <span>10-10-2010</span><br /><br /> <br />See <a href="http://siliconvalley-codecamp.com/">Silicon Valley Code Camp 2010</a><br />This event is located at <span>Foothills College</span><br /><br /></p><br /></body><br /></html><br />
    53. 53. HTML with RDFa<br /><?xml version="1.0" encoding="UTF-8" ?><br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><html xmlns="http://www.w3.org/1999/xhtml"<br />xmlns:cal="http://www.w3.org/2002/12/cal/icaltzd#"<br />xmlns:xs="http://www.w3.org/2001/XMLSchema#"><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><br /><title>Insert title here</title><br /></head><br /><body><br /><pabout="#event1" typeof="cal:Vevent"><br /><bproperty="cal:summary">Weekend at the Silicon Valley Code Camp 2010</b><br />Starts on: <span property="cal:dtstart" datatype="xs:date">10-09-2010</span><br />Ends on: <span property="cal:dtend" datatype="xs:date">10-10-2010</span><br />See <br /><a rel="cal:url" href="http://siliconvalley-codecamp.com/"><br />Silicon Valley Code Camp 2010</a><br /><br /><br />This event is located at <span property="cal:location">Foothills College</span><br /></p><br /></body><br /></html><br />
    54. 54. http://check.rdfa.info/<br />Use<br />to validate RDFa<br />
    55. 55. Result from <br />http://check.rdfa.info/<br />NOTE: It also tells you how Facebook, Google parses your RDFa<br />
    56. 56. GRDDL = Gleaning Resource Descriptions from Dialects of Languages<br />a technique of extracting RDF data from <br />XML documents (in particular XHTML pages).<br />Source: http://www.w3.org/TR/2006/WD-grddl-primer-20061002/<br />
    57. 57. An example of RDFawith GRDDL profile<br /><?xml version="1.0" encoding="UTF-8"?> <br /><html xmlns="http://www.w3.org/1999/xhtml" <br />xml:base="http://www.dc4plus.com/references/rdf_sem.html" <br />xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" <br />xmlns:dc="http://purl.org/dc/elements/1.1/" <br />xmlns:foaf="http://xmlns.com/foaf/0.1/" ><br /><head profile="http://ns.inria.fr/grddl/rdfa/"> <br /><title>Biblio description</title> </head> <br /><body> <h1>Biblio description</h1><br /> <dl about="http://www.w3.org/TR/2004/REC-rdf-mt-20040210/"> <br /><dt>Title</dt><br /> <ddproperty="dc:title">RDF Semantics - W3C Recommendation 10 February 2004</dd> <br /><dt>Author</dt> <br /><ddrel="dc:creator" href="#a1"> <br /><span id="a1"> <link rel="rdf:type" href="[foaf:Person]"/> <br /><span property="foaf:name">Patrick Hayes</span> see <br /><a rel="foaf:homepage" href="http://www.ihmc.us/users/user.php?UserID=42"><br />homepage</a> </span> <br /></dd><br /></dl><br /></body><br /></html><br />Source: http://www-sop.inria.fr/acacia/personnel/Fabien.Gandon/tmp/grddl/rdfaprimer/PrimerRDFaSection.html<br />
    58. 58.
    59. 59. An output of GRDDL service is RDF<br />
    60. 60. A visual graph of an RDF<br />Source: http://www-sop.inria.fr/acacia/personnel/Fabien.Gandon/tmp/grddl/rdfaprimer/PrimerRDFaSection.html<br />
    61. 61. Outline<br /><ul><li>A quick overview of RDFa and a scenario setup
    62. 62. What is RDFa?
    63. 63. Why use RDFa?
    64. 64. How to use RDFa?
    65. 65. How is RDFa related to Semantic Web?
    66. 66. Current websites using RDFa</li></ul>Any questions?<br />
    67. 67. How is RDFarelated to<br />the Semantic Web <br />as a whole?<br />
    68. 68. Linked Data<br />Source: http://www.flickr.com/photos/ldodds/4043803502/<br />
    69. 69. Semantic Web stack<br />Source: http://www.semanticfocus.com/blog/entry/title/introduction-to-the-semantic-web-vision-and-technologies-part-2-foundations/<br />
    70. 70. Web Ontology Language (OWL)<br />- additional vocabulary along with a formal semantics<br />- an extension to RDF and RDF-Schema (RDF-S)<br />
    71. 71. Triple Store (A database for RDF)<br />Source: http://test.ical.ly/tags/phpunit/<br />
    72. 72. SPARQL – a query language for RDF<br />- a glue to connect, query and reconstruct<br />disparate sources of RDF data<br />- similar to SQL for RDF<br />
    73. 73. Outline<br /><ul><li>A quick overview of RDFaand a scenario setup
    74. 74. What is RDFa?
    75. 75. Why use RDFa?
    76. 76. How to use RDFa?
    77. 77. How is RDFa related to Semantic Web?
    78. 78. Current websites using RDFa</li></ul>Any questions?<br />
    79. 79. Examples of websites <br /> currently using<br />RDFa<br />
    80. 80.
    81. 81.
    82. 82.
    83. 83. Summary<br /><ul><li>RDFa provides semantic tags that are embedded in web pages
    84. 84. RDFa helps software to understand the content of web pages
    85. 85. Useful RDFa tools are RDFaDev, checkrdfa.info, GRDDL Service, HTML editor, etc.
    86. 86. RDFa is a stepping stone to full Semantic Web capability
    87. 87. BBC, BestBuy, O’Reilly are the early-adopters.</li></li></ul><li>Links to related information<br />http://www.w3.org/TR/rdfa-core/<br />http://en.wikipedia.org/wiki/Rdfa<br />http://www.google.com/webmasters/tools/richsnippets<br />http://developers.facebook.com/docs/opengraph<br />http://semantic-drupal.com/<br />http://xmlsummerschool.com/curriculum-2010/semantic-technologies-2010/<br />http://www.jenitennison.com/talks/xmlss2010/RDFa.pdf<br />http://opengraphprotocol.org/<br />