Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Publishing data on the Semantic Web

Nächste SlideShare
Semantic Web Austin Yahoo
Semantic Web Austin Yahoo
Wird geladen in …3

Hier ansehen

1 von 63 Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (19)

Ähnlich wie Publishing data on the Semantic Web (20)


Aktuellste (20)


Publishing data on the Semantic Web

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

Hinweis der Redaktion

  • 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