Publishing data on the Semantic Web
Upcoming SlideShare
Loading in...5
×
 

Publishing data on the Semantic Web

on

  • 2,306 views

Tutorial given at the University of Oviedo, covering Linked Data and RDFa.

Tutorial given at the University of Oviedo, covering Linked Data and RDFa.

Statistics

Views

Total Views
2,306
Views on SlideShare
2,306
Embed Views
0

Actions

Likes
4
Downloads
45
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Designed for humans first and machines second, microformats are a set of simple, open data formats built upon existing and widely adopted standards. Instead of throwing away what works today, microformats intend to solve simpler problems first by adapting to current behaviors and usage patterns

Publishing data on the Semantic Web Publishing data on the Semantic Web Presentation Transcript

  • Publishing Data on the Semantic Web Peter Mika Researcher, Data Architect Yahoo! Research
  • Intro to the Semantic Web
  • Vague, but exciting… Berners-Lee and the dawn of the Web
  • Semantic Web
    • Publish information in a way that is easier to process for machines
    • Web of Data instead of Web of Documents
    • Two main architectural challenges
      • A common format for sharing data
      • Sharing the meaning of data
        • Through social means (shared schemas)
        • By using powerful schema languages
    • Semantic Web standards from W3C
      • Languages (RDF, OWL, RIF)
      • Serializations (RDF/XML, RDFa)
      • Protocols (SPARQL, HTTP)
    • Semantic Web research into knowledge representation and reasoning, data integration, data quality and many other topics
    • Community efforts to publish data and develop schemas
  • RDF (Resource Description Framework)
    • The basic data model of the Semantic Web
      • A universal model to capture all sorts of data: networks, relational, object-oriented…
    • Basic unit of information is a triple
      • A tuple of (subject, predicate, object)
      • Example: (Joe, loves, Mary)
      • Each triple gives the value of a property for a given resource or relates two objects to one another
        • Object is either a resource or a literal
    • An RDF model is a set of triples
      • Ordering of statements in an RDF document is irrelevant (unlike XML)
  • Resources vs. literals
    • Resources are identified by a URI or otherwise the are called a blank node
      • URIs are a generalization of URLs
      • Notation: <http://www.example.org/Person> or ex:Person
    • Literals have an optional language and datatype (string, integer etc.)
      • Literals can not be subjects of statements
      • Datatypes are identified by URIs, e.g. XML Schema datatypes
      • Two literals are the same if their components are the same
      • Notation: “Joe B.” or Joe@en^^http://…#string
  • Advanced topic: Resources vs Literals
    • Resources are objects, Literals are strings
    • Resources are instances of classes, Literals have datatypes
    • Whether something is a resource or literal sometimes depends on the detail of modeling
      • <meta property=“myvocab:knows”>Paris Hilton</meta>
      • <item rel=“foaf:knows”>
        • <meta property=“foaf:name”>Paris Hilton</meta>
      • </item>
    • You cannot make statements about literals (literals are always the object in a triple)
    • Resources can carry a globally unique identifier, literals have no identity
    • Web resources such as documents and images are resources
      • <item rel=“rdfs:seeAlso” resource=“http://www.some.related.page.com/”/>
      • <item rel=“foaf:img” resource=“http://photosite.example.org/photo.jpg”/>
    • When in doubt: it’s a resource
  • Graphical and textual notation
    • A number of ways to serialize an RDF model into an RDF document
      • RDF/XML, Turtle, N3, N-Triples
      • Example: http://www.cs.vu.nl/~pmika/foaf.rdf
    my:Joe “ Joe A.” name foaf:Person type
  • Informational versus non-informational resources
    • Informational resource: an HTML document, image, any other file on the Web
      • Retrievable in its entirety from the Web
      • Retrieving it can return a 200 OK
    • Conceptual (non-informational) resource: a person, an event, a place, etc.
      • A description of it may be retrievable from the Web
      • When identified by a URL, retrieving it should return a 303 Redirect
    • Never confuse a webpage with what it describes!
      • You are not your Facebook profile: one is a document, the other is a person. A document has properties such as byte-size, media-type etc, a person has name, age, etc.
      • Make sure you don’t use the URL of an existing webpage as the URI of a resource
  • Vocabularies (ontologies)
    • Ontologies are collections of classes and properties used to describe objects in a particular domain
      • OWL (the Web Ontology Language) is the standard ontology language
      • OWL has an RDF serialization: ontologies are part of the Semantic Web
    • Classes can be described by sub- and superclasses, required properties
      • Class membership in RDF is expressed using the rdf:type property
      • An instance can have multiple classes (types)
      • A class can have multiple superclasses
    • Properties can be described by their domain, range, cardinalities, etc.
  • RDF is designed for distributed systems
    • URIs provide web-wide global identification across documents
      • A resource may be described by multiple documents
      • We know it’s the same resource because the same URI is used or through reasoning (advanced topic…)
      • URIs are intented to be reused
      • Unique, but not single identifiers: two URIs may denote the same thing
    • URIs are dereferencable (can be retrieved)
      • A well-behaved URI returns a description of the resource
      • Provides authority: the definition of foaf:Person lives at that URI
    • Ontologies can be looked up as well
      • Typically at the root of the URIs, also known as the namespace
      • Example: http://xmlns.com/foaf/0.1/Person redirects to the specification
  • URIs implicitly link data together (#joe, #name, “Joe A.”) (#joe, #email, mailto:joe@joe.com) (#mary, name, “Mary B.”) (#mary, gender, “female”) (#joe, #loves, #mary) Joe’s homepage A dating site Mary’s homepage (#name, #type, #Property) (#name, #domain, #Person) Schema doc
  • Put together, triples form a single ‘global’ graph “ Joe A.” #joe #name “ joe@joe.com” #email #mary #loves “ Mary B.” “ female” #name #gender
  • Publishing for the Semantic Web
  • Motivation
    • Why publish data on the (Semantic) Web?
      • In a business context
        • Increase the potential for linking, reuse and aggregation
          • Drive traffic back from other sites on the Web
          • Pre-competitive data integration (e.g. drug discovery)
        • Make your data more easily findable
          • Drive traffic from search engines
      • In a non-profit context
        • Increase industry or government transparency, accountability
        • Support research and education by making data accessible
  • Publishing and consuming data on the Semantic Web
    • Publishing data involves
      • Deciding in which format to publish your data
      • Deciding which schema (ontology, vocabulary) to use
        • OR you can create a new schema and publish it as well
    • Multiple ways of publishing RDF data:
      • Linked Data
      • Metadata in HTML
      • SPARQL endpoints
      • Feeds
      • GRDDL
      • Automated tools
    • Note: you may implement more than one
  • Option 1: Linked Data
    • A web of RDF documents in parallel to the current Web
      • Most often implemented as wrappers around databases or APIs
    • The four rules of Linked Data:
      • Use URIs to identify things.
      • Use HTTP URIs so that these things can be referred to and looked up (&quot; dereference &quot;) by people and user agents .
      • Provide useful information about the thing when its URI is dereferenced, using standard formats such as RDF-XML.
      • Include links to other, related URIs in the exposed data to improve discovery of other related information on the Web.
    . . . #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population
  • Option 1: Linked Data
    • Advantages:
      • No change to the publishing of the HTML documents
      • Data can be published by third party (e.g. Dbpedia)
    • Disadvantages:
      • Web servers need to be configured to properly handle URIs that identify concepts instead of documents
      • Not favored by search engines
        • Lack of use cases
        • Crawling needs to be changed
        • Authority is difficult to determine
    • Tools
      • Triple stores (Virtuoso, Oracle etc.) and front-ends ( Pubby )
      • RDB-to-RDF mappers (e.g. D2RQ , Triplify )
      • Validators ( Vapour )
      • Linked Data browsers ( many )
  • Linked Data as a movement
    • Rapidly growing community effort to (re)publish open datasets as Linked Data
      • In particular, scientific and government datasets
      • see linkeddata.org
  • Option 2: Metadata in HTML
    • Using microformats, RDFa, Microdata (more later)
    • Advantages:
      • Data and document are always in sync
      • Browser plug-in friendly
      • Search engine friendly
      • Copy-paste friendly
    • Tools:
      • XML editors (e.g. Oxygen)
      • Triplr
      • RDFa Distiller
      • RDFa bookmarklet
      • Ubiquity RDFa plugin
      • Optimus microformat parser
    • Examples: many, including SlideShare, YouTube, LinkedIn, Digg, Myspace, Facebook…
    Peter Mika was born in Budapest. Peter Mika was born in Budapest. #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population
  • Option 3: SPARQL endpoints
    • An API for accessing RDF databases on the Web
      • A query language and an HTTP protocol
    • Advantages:
      • Flexible access: make any query you want
      • Also possible to expose a traditional RDBMs via a wrapper
    • Disadvantages:
      • For the publisher: cost of supporting arbitrary queries
      • For the search engine: discovery of SPARQL servers is unsolved
    • Tools:
      • Triple stores (Oracle, Virtuoso, Sesame, Jena, OWLIM etc.)
      • RDB-to-RDF mappers such as D2RQ and Triplify
    #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population
  • Option 4: Feeds
    • Disadvantages:
      • No standard feed format for RDF: data needs to be formatted and often manually submitted for each search engine
    • Advantages
      • Submit your data without making it public
    • Competing and incompatible formats
      • DataRSS (Yahoo!)
      • Google Data Protocol
      • Open Data Protocol (Microsoft)
    . #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population #PeterM #Bud born “ Peter Mika” label “ Budapest” label #Hun capital-of “ 2,000,000” population
  • Option 5: Publishing a transformation of the data
    • Publish the rule to transform the HTML to structured data
      • GRDDL is a standard for linking an HTML page to a transformation that produces RDF data
    • Advantages
      • No change to the page
    • Disadvantages
      • Transformation needs to be executed to get to the data
      • Not much support by search engines
    • Tools
      • Intel MashMaker
      • Dapper
      • Glue API from AdaptiveBlue
    <XSLT> xx yy 1 2
  • Option 6: Automatic markup
    • Web services that annotate HTML automatically
    • Advantages
      • No manual effort
    • Disadvantages
      • Limited to finding relevant entities in text
    • Tools
      • OpenCalais
      • Zemanta API
    Peter Mika was born in Budapest. <person>Peter Mika</person> was born in <location>Budapest</location>.
  • Example: Zemanta
    • A personal writing assistant for bloggers
      • Plugin for popular blogging platforms and web mail clients
    • Analyzes text as you type and suggests hyperlinks, tags, categories, images and related articles
    • API available with the same functionality
  • Choosing a vocabulary
    • No vocabularies in many domains
      • Books, movies, stuff people care about…
    • Too many competing proposals in other domains
      • Often versions of the same proposal
      • Example: vocabularies for microformats
    • Not maintained
      • I cannot maintain your vocabulary for you
    • Limited tool support
      • Too many expert tools until now
    • Many vocabularies are not designed for annotation
    • Missing meeting point and social process
      • An ontology is a shared , formal representation of a domain
  • Choosing a vocabulary
    • Search the Web or ask for advice on mailing lists
      • [email_address]
      • [email_address]
    • Wikis
      • semanticweb.org
      • vocamp.org
    • Beware of people who claim to have the vocabulary of everything
      • Preferably you want something small and targeted
    • Never a 100% fit  you will need to introduce vocabulary terms (classes and properties)
      • Do not introduce new classes/properties in existing namespaces
      • Example: the namespace http://xmlns.com/foaf/0.1/ is used by the FOAF project. Try not to introduce a new term without contacting the owner, i.e. the membership of the FOAF mailing list.
  • Advanced topic: creating a vocabulary
    • Get advice on methodology
      • vocamp.org and semanticweb.org
    • Choose a namespace and a prefix
      • Give sensible names, e.g. name it after your site, but don’t call it searchmonkey
      • Namespace ends either with a slash or a hash
    • Create an RDF or OWL document describing your classes and properties
      • Use an ontology editor such as Protégé 4.0
      • Follow naming conventions
    • Publish your vocabulary
      • Make sure the URIs of your properties and classes are resolvable
        • E.g. myvocab:digicam should resolve to a document containing the definition of myvocab:digicam
    • Convince others to adopt your vocabulary
      • If you are in fishing, convince other fishing businesses
  • How do we build communities? www.vocamp.org
  • Metadata in HTML
  • Brief history of the Annotated Web
    • 1995: HTML meta tags
    • 1996: Simple HTML Ontology Extensions (SHOE)
    • 1998: RDF/XML
      • RDF/XML in HTML
      • RDF linked from HTML
    • 2003: Web 2.0
      • Tagging
      • Microformats
      • Metadata in Wikipedia
      • Machine tags in Flickr
    • 2005: eRDF
    • 2008: RDFa 1.0
    • 2011: RDFa 1.1
    • 2012: Microdata?
  • HTML meta tags
    • <HTML>
    • <HEAD profile=&quot;http://dublincore.org/documents/dcq-html/&quot;>
    • <META name=&quot;DC.author &quot; content=&quot; Peter Mika &quot;>
    • <LINK rel=&quot;DC.rights copyright&quot; href=&quot; http://www.example.org/rights.html &quot; />
    • <LINK rel=&quot;meta&quot; type=&quot;application/rdf+xml&quot; title=&quot;FOAF&quot;
    • href= &quot; http://www.cs.vu.nl/~pmika/foaf.rdf &quot;>
    • </HEAD>
    • </HTML>
  • SHOE example (Hefflin & Hendler, 1996)
    • <ONTOLOGY &quot;our-ontology&quot; VERSION=&quot;1.0&quot;>
    • <ONTOLOGY-EXTENDS &quot;organization-ontology&quot; VERSION=&quot;2.1&quot; PREFIX=&quot;org&quot; URL=&quot;http://www.ont.org/orgont.html&quot;>
    • <ONTDEF CATEGORY=&quot;Person&quot; ISA=&quot;org.Thing&quot;>
    • <ONTDEF RELATION=&quot;lastName&quot; ARGS=&quot;Person STRING&quot;>
    • <ONTDEF RELATION=&quot;firstName&quot; ARGS=&quot;Person STRING&quot;>
    • <ONTDEF RELATION=&quot;marriedTo&quot; ARGS=&quot;Person Person&quot;>
    • <ONTDEF RELATION=&quot;employee&quot; ARGS=&quot;org.Organization Person&quot;>
    • </ONTOLOGY >
    <HEAD> <META HTTP-EQUIV=&quot;Instance-Key&quot; CONTENT=&quot;http://www.cs.umd.edu/~george&quot;> <USE-ONTOLOGY &quot;our-ontology&quot; VERSION=&quot;1.0&quot; PREFIX=&quot;our&quot; URL=&quot;http://ont.org/our-ont.html&quot;> </HEAD> <BODY> <CATEGORY &quot;our.Person&quot;> <RELATION &quot;our.marriedTo&quot; TO=&quot;http://www.cs.umd.edu/~helena&quot;> <RELATION &quot;our.employee&quot; FROM=&quot;http://www.cs.umd.edu&quot;> My name is <ATTRIBUTE &quot;our.firstName&quot;> George </ATTRIBUTE> <ATTRIBUTE &quot;our.lastName&quot;> Cook </ATTRIBUTE> and I live at...
  • SHOE system
  • SHOE Text-based query interface
  • SHOE Graphical Query Interface
  • Example: Creative Commons
    • Embedding CC license in HTML (now deprecated):
    <HTML> <HEAD>… </HEAD> <BODY> … <!–- <rdf:RDF xmlns=&quot;http://creativecommons.org/ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;> <Work rdf:about=&quot;http://www.yergler.net/averages/&quot;> <dc:title>The Law of Averages</dc:title> <dc:description>...because eventually i&apos;ll be right...</dc:description> <license rdf:resource=&quot;http://creativecommons.org/licenses/by-nc/1.0/&quot; /> </Work> <License rdf:about=&quot;http://creativecommons.org/licenses/by-nc/1.0/&quot;> <requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot; /> <permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot; /> <permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot; /> <prohibits rdf:resource=&quot;http://web.resource.org/cc/CommercialUse&quot; /> </License> </rdf:RDF> -->
  • Example: Creative Commons
    • Current: rel attribute (HTML4)
    This work is licensed under a <a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by/3.0/us/&quot;>Creative Commons Attribution 3.0 United States License</a>.
    • Use of the “rel” attribute for semantic annotation is the birth of the microformat…
  • Microformats (μf)
    • Agreements on the way to encode certain kinds metadata in HTML
      • Reuse of semantic-bearing HTML elements
      • Based on existing standards
      • Minimality
    • Microformats exist for a limited set of objects
      • hCard (persons and organizations)
      • hCalendar (events)
      • hResume
      • hProduct
      • hRecipe
    • Varying degrees of support and stability
      • hCard and rel-tag are widely supported
    • Community centered around microformats.org
      • Specifications and discussions are hosted there
  • Microformats: limitations
    • No shared syntax
      • Each microformat has a separate syntax tailored to the vocabulary
    • No formal schemas
      • Limited reuse, extensibility of schemas
      • Unclear which combinations are allowed
    • No datatypes
    • No namespaces, unique identifiers (URIs)
      • no interlinking
      • mapping between instances is required
    • Always appears in the HTML <body>
  • Example: the hCard microformat <cite class=&quot;vcard&quot; > <a class=&quot;fn url&quot; rel=&quot;friend colleague met” href=&quot;http://meyerweb.com/&quot;> Eric Meyer</a> </cite> wrote a post (<cite> <a href=&quot;http://meyerweb.com/eric/thoughts/2005/12/16/tax-relief/&quot;> Tax Relief</a></cite>) about an unintentionally humorous letter he received from the <span class=&quot;vcard” > <a class=&quot;fn org url&quot; href=&quot;http://irs.gov/&quot;> Internal Revenue Service</a> </span>. <div class=&quot;vcard&quot; > <a class=&quot;email fn&quot; href=&quot;mailto:jfriday@host.com&quot;>Joe Friday</a> <div class=&quot;tel&quot; >+1-919-555-7878</div> <div class=&quot;title&quot; >Area Administrator, Assistant</div> </div>
  • RDFa
    • W3C standard for embedding RDF data in HTML documents
      • A set of new HTML attributes to be used in head or body
      • A specification of how to extract the data from these attributes
    • RDFa is just a syntax, you have to choose a vocabulary separately
    • RDFa 1.0 is a W3C Recommendation since October, 2008
      • RDFa Primer
    • RDFa 1.1 is a small update on RDFa to make it easier to use
      • Currently Working Draft (March 31, 2011)
      • Updated version of the RDFa Primer (April 19, 2011)
    • RDFa API for accessing RDFa data in a webpage in the browser from JavaScript
      • Currently Working Draft (April 19, 2011)
  • RDFa 1.1
    • Changes
      • New vocab attribute to define the default namespace for the document or subtree
      • Profile documents to define multiple namespace prefixes
      • The prefix attribute as a recommended replacement of xmlns
      • You can use URIs even where only CURIEs where allowed before
    • RDFa 1.1 is backward compatible with RDFa 1.0
      • RDFa 1.1 is recommended if you want to use HTML5
  • When to use RDFa
    • Choose microformats when you find a microformat that fits your needs and supported by your consumers
      • Microformats are first option because they are simple
      • Yahoo supports all major microformats, see the documentation
      • It’s a common misconception that RDFa requires XHTML or that it’s compatible with HTML5
        • It’s compatible with HTML4, HTML5, XHTML
    • If you find none that perfectly fits your needs then you need RDFa
      • Microformats have a fixed schema: you can not add your own attributes
    • Example: a social networking site with user profiles
      • VCard is a good candidate, but for example it doesn’t have a way to express the user’s social connections
      • You either live without this, or go with RDFa
  • RDFa intro: metadata in the header
    • More info in the
    <html prefix=&quot;og: http://ogp.me/ns#&quot; > <head> <title>The Trouble with Bob</title> <meta property=&quot;og:title&quot; content=&quot;The Trouble with Bob&quot; /> <meta property=&quot;og:type&quot; content=&quot;text&quot; /> <meta property=&quot;og:image&quot; content=&quot;http://example.com/alice/bob-ugly.jpg &quot; /> ... </head>
  • RDFa intro: links with a flavor
    • More info in the
    All content on this site is licensed under <a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by/3.0/&quot;> a Creative Commons License </a>.
  • RDFa links: talking about subjects other than the page
    • More info in the
    The trouble with Bob is that he takes much better photos than me: <div about=&quot;http://example.com/bob/photos/sunset.jpg&quot; > <img src=&quot;http://example.com/bob/photos/sunset.jpg&quot; /> <span property=&quot;og:title&quot;>Beautiful Sunset</span> by <span property=&quot;dc:creator&quot;>Bob</span>. </div>
  • RDFa links: talking about subjects other than the page
    • More info in the
    <div typeof=”foaf:Person&quot; > <p property=”foaf:name&quot;> Alice Birpemswick </p> <p> Email: <a rel=”foaf:mbox” href=&quot;mailto:alice@example.com&quot;> alice@example.com </a> </p> <p> Phone: <a rel=”foaf:phone&quot; href=&quot;tel:+1-617-555-7332&quot;>+1 617.555.7332</a> </p> </div>
  • The process of annotating with RDFa
    • Find a vocabulary that fits your needs and supported by your consumers
      • A vocabulary describes a set of types and attributes within a given domain
      • If you don’t find a good candidate, extend an existing one or create a new one
    • Annotate your page.
      • Before you start, you might want to validate your page for (X)HTML conformance using the W3C’s (X)HTML Validator to reduce the chance of errors. Choose Document Type XHTML + RDFa.
      • No specific tool support. If you have an HTML or XML editor that supports DTDs, you will have syntax checking and highlighting.
      • Use the RDFa Distiller to validate which data can be extracted from your page.
      • If you fancy, use the RDF Validator to graphically visualize the RDF graph that is outputted.
    • Put the annotated page online
      • The data will be extracted by Google/Bing/Yahoo the next time your page is crawled and indexed
      • The data will be available to browser extensions, bookmarklets etc.
    • See http://rdfa.info/rdfa-implementations for new tools and APIs
  • RDFa can be hard to get right…
    • Validation problems can stop us from extracting data
      • Use the W3C validator
      • Use the right DOCTYPE declaration if using XHTML
      • Set the encoding of your page properly (using HTTP headers or XML declaration)
    • Prefixes need to be defined using the xmlns attribute
    • Unless you are making statements about the document, set the subject using the about attribute
    • Do not include HTML elements in literal values
      • Incorrect: <div property=“foaf:name”><b>Peter Mika</b></div>
    • Use absolute URIs as the value of the resource attribute
      • Or make sure you specify HTML base
  • RDFa can be hard to get right… II.
    • Be careful when using rel and typeof in combination because of the precedence rules
    • BAD example:
      • <div about=“#id”>
      • <span property=“foaf:name“>Peter Mika</span>
      • <span rel=“foaf:img“ typeof=“foaf:Image”>
      • <span property=“dc:format”>jpg</span>
      • </span
      • </div>
    • To correct, you need to put the typeof inside the <span> node with rel=“foaf:img”
  • RDFa can be hard to get right… III.
    • Typeof does two things at once: it creates a new subject resource and assigns the type to it
    • BAD example:
      • <div about=“#id”>
      • <span property=“foaf:name“>Peter Mika</span>
      • <span rel=“foaf:img“ resource=“http://www.example.org/photo.jpg”>
      • <span typeof=“foaf:Image”>
      • <span property=“dc:format”>jpg</span>
      • </span
      • </span
      • </div>
    • To correct, you have to repeat the resource attiribute on the span node with the typeof
  • RDFa can be hard to get right… IV.
    • Marking up <h1>:
      • <h1 property=“dc:title”>My homepage</h1>
      • NOT: <h1><div property=“dc:title”>My homepage</h1>
    •   Marking up an image: <span rel=”foaf:img&quot;>         <img alt=&quot;Alex&quot; src=&quot;http://example.org/alex.jpg&quot;/>  </span>
      • NOT:
      • <img rel=“foaf:img” src=“photo.jpg/>
    • Header
      • <meta property=“…” content=“…”>
      • NOT
      • <meta name=“…” content=“…”>
  • RDFa can be hard to get right… V.
    • You can not break up a description like this:
    • <span rel=“foaf:knows&quot;>    <span property=“foaf:name&quot;>Peter Mika</span> </span> ….
    • <span rel=“foaf:knows&quot;>    <a rel=“foaf:email“ href=“mailto:pmika@yahoo-inc.com /> </span>
    • This is not the same as:
    • <span rel=“foaf:knows&quot;>    <span property=“foaf:name&quot;>Peter Mika</span>   
    • <a rel=“foaf:email“ href=“mailto:pmika@yahoo-inc.com />
    • </span>
    • In the first case there are two related resources, with one attribute each, in the second case there is a single related resource with two attributes.
  • Tips
    • Hiding information from being displayed
      • Links without content will not be rendered
      • Use <span property=“foaf:name” content=“Peter Mika”/>
    • Use datatypes to provide the expected type of a literal.
      • This helps validation because any tool can check whether the literal is indeed of that type.
  • Example: Facebook’s Like and the Open Graph Protocol
    • The ‘Like’ button provides publishers with a way to promote their content on Facebook and build communities
      • Shows up in profiles and news feed
      • Site owners can later reach users who have liked an object
      • Facebook Graph API allows 3 rd party developers to access the data
    • Open Graph Protocol is an RDFa-based format that allows to describe the object that the user ‘Likes’
  • Example: Facebook’s Open Graph Protocol
    • RDF vocabulary to be used in conjunction with RDFa
      • Simplify the work of developers by restricting the freedom in RDFa
    • Activities, Businesses, Groups, Organizations, People, Places, Products and Entertainment
    • Only HTML <head> accepted
    • http://opengraphprotocol.org/
    <html xmlns:og=&quot;http://opengraphprotocol.org/schema/&quot; > <head> <title>The Rock (1996)</title> <meta property=&quot;og:title&quot; content=&quot;The Rock&quot; /> <meta property=&quot;og:type&quot; content=&quot;movie&quot; /> <meta property=&quot;og:url&quot; content=&quot;http://www.imdb.com/title/tt0117500/&quot; /> <meta property=&quot;og:image&quot; content=&quot;http://ia.media-imdb.com/images/rock.jpg&quot; /> … </head> ...
  • Example: Yahoo! Enhanced Results (was: SearchMonkey)
    • Guide for publishers to mark-up their pages for common types of objects
      • Product, Local, News, Video, Events, Documents, Discussion, Games
    • Using popular microformats and RDF vocabularies
      • Copy-paste code
      • Validator
    • Yahoo as a consumer
      • See later
  • Example: Google’s Rich Snippets
    • Google accepts popular microformats and its own RDFa vocabulary
      • Similar approach to RDFa as Facebook
    • Validator to check if the markup is correct
    • Google displays enhanced results based on this metadata
      • Rich Snippets
  • Microdata example <div itemscope itemid=“http://www.yahoo.com/resource/person ”> <p>My name is <span itemprop=&quot;name&quot; >Neil</span>.</p> <p>My band is called <span itemprop =&quot;band&quot;>Four Parts Water</span>. I was born on <time itemprop=&quot;birthday&quot; datetime=&quot;2009-05-10&quot;>May 10th 2009</time>. <img itemprop=&quot;image&quot; src=”me.png&quot; alt=”me”> </p> </div
  • Microdata
    • Currently under standardization at the W3C
      • Originally part of the HTML5 spec, but now a separate document
    • Similar to microformats, but with the extensibility of RDFa
      • Introduce new terms using reverse domain names or full URIs
    • HTML5 also has a number of “semantic” elements such as <time>, <video>, <article>…
  • RDFa on the rise Percentage of URLs with embedded metadata in various formats 510% increase between March, 2009 and October, 2010
  • The state of metadata in HTML
    • 5-10% of webpages contain some explicit metadata
      • Depending on how you count…
    • Too many competing approaches
      • Too many formats: microformats vs RDFa vs Microdata
      • When using RDFa, publishers may need to use multiple different vocabularies to satisfy everyone