Rdfa-microdata-markup-comparison

From RDFaWiki

Jump to: navigation, search

Contents

Introduction

This page describes how one can express the same data in RDF and Microdata.

Expressed in both RDFa and Microdata

Identifying a Person

_:a rdf:type foaf:Person .
_:a foaf:name "Albert Einstein" .
_:a foaf:givenname "Albert" .
<div typeof="foaf:Person">
  <span property="foaf:name">Albert Einstein</span>
  <span property="foaf:givenname">Albert</span>
</div>

Specifying a person, place and date

<http://dbpedia.org/resource/Albert_Einstein> foaf:name "Albert Einstein" .
<http://dbpedia.org/resource/Albert_Einstein> dbp:dateOfBirth "1879-03-14"^^xsd:date .
<http://dbpedia.org/resource/Albert_Einstein> dbp:birthPlace <http://dbpedia.org/resource/Germany> .
<div about="http://dbpedia.org/resource/Albert_Einstein">
  <span property="foaf:name">Albert Einstein</span>
  <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
  <div rel="dbp:birthPlace" resource="http://dbpedia.org/resource/Germany">
    <span property="dbp:conventionalLongName">Federal Republic of Germany</span>
    <span rel="dbp:capital" resource="http://dbpedia.org/resource/Berlin" />
  </div>
</div>

Expressing native language of words

<http://example.org/node> <http://example.org/property> "chat"@fr .
<meta about="http://example.org/node"
  property="ex:property" xml:lang="fr" content="chat" />

Expressing relationships between subjects

<http://dbpedia.org/resource/Baruch_Spinoza"> dbp:influenced _:a .
_:a rdf:type foaf:Person .
_:a foaf:name "Albert Einstein" .
_:a dbp:dateOfBirth "1879-03-14"^^xsd:date .
<http://dbpedia.org/resource/Baruch_Spinoza"> dbp:influenced _:b .
_:b rdf:type foaf:Person .
_:b foaf:name "Arthur Schopenhauer" .
_:b dbp:dateOfBirth "1788-02-22"^^xsd:date .
<div about="http://dbpedia.org/resource/Baruch_Spinoza">
  <div rel="dbp:influenced">
    <div typeof="foaf:Person">
      <span property="foaf:name">Albert Einstein</span>
      <span property="dbp:dateOfBirth" datatype="xsd:date">1879-03-14</span>
    </div>
    <div typeof="foaf:Person">
      <span property="foaf:name">Arthur Schopenhauer</span>
      <span property="dbp:dateOfBirth" datatype="xsd:date">1788-02-22</span>
    </div>          
  </div>
</div>

Author and page navigation

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Page 7</title>
    <meta name="author" content="Mark Birbeck" />
    <link rel="prev" href="page6.html" />
    <link rel="next" href="page8.html" />
  </head>
  <body>...</body>
</html>

Licensing information

This document is licensed under a 
<a xmlns:cc="http://creativecommons.org/ns#"
  rel="cc:license"
  href="http://creativecommons.org/licenses/by-nc-nd/3.0/">
  Creative Commons License
</a>.

Book markup with ISBN and description

<html
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:biblio="http://example.org/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  >
  <head>
    <title>Books by Marco Pierre White</title>
  </head>
  <body>
    I think White's book
    '<span about="urn:ISBN:0091808189" typeof="biblio:book"
           property="dc:title">
      Canteen Cuisine
    </span>'
    is well worth getting since although it's quite advanced stuff, he
    makes it pretty easy to follow. You might also like
    <span about="urn:ISBN:1596913614" typeof="biblio:book"
          property="dc:description">
      White's autobiography
    </span>.
  </body>
</html>

Resource Chaining

 <div about="http://dbpedia.org/resource/Albert_Einstein">
      <div rel="dbp:citizenship">
        <span about="http://dbpedia.org/resource/Germany"></span>
        <span about="http://dbpedia.org/resource/United_States"></span>
      </div>
    </div>
 </div>

RDFa-only

Refering to Blank Nodes

_:john foaf:mbox <mailto:john@example.org> .
_:sue foaf:mbox <mailto:sue@example.org> .
_:john foaf:knows _:sue .
<link about="[_:john]" rel="foaf:mbox"
  href="mailto:john@example.org" />
<link about="[_:sue]" rel="foaf:mbox"
  href="mailto:sue@example.org" />
<link about="[_:john]" rel="foaf:knows"
  resource="[_:sue]" />


Compact URI Expression

<div xmlns:dbr="http://dbpedia.org/resource/">
  <div about="[dbr:Albert_Einstein]">
    ...
  </div>
</div>
<div xmlns:dbr="http://someotherdb.org/resource/">
  <div about="[dbr:Albert_Einstein]">
    ...
  </div>
</div>

Datatyped event

<html
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:cal="http://www.w3.org/2002/12/cal/ical#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  >
  <head><title>Jo's Friends and Family Blog</title></head>
  <body>
    <p>
      I'm holding
      <span property="cal:summary">
        one last summer Barbecue
      </span>,
      on
      <span property="cal:dtstart" content="2007-09-16T16:00:00-05:00"
            datatype="xsd:dateTime">
        September 16th at 4pm
      </span>.
    </p>
  </body>
</html>

Expressing XMLLiterals

<> dc:title "E = mc<sup>2</sup>: The Most Urgent Problem of Our Time"^^rdf:XMLLiteral .
<h2 property="dc:title" datatype="rdf:XMLLiteral">
  E = mc<sup>2</sup>: The Most Urgent Problem of Our Time
</h2>

Microdata-only