Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

Linked Data in Use: Schema.org, JSON-LD and hypermedia APIs - Front in Bahia 2014

  1. LINKED DATA IN USE
  2. LINKED DATA IN globo.com Ícaro Medeiros icaro.medeiros@gmail.com ! Time de Semântica semantica@corp.globo.com Front in Bahia 13/9/2014 USE Schema.org, JSON-LD, and hypermedia APIs
  3. WHAT IS LINKED DATA?
  4. SEMANTIC WEB ! DONE RIGHT
  5. "I have a dream for the web in which computers become capable of analyzing all the data on the web - the content, links, and transactions between people and computers." Tim Berners-Lee
  6. ROBERTO CARLOS GOAL AT MARACANÃ
  7. http://www.bbc.co.uk/blogs/legacy/radiolabs/s5/linked-data/s5.html
  8. http://www.bbc.co.uk/blogs/legacy/radiolabs/s5/linked-data/s5.html
  9. Standard Vocabularies • Dublin Core: publications • FOAF: people • SIOC: online communities • DBPedia: Wikipedia in triples
  10. Linked Data Principles 1. Use URIs as names for things 2. Use HTTP URIs so that people can look up those names. 3. When someone looks up a URI, provide useful information, using the standards (RDF*, SPARQL) 4. Include links to other URIs, so that they can discover more things.
  11. Or… 1. Entity identity 2. Access 3. Structure 4. Integration
  12. RDF AND SPARQL
  13. Triple representation subject predicate object Neymar is a player Barcelona is a team Neymar plays for Barcelona
  14. <Player> <Time> is a is a is a plays for <Neymar> <Barcelona> <Santos> <Partida> <BarcelonaXSantos:02082013> is a home team away team location <Camp Nou> date "2013/08/02"
  15. RDF triples @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix foaf: <http://xmlns.com/foaf/0.1/>. @prefix dbpedia: <http://dbpedia.org/ontology> ! esportes:Neymar rdf:type dbpedia:SoccerPlayer ; rdfs:label "Neymar" ; foaf:name "Neymar da Silva Santos Júnior" ; dbpedia:birthDate "05/02/1992" ; owl:sameAs dbpedia:Neymar . Linking! datasets
  16. LINKED DATASETS
  17. SPARQL query Select all instances of dbpedia:SoccerPlayer class and its names ! ! ! SELECT ?player ?name FROM <http://dbpedia.org> WHERE { ?player rdf:type dbpedia:SoccerPlayer ; rdfs:label ?name . }
  18. • Complexity (ontologies?) • NO clear advantage • Triplestore databases: immature • Missing a killer application • Fax problem • Slow adoption Problems
  19. LINKED DATA WITHOUT RDF?
  20. DON’T YOU WORRY ABOUT A schema.org/Thing
  21. SCHEMA.ORG
  22. RICH SNIPPETS GOOGLE NOW KNOWLEDGE GRAPH CLEAR ADVANTAGE
  23. RICH SNIPPETS City Date Location
  24. GMAIL https://developers.google.com/gmail/actions/reference/flight-reservation?hl=pt-BR
  25. GOOGLE NOW
  26. MAPS
  27. SERP
  28. <html itemscope itemtype="http://schema.org/Event"> <head> <title itemprop="name"> Front in Maceió </title> crawler! saves annotation! in KG search results! enhanced
  29. ONE VOCABULARY TO RULE THEM ALL
  30. HOW TO DO IT?
  31. MICRODATA <html itemscope itemtype="http://schema.org/Event"> <head> <title itemprop="name"> Front in Bahia </title> ...
  32. NESTED PROPERTIES <html itemscope itemtype="http://schema.org/Event"> ... <section itemprop="location" itemscope itemtype="http://schema.org/Place"> <span itemprop="name">CESMAC</span> <span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <span itemprop="addressLocality"> Maceió </span> ...
  33. Schema.org usage • Sample 12B pages (Google Index) • 6% domains • ~21% pages • Avg entities/page: 6 • Avg facts/page: 26 http://www.slideshare.net/rvguha/sem-tech2014c
  34. JSON-LD
  35. Plain old JSON { "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", }
  36. JSON-LD { "@context": "http://schema.org", "@type": "MusicEvent", "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", }
  37. Advantages • Semantic layer on top of JSON • Self-described • Can be added to existing APIs • JSON is extensively used • Data can be anchored in schema.org • Easy serialization to RDF
  38. JSON-LD AND HYPERMEDIA APIS
  39. GET /events/1 HTTP/1.1 Host: example.com ==================================== HTTP/1.0 200 OK ... Content-Type: application/json Link: <example.com/events/1.jsonld>; rel=http://www.w3.org/ns/json-ld#context; type=application/ld+json ! { "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", } Client follows link! (hypermedia API)
  40. Self-described Resource { "@context": "http://schema.org", "@type": "MusicEvent", "@id": "/events/1", "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", }
  41. Resource+links { "@context": "http://schema.org", "@type": "MusicEvent", "@id": "/events/1", "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", "offers": [{ "@id": "/events/1/offer/1", "@type": "Offer" }]} Client follows link
  42. JSON-SCHEMA
  43. Schema in different resource GET /events/1 HTTP/1.1 Host: example2.com ==================================== HTTP/1.0 200 OK … Content-Type: application/json; profile=/events/1/_schema ! { "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", } Client follows link (hypermedia API)
  44. GET /events/1/_schema HTTP/1.1 Host: example2.com ==================================== HTTP/1.0 200 OK … ! { "title": "Event", "type": "object", "properties": { "name": {"type": "string"}, "url": {"type": "url"} }, "links": { "rel": "offers", "href": "/events/1/offers" } } Client does not know! URLs, just 'rel's
  45. HYPERMEDIA APIS
  46. Hypermedia? • Don’t remind URLS. Navigate! • Decoupling server and client • Content negotiation • Application treated as State Machine
  47. GET / "links": [ { "href": “http://example.com/“, "rel": "self" }, { "href": "http://example.com/{resource_id}", "rel": "item" }, { "href": "http://example.com", "method": "POST", "rel": "create" }, { "href": "http://example.com/{resource_id}", "method": "DELETE", "rel": "delete" }, { "href": "http://example.com/?page=2", "method": "GET", "rel": "next" } ] { "items": [ { "title": "News", "@id": "http://example.com/news/", "resource_id": "news" }, { "title": "Sports", "@id": "http://example.com/sports/", "resource_id": "sports" } ]
  48. resource_id:sports rel:item GET / /sports GET
  49. self Relations /sports/Team/ Barcelona /sports/ Team inCollection item create replace delete
  50. JSON-LD IN HTML
  51. JSON-LD annotation <script type="application/ld+json"> [{ "@context": "http://schema.org", "@type": "MusicEvent", "name": "Keith Urban", "url": "http://www.keithurban.net/tour/420", "startDate": "2014-09-07", "performer": [{ "@type": "MusicGroup", "name": "Keith Urban", "sameAs": "http://www.keithurban.net"}], www.keithurban.net/tour Linking! datasets Same! vocabulary
  52. "location": { "@type": "Place", "name": "Sleep Train Amphitheatre", "address": { "@type": "PostalAddress", "addressLocality": "Sacramento", "addressState": "CA", "addressCountry": "US" }}, "offers": [{ "@type: "Offer", "name": "TICKETS", "url": "http://www.keithurban.net/tour/420" }]} //... ] </script> Link is! followed! by crawler
  53. { "@context": "http://schema.org", "@type": "MusicEvent", // ... "offers": [{ "@type": "Offer", "name": "General Tickets", "price": "40.00", "priceCurrency": "USD", "availability": "InStock", "validFrom": "2014-02-15T10:00", "category": "primary", "url": "www.axs.com/events/248328/keith-urban-tickets" }]} keithurban.net/tour/420 ……..
  54. www.axs.com/events/248328/keith-urban-tickets
  55. JSON-LD IN EMAIL
  56. <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "FlightReservation", "reservationNumber": "RXJ34P", "reservationStatus": "http://schema.org/Confirmed", "underName": { "@type": "Person", "name": "Eva Green" }, "reservationFor": { "@type": "Flight", "flightNumber": "110", "airline": { "@type": "Airline", "name": "United" }, //... </script>
  57. GMAIL https://developers.google.com/gmail/actions/reference/flight-reservation?hl=pt-BR
  58. OPEN GRAPH
  59. TOOLS
  60. SCHEMA.ORG
  61. JSON-LD.ORG
  62. g.co/StructuredData
  63. http://www.google.com/webmasters/tools/richsnippets
  64. STRUCTURED DATA MARKUP HELPER https://www.google.com/webmasters/markup-helper
  65. https://www.google.com/webmasters/markup-tester/
  66. Semantic annotation goes a looong way • +SEO • +Mobile Rich Info • Applications we don’t even know yet
  67. github.com/! globocom/ IWantToWorkAtGloboCom
  68. icaromedeiros.com.br • Pelican (Python) • Use ReStructuredText (rst) or Markdown • Generate static pages • Deploy to github pages easily • github.com/icaromedeiros/pelican-microdata
  69. .. itemscope:: BusinessEvent :tag: p ! Today I have presented a talk in :itemprop:`Salvador <location>` at :itemprop:`Front in Bahia <name>`.
  70. <p itemscope itemtype="http://schema.org/BusinessEvent"> Today I have presented a talk in <span itemprop="location">Salvador</span> at <span itemprop="name">Front in Bahia</span>. </p>
  71. globo.com Ícaro Medeiros icaro.medeiros@gmail.com ! Semantic team semantica@corp.globo.com slides icaromedeiros.com.br slideshare.net/icaromedeiros
Advertisement