SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Linked Data on Rails
       Patrick Sinclair
     LRUG 8th June 2009
http://dbtune.org/openhacklondon/London
BBC Music
   BBC
Programmes




             Wikipedia
BBC Music
   BBC
Programmes

   API



             Wikipedia
BBC Music
   BBC
Programmes
                     API

   API



             Wikipedia
BBC Music
   BBC
Programmes
                     API

   API
  Code

             Wikipedia
BBC Music
   BBC
Programmes
                     API
                    Code
   API
  Code

             Wikipedia
BBC Music
   BBC
Programmes
                       API
                      Code
   API
  Code

             Wikipedia


                API
BBC Music
   BBC
Programmes
                       API
                      Code
   API
  Code

             Wikipedia


                API
               Code
BBC Music
   BBC
Programmes
                       API
                      Code
   API
  Code

             Wikipedia




                  ?
                API
               Code
what if there was a standard
   way of publishing and
 querying data on the web?
Information Management: A Proposal
                   Tim Berners-Lee, CERN
March 1989, May 1990 - http://www.w3.org/History/1989/proposal.html
http://www.flickr.com/photos/danbri/2415237566/
Linked Data


http://linkeddata.org
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
4. Include links to other URIs, so
that they can discover more things
RDF


Resource Description Framework
RDF
subject - predicate - object
RDF
subject - predicate - object
Ruby was designed by Matz
RDF
subject - predicate - object
Ruby was designed by Matz

Ruby was designed by Matz
RDF
               subject - predicate - object
              Ruby was designed by Matz

              Ruby was designed by Matz

http://dbpedia.org/resource/Ruby_(programming_language)
RDF
               subject - predicate - object
              Ruby was designed by Matz

              Ruby was designed by Matz

http://dbpedia.org/resource/Ruby_(programming_language)




           http://dbpedia.org/resource/Yukihiro_Matsumoto
RDF
               subject - predicate - object
              Ruby was designed by Matz

              Ruby was designed by Matz

http://dbpedia.org/resource/Ruby_(programming_language)

             http://dbpedia.org/property/designer


           http://dbpedia.org/resource/Yukihiro_Matsumoto
prefix dbprop: <http://dbpedia.org/property/>




       http://dbpedia.org/resource/Yukihiro_Matsumoto

                     dbprop:designer

http://dbpedia.org/resource/Ruby_(programming_language)
prefix dbprop: <http://dbpedia.org/property/>




                                           “Yukihiro Matsumoto”

                                           dbprop:name
       http://dbpedia.org/resource/Yukihiro_Matsumoto

                     dbprop:designer

http://dbpedia.org/resource/Ruby_(programming_language)
prefix dbprop: <http://dbpedia.org/property/>




                                           “Yukihiro Matsumoto”

                                           dbprop:name
       http://dbpedia.org/resource/Yukihiro_Matsumoto

                     dbprop:designer     dbprop:nickname
                                                      “Matz”
http://dbpedia.org/resource/Ruby_(programming_language)
prefix dbprop: <http://dbpedia.org/property/>




                 http://dbpedia.org/resource/Japan

                                            “Yukihiro Matsumoto”
             dbprop:nationality
                                            dbprop:name
       http://dbpedia.org/resource/Yukihiro_Matsumoto

                     dbprop:designer      dbprop:nickname
                                                       “Matz”
http://dbpedia.org/resource/Ruby_(programming_language)
prefix dbprop: <http://dbpedia.org/property/>
prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
                 35.683334           139.766663

                     geo:lat          geo:long

                   http://dbpedia.org/resource/Japan

                                                 “Yukihiro Matsumoto”
               dbprop:nationality
                                                 dbprop:name
         http://dbpedia.org/resource/Yukihiro_Matsumoto

                        dbprop:designer     dbprop:nickname
                                                         “Matz”
  http://dbpedia.org/resource/Ruby_(programming_language)
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> .
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://umbel.org/umbel/sc/Language> .



                                                                                                                               ntriples
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> .
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://umbel.org/umbel/sc/Language> .



                                                                                                                               ntriples

   <rdf:RDF xmlns:log=quot;http://www.w3.org/2000/10/swap/log#quot;
       xmlns:rdf=quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#quot;>

       <Language xmlns=quot;http://umbel.org/umbel/sc/quot;
           rdf:about=quot;http://dbpedia.org/resource/Ruby_(programming_language)quot;>
           <designer xmlns=quot;http://dbpedia.org/property/quot;
               rdf:resource=quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;/>
       </Language>
   </rdf:RDF>
                                                                                                                           RDF/XML
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> .
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://umbel.org/umbel/sc/Language> .



                                                                                                                               ntriples

   <rdf:RDF xmlns:log=quot;http://www.w3.org/2000/10/swap/log#quot;
       xmlns:rdf=quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#quot;>

       <Language xmlns=quot;http://umbel.org/umbel/sc/quot;
           rdf:about=quot;http://dbpedia.org/resource/Ruby_(programming_language)quot;>
           <designer xmlns=quot;http://dbpedia.org/property/quot;
               rdf:resource=quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;/>
       </Language>
   </rdf:RDF>
                                                                                                                           RDF/XML

  @prefix dbprop: <http://dbpedia.org/property/> .

  <http://dbpedia.org/resource/Ruby_(programming_language)>
    a <http://umbel.org/umbel/sc/Language>;
    dbprop:designer <http://dbpedia.org/resource/Yukihiro_Matsumoto> .


                                                                                                                                 turtle
http://dbpedia.org
http://en.wikipedia.org/wiki/Ruby_(programming_language)
http://dbpedia.org/resource/Ruby_(programming_language)
RDF grabbing time
curl --include --location http://dbpedia.org/resource/Yukihiro_Matsumoto
=> html representation

curl --include --location --header quot;Accept: application/rdf+xmlquot; http://dbpedia.org/resource/Yukihiro_Matsumoto
=> rdf representation

rapper http://dbpedia.org/resource/Yukihiro_Matsumoto
=> returns triples

e.g. <http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer>
<http://dbpedia.org/resource/Yukihiro_Matsumoto> .

rapper http://dbpedia.org/property/designer
=> returns data about a property

rapper -oturtle http://dbpedia.org/property/designer
=> returns data formatted in turtle
curl --include --location http://dbpedia.org/resource/Yukihiro_Matsumoto

=> redirect to http://dbpedia.org/page/Yukihiro_Matsumoto
=> html representation
curl --include --location --header quot;Accept: application/rdf+xmlquot;
http://dbpedia.org/resource/Yukihiro_Matsumoto

=> rdf representation
rapper http://dbpedia.org/resource/Yukihiro_Matsumoto

=> returns triples


e.g.
<http://dbpedia.org/resource/Ruby_(programming_language)>
<http://dbpedia.org/property/designer>
<http://dbpedia.org/resource/Yukihiro_Matsumoto> .
rapper -oturtle http://dbpedia.org/property/designer

=> returns data formatted in turtle



@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://dbpedia.org/property/designer>
    a rdf:Property ;
    rdfs:label quot;designerquot; .
RDF Vocabularies
•   FOAF, DOAP, Music Ontology, Programmes Ontology...




•   RDF Schema (RDFS)

    •   Describe classes, properties, some restrictions

•   Web Ontology Language (OWL)

    •   More control over restrictions

    •   owl:sameAs
Ruby and RDF
•   Reddy - http://github.com/tommorris/reddy

•   Redland bindings - http://librdf.org

•   ActiveRDF - http://activerdf.org

    •   Like ActiveRecord for RDF data
require 'rubygems'
require 'active_rdf'

# add DBpedia SPARQL endpoint as a datasource
adapter = ConnectionPool.add_data_source(:type
=> :sparql, :url => quot;http://dbpedia.org/sparqlquot;, :engine
=> :virtuoso, :results => :sparql_xml)
adapter.enabled = true

# we register a short-hand notation for the namespaces
Namespace.register(:dbprop, 'http://dbpedia.org/property/')
Namespace.register(:dbowl, 'http://dbpedia.org/ontology/')
matz = RDFS::Resource.new(quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;)
=> #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/
resource/Yukihiro_Matsumotoquot;>
matz.dbprop::nickname
=> quot;Matzquot;
matz.dbprop::nationality
=> #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/
resource/Japanquot;>

japan = matz.dbprop::nationality
=> #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/
resource/Japanquot;>
tokyo = japan.dbowl::capital
=> #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/
resource/Tokyoquot;>

tokyo.dbprop::name
=> quot;Tokyoquot;
tokyo.dbowl::populationTotal
=> 12790000
adapter2 = ConnectionPool.add_data_source :type => :rdflite
adapter2.enabled = true

Namespace.register(:mystuff, 'http://example.org/test/')
=> MYSTUFF
tokyo.mystuff::rating = 5
=> 5

tokyo.mystuff::rating
=> 5

tokyo.mystuff::is_in = japan
=> #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://
dbpedia.org/resource/Japanquot;>
njh’s homepage builder


    http://www.aelius.com/njh/
@prefix   rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix   : <http://xmlns.com/foaf/0.1/> .
@prefix   rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix   owl: <http://www.w3.org/2002/07/owl#> .
@prefix   dc: <http://purl.org/dc/elements/1.1/> .

<http://www.aelius.com/njh/foaf.rdf>
  a :PersonalProfileDocument ;
  rdfs:label quot;Nicholas J Humfrey's FOAF Filequot; ;
  :maker <http://www.aelius.com/njh#me> ;
  :primaryTopic <http://www.aelius.com/njh#me> .

<http://www.aelius.com/njh#me>
  a :Person ;
  dc:description quot;I am a Software Engineer, working for BBC Audio and Music in London.quot;@en ;
  :homepage <http://www.aelius.com/njh/> ;
  :based_near <http://dbpedia.org/resource/London> ;
  :knows <http://danbri.org/foaf.rdf#danbri>, <http://foafbuilder.qdos.com/people/
whomwah.com/foaf.rdf#me>, <http://id.ecs.soton.ac.uk/person/9639>;
  :currentProject <http://www.aelius.com/njh#project-captivednsd>, <http://www.aelius.com/
njh#project-dvbshout>;
  :interest <http://dbpedia.org/resource/C_(programming_language)>, <http://dbpedia.org/
resource/Cycling>, <http://dbpedia.org/resource/Debian>;
  owl:sameAs <http://dbtune.org/last-fm/njh>, <http://www.bbc.co.uk/users/njh#me>, <http://
qdos.com/user/89295d77e0e390538aac662e3f3cae03>;
and it’s all in ruby, check
          it out!
Publishing RDF in Rails


               http://bit.ly/rYPWS
http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
Embrace REST!
Add the mime type




               http://bit.ly/rYPWS
http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
respond block




               http://bit.ly/rYPWS
http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
application.rdf.erb




               http://bit.ly/rYPWS
http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
application.rdf.erb




               http://bit.ly/rYPWS
http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
There’s plenty more!
• Schemas (RDFS) and Ontologies (OWL)
• SPARQL
 • Query language for Linked Data
• Triple stores
 • Store RDF data, no need to design schema up front
• RDFa
 • Embed RDF into HTML markup
 • Supported by Google and Yahoo
Linked Data on Rails and Ruby's Designer

Weitere ähnliche Inhalte

Andere mochten auch

Semantic Web use cases in outcomes research
Semantic Web use cases in outcomes researchSemantic Web use cases in outcomes research
Semantic Web use cases in outcomes researchChimezie Ogbuji
 
BBC Linked Data and the Music Bore
BBC Linked Data and the Music BoreBBC Linked Data and the Music Bore
BBC Linked Data and the Music BorePatrick Sinclair
 
BBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data CloudBBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data CloudPatrick Sinclair
 
Building Linked Data Applications
Building Linked Data ApplicationsBuilding Linked Data Applications
Building Linked Data ApplicationsPatrick Sinclair
 
Implementing the Storyline Ontology in BBC News
Implementing the Storyline Ontology in BBC NewsImplementing the Storyline Ontology in BBC News
Implementing the Storyline Ontology in BBC NewsJeremy Tarling
 

Andere mochten auch (6)

Happenings de los 60 prueba
Happenings  de los 60 pruebaHappenings  de los 60 prueba
Happenings de los 60 prueba
 
Semantic Web use cases in outcomes research
Semantic Web use cases in outcomes researchSemantic Web use cases in outcomes research
Semantic Web use cases in outcomes research
 
BBC Linked Data and the Music Bore
BBC Linked Data and the Music BoreBBC Linked Data and the Music Bore
BBC Linked Data and the Music Bore
 
BBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data CloudBBC Programmes and Music on the Linking Open Data Cloud
BBC Programmes and Music on the Linking Open Data Cloud
 
Building Linked Data Applications
Building Linked Data ApplicationsBuilding Linked Data Applications
Building Linked Data Applications
 
Implementing the Storyline Ontology in BBC News
Implementing the Storyline Ontology in BBC NewsImplementing the Storyline Ontology in BBC News
Implementing the Storyline Ontology in BBC News
 

Ähnlich wie Linked Data on Rails and Ruby's Designer

GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelabCAMELIA BOBAN
 
Semantic web and Drupal: an introduction
Semantic web and Drupal: an introductionSemantic web and Drupal: an introduction
Semantic web and Drupal: an introductionKristof Van Tomme
 
Semantic Web
Semantic WebSemantic Web
Semantic Webhardchiu
 
Geography in Linked Ancient World Data
Geography in Linked Ancient World DataGeography in Linked Ancient World Data
Geography in Linked Ancient World Dataparegorios
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIsJosef Petrák
 
Consuming linked data by machines
Consuming linked data by machinesConsuming linked data by machines
Consuming linked data by machinesPatrick Sinclair
 
An Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of DataAn Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of DataOlaf Hartig
 
Chapter 3 semantic web
Chapter 3 semantic webChapter 3 semantic web
Chapter 3 semantic webR A Akerkar
 
Open Standards for the Semantic Web: XML / RDF(S) / OWL / SOAP
Open Standards for the Semantic Web: XML / RDF(S) / OWL / SOAPOpen Standards for the Semantic Web: XML / RDF(S) / OWL / SOAP
Open Standards for the Semantic Web: XML / RDF(S) / OWL / SOAPPieter De Leenheer
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and futureHiroshi SHIBATA
 
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OOVirtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OOPaolo Cristofaro
 
The Semantic Web An Introduction
The Semantic Web An IntroductionThe Semantic Web An Introduction
The Semantic Web An Introductionshaouy
 
Ruby semweb 2011-12-06
Ruby semweb 2011-12-06Ruby semweb 2011-12-06
Ruby semweb 2011-12-06Gregg Kellogg
 
SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)
SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)
SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)net2-project
 
Creative Commons @ Seybold San Francisco 2004 - DRM Roundtable
Creative Commons @ Seybold San Francisco 2004 - DRM RoundtableCreative Commons @ Seybold San Francisco 2004 - DRM Roundtable
Creative Commons @ Seybold San Francisco 2004 - DRM RoundtableMike Linksvayer
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and SemanticsTatiana Al-Chueyr
 

Ähnlich wie Linked Data on Rails and Ruby's Designer (20)

Ontologias - RDF
Ontologias - RDFOntologias - RDF
Ontologias - RDF
 
GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelab
 
Data in RDF
Data in RDFData in RDF
Data in RDF
 
Semantic web and Drupal: an introduction
Semantic web and Drupal: an introductionSemantic web and Drupal: an introduction
Semantic web and Drupal: an introduction
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 
Bio2RDF@BH2010
Bio2RDF@BH2010Bio2RDF@BH2010
Bio2RDF@BH2010
 
Geography in Linked Ancient World Data
Geography in Linked Ancient World DataGeography in Linked Ancient World Data
Geography in Linked Ancient World Data
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
 
Consuming linked data by machines
Consuming linked data by machinesConsuming linked data by machines
Consuming linked data by machines
 
An Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of DataAn Introduction to RDF and the Web of Data
An Introduction to RDF and the Web of Data
 
Chapter 3 semantic web
Chapter 3 semantic webChapter 3 semantic web
Chapter 3 semantic web
 
Open Standards for the Semantic Web: XML / RDF(S) / OWL / SOAP
Open Standards for the Semantic Web: XML / RDF(S) / OWL / SOAPOpen Standards for the Semantic Web: XML / RDF(S) / OWL / SOAP
Open Standards for the Semantic Web: XML / RDF(S) / OWL / SOAP
 
The secret of programming language development and future
The secret of programming  language development and futureThe secret of programming  language development and future
The secret of programming language development and future
 
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OOVirtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
Virtuoso RDF Triple Store Analysis Benchmark & mapping tools RDF / OO
 
The Semantic Web An Introduction
The Semantic Web An IntroductionThe Semantic Web An Introduction
The Semantic Web An Introduction
 
Ruby semweb 2011-12-06
Ruby semweb 2011-12-06Ruby semweb 2011-12-06
Ruby semweb 2011-12-06
 
SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)
SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)
SPARQL1.1 Tutorial, given in UChile by Axel Polleres (DERI)
 
Creative Commons @ Seybold San Francisco 2004 - DRM Roundtable
Creative Commons @ Seybold San Francisco 2004 - DRM RoundtableCreative Commons @ Seybold San Francisco 2004 - DRM Roundtable
Creative Commons @ Seybold San Francisco 2004 - DRM Roundtable
 
儲かるドキュメント
儲かるドキュメント儲かるドキュメント
儲かるドキュメント
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 

Kürzlich hochgeladen

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Kürzlich hochgeladen (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

Linked Data on Rails and Ruby's Designer

  • 1. Linked Data on Rails Patrick Sinclair LRUG 8th June 2009
  • 3. BBC Music BBC Programmes Wikipedia
  • 4. BBC Music BBC Programmes API Wikipedia
  • 5. BBC Music BBC Programmes API API Wikipedia
  • 6. BBC Music BBC Programmes API API Code Wikipedia
  • 7. BBC Music BBC Programmes API Code API Code Wikipedia
  • 8. BBC Music BBC Programmes API Code API Code Wikipedia API
  • 9. BBC Music BBC Programmes API Code API Code Wikipedia API Code
  • 10. BBC Music BBC Programmes API Code API Code Wikipedia ? API Code
  • 11.
  • 12. what if there was a standard way of publishing and querying data on the web?
  • 13. Information Management: A Proposal Tim Berners-Lee, CERN March 1989, May 1990 - http://www.w3.org/History/1989/proposal.html
  • 16. 1. Use URIs as names for things
  • 17. 2. Use HTTP URIs so that people can look up those names
  • 18. 3. When someone looks up a URI, provide useful information
  • 19. 4. Include links to other URIs, so that they can discover more things
  • 22. RDF subject - predicate - object Ruby was designed by Matz
  • 23. RDF subject - predicate - object Ruby was designed by Matz Ruby was designed by Matz
  • 24. RDF subject - predicate - object Ruby was designed by Matz Ruby was designed by Matz http://dbpedia.org/resource/Ruby_(programming_language)
  • 25. RDF subject - predicate - object Ruby was designed by Matz Ruby was designed by Matz http://dbpedia.org/resource/Ruby_(programming_language) http://dbpedia.org/resource/Yukihiro_Matsumoto
  • 26. RDF subject - predicate - object Ruby was designed by Matz Ruby was designed by Matz http://dbpedia.org/resource/Ruby_(programming_language) http://dbpedia.org/property/designer http://dbpedia.org/resource/Yukihiro_Matsumoto
  • 27. prefix dbprop: <http://dbpedia.org/property/> http://dbpedia.org/resource/Yukihiro_Matsumoto dbprop:designer http://dbpedia.org/resource/Ruby_(programming_language)
  • 28. prefix dbprop: <http://dbpedia.org/property/> “Yukihiro Matsumoto” dbprop:name http://dbpedia.org/resource/Yukihiro_Matsumoto dbprop:designer http://dbpedia.org/resource/Ruby_(programming_language)
  • 29. prefix dbprop: <http://dbpedia.org/property/> “Yukihiro Matsumoto” dbprop:name http://dbpedia.org/resource/Yukihiro_Matsumoto dbprop:designer dbprop:nickname “Matz” http://dbpedia.org/resource/Ruby_(programming_language)
  • 30. prefix dbprop: <http://dbpedia.org/property/> http://dbpedia.org/resource/Japan “Yukihiro Matsumoto” dbprop:nationality dbprop:name http://dbpedia.org/resource/Yukihiro_Matsumoto dbprop:designer dbprop:nickname “Matz” http://dbpedia.org/resource/Ruby_(programming_language)
  • 31. prefix dbprop: <http://dbpedia.org/property/> prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 35.683334 139.766663 geo:lat geo:long http://dbpedia.org/resource/Japan “Yukihiro Matsumoto” dbprop:nationality dbprop:name http://dbpedia.org/resource/Yukihiro_Matsumoto dbprop:designer dbprop:nickname “Matz” http://dbpedia.org/resource/Ruby_(programming_language)
  • 32. <http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> . <http://dbpedia.org/resource/Ruby_(programming_language)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://umbel.org/umbel/sc/Language> . ntriples
  • 33. <http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> . <http://dbpedia.org/resource/Ruby_(programming_language)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://umbel.org/umbel/sc/Language> . ntriples <rdf:RDF xmlns:log=quot;http://www.w3.org/2000/10/swap/log#quot; xmlns:rdf=quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#quot;> <Language xmlns=quot;http://umbel.org/umbel/sc/quot; rdf:about=quot;http://dbpedia.org/resource/Ruby_(programming_language)quot;> <designer xmlns=quot;http://dbpedia.org/property/quot; rdf:resource=quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;/> </Language> </rdf:RDF> RDF/XML
  • 34. <http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> . <http://dbpedia.org/resource/Ruby_(programming_language)> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://umbel.org/umbel/sc/Language> . ntriples <rdf:RDF xmlns:log=quot;http://www.w3.org/2000/10/swap/log#quot; xmlns:rdf=quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#quot;> <Language xmlns=quot;http://umbel.org/umbel/sc/quot; rdf:about=quot;http://dbpedia.org/resource/Ruby_(programming_language)quot;> <designer xmlns=quot;http://dbpedia.org/property/quot; rdf:resource=quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;/> </Language> </rdf:RDF> RDF/XML @prefix dbprop: <http://dbpedia.org/property/> . <http://dbpedia.org/resource/Ruby_(programming_language)> a <http://umbel.org/umbel/sc/Language>; dbprop:designer <http://dbpedia.org/resource/Yukihiro_Matsumoto> . turtle
  • 37. RDF grabbing time curl --include --location http://dbpedia.org/resource/Yukihiro_Matsumoto => html representation curl --include --location --header quot;Accept: application/rdf+xmlquot; http://dbpedia.org/resource/Yukihiro_Matsumoto => rdf representation rapper http://dbpedia.org/resource/Yukihiro_Matsumoto => returns triples e.g. <http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> . rapper http://dbpedia.org/property/designer => returns data about a property rapper -oturtle http://dbpedia.org/property/designer => returns data formatted in turtle
  • 38. curl --include --location http://dbpedia.org/resource/Yukihiro_Matsumoto => redirect to http://dbpedia.org/page/Yukihiro_Matsumoto => html representation
  • 39. curl --include --location --header quot;Accept: application/rdf+xmlquot; http://dbpedia.org/resource/Yukihiro_Matsumoto => rdf representation
  • 40. rapper http://dbpedia.org/resource/Yukihiro_Matsumoto => returns triples e.g. <http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resource/Yukihiro_Matsumoto> .
  • 41. rapper -oturtle http://dbpedia.org/property/designer => returns data formatted in turtle @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <http://dbpedia.org/property/designer> a rdf:Property ; rdfs:label quot;designerquot; .
  • 42. RDF Vocabularies • FOAF, DOAP, Music Ontology, Programmes Ontology... • RDF Schema (RDFS) • Describe classes, properties, some restrictions • Web Ontology Language (OWL) • More control over restrictions • owl:sameAs
  • 43. Ruby and RDF • Reddy - http://github.com/tommorris/reddy • Redland bindings - http://librdf.org • ActiveRDF - http://activerdf.org • Like ActiveRecord for RDF data
  • 44. require 'rubygems' require 'active_rdf' # add DBpedia SPARQL endpoint as a datasource adapter = ConnectionPool.add_data_source(:type => :sparql, :url => quot;http://dbpedia.org/sparqlquot;, :engine => :virtuoso, :results => :sparql_xml) adapter.enabled = true # we register a short-hand notation for the namespaces Namespace.register(:dbprop, 'http://dbpedia.org/property/') Namespace.register(:dbowl, 'http://dbpedia.org/ontology/')
  • 45. matz = RDFS::Resource.new(quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;) => #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/ resource/Yukihiro_Matsumotoquot;> matz.dbprop::nickname => quot;Matzquot; matz.dbprop::nationality => #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/ resource/Japanquot;> japan = matz.dbprop::nationality => #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/ resource/Japanquot;> tokyo = japan.dbowl::capital => #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http://dbpedia.org/ resource/Tokyoquot;> tokyo.dbprop::name => quot;Tokyoquot; tokyo.dbowl::populationTotal => 12790000
  • 46. adapter2 = ConnectionPool.add_data_source :type => :rdflite adapter2.enabled = true Namespace.register(:mystuff, 'http://example.org/test/') => MYSTUFF tokyo.mystuff::rating = 5 => 5 tokyo.mystuff::rating => 5 tokyo.mystuff::is_in = japan => #<RDFS::Resource:0x1b91a58 @predicates={}, @uri=quot;http:// dbpedia.org/resource/Japanquot;>
  • 47. njh’s homepage builder http://www.aelius.com/njh/
  • 48. @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix : <http://xmlns.com/foaf/0.1/> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . <http://www.aelius.com/njh/foaf.rdf> a :PersonalProfileDocument ; rdfs:label quot;Nicholas J Humfrey's FOAF Filequot; ; :maker <http://www.aelius.com/njh#me> ; :primaryTopic <http://www.aelius.com/njh#me> . <http://www.aelius.com/njh#me> a :Person ; dc:description quot;I am a Software Engineer, working for BBC Audio and Music in London.quot;@en ; :homepage <http://www.aelius.com/njh/> ; :based_near <http://dbpedia.org/resource/London> ; :knows <http://danbri.org/foaf.rdf#danbri>, <http://foafbuilder.qdos.com/people/ whomwah.com/foaf.rdf#me>, <http://id.ecs.soton.ac.uk/person/9639>; :currentProject <http://www.aelius.com/njh#project-captivednsd>, <http://www.aelius.com/ njh#project-dvbshout>; :interest <http://dbpedia.org/resource/C_(programming_language)>, <http://dbpedia.org/ resource/Cycling>, <http://dbpedia.org/resource/Debian>; owl:sameAs <http://dbtune.org/last-fm/njh>, <http://www.bbc.co.uk/users/njh#me>, <http:// qdos.com/user/89295d77e0e390538aac662e3f3cae03>;
  • 49. and it’s all in ruby, check it out!
  • 50.
  • 51. Publishing RDF in Rails http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
  • 53. Add the mime type http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
  • 54. respond block http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
  • 55. application.rdf.erb http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
  • 56. application.rdf.erb http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
  • 57. There’s plenty more! • Schemas (RDFS) and Ontologies (OWL) • SPARQL • Query language for Linked Data • Triple stores • Store RDF data, no need to design schema up front • RDFa • Embed RDF into HTML markup • Supported by Google and Yahoo

Hinweis der Redaktion

  1. I want to start by looking at a data mashup. It&#x2019;s not pretty, but it&#x2019;s doing some interesting things under the covers. With this mashup, you provide a place, e.g. London, and it will list the programmes on the BBC that feature artists coming from that place. e.g. ... Nice for a world music show, or if you&#x2019;re building a travel website and want to recommend music for people wanting to travel to a location...
  2. So this mashup involves: programme information from BBC Programmes artist information from BBC Music and from Wikipedia where each artist was born or was formed How would you go about it in the traditional Web 2.0 API world? BBC Programmes would provide an API, BBC Music would have it&#x2019;s API - most likely designed from scratch and with it&#x2019;s own proprietary XML schema or format. Hopefully someone would have made a nice Ruby gem that abstracts the API so you can call it from a script. With Wikipedia again you&#x2019;ll need an API and some code around it. but the artist born/form data isn&#x2019;t readily available. But what happens with Wikipedia? You&#x2019;d probably have to screen scrape each artist page and work out where the artist was born, then fetch all that data and store it in a database and query that...
  3. And thinking of all of those Web 2.0 sites, each implementing their own API - that&#x2019;s a lot of Ruby libraries for wrapping around...
  4. what if there was a standard way of publishing and querying data on the web? It turns out there is!
  5. And it&#x2019;s been the plan all along. This diagram is from Tim Berners-Lee original proposal for the web. At the time he was thinking about typed links: Tim Berners Lee - wrote - this docment - describes - a proposal (&#x201C;Mesh&#x201D;) &#x201C;This document was an attempt to persuade CERN management that a global hypertext system was in CERN's interests. Note that the only name I had for it at this time was \"Mesh\" -- I decided on \"World Wide Web\" when writing the code in 1990.&#x201D;
  6. And in this diagram, which is based on a talk by Tim Berners Lee from 1994, there&#x2019;s the idea of having documents on the web (the blue blobs), and how they relate to real objects: people, houses, relationships... http://www.w3.org/Talks/WWW94Tim/
  7. The mechanism for exposing, sharing, and connecting data on the web is called Linked Data. And it&#x2019;s based on four rules.
  8. The first rule of linked data is: Use URIs as names for things Any resource you want to talk about: people, places, programming languages, proteins - it gets a URI
  9. The second rule of linked data is: Use HTTP URIs so that people can look up those names And this is important, because...
  10. The third rule of Linked Data is: When someone looks up a URI, provide useful information So whenever there&#x2019;s a URI for a resource you want to know more about, you can use HTTP to fetch data about that resource.
  11. The fourth rule of Linked Data is: Include links to other URIs, so that they can discover more things And this is what makes linked data so powerful, as you can start using links to traverse across different datasets.
  12. Linked Data uses RDF, the resource description framework, to model data. So when you want to fetch some information about a resource, it is returned in RDF.
  13. With RDF, you make statements about resources using subject-predicate-object expressions. For example, if you want to say that &#x201C;Ruby was designed by Matz&#x201D;. The subject is &#x201C;Ruby&#x201D;, the predicate is &#x201C;was designed by&#x201D;, and the &#x201C;object&#x201D; is &#x201C;Matz&#x201D;. And in RDF we&#x2019;re using URIs. So there&#x2019;s a URI for Ruby And a URI for Matz. And here is the URI for the property indicating something&#x2019;s designer.
  14. And using these triple expressions, you build up a graph of data...
  15. And I really want to stress that RDF is a model - there are different serialisations. Here are 2 triples expressed in the ntriples format: it&#x2019;s the most basic format. You simply get subject - predicate - object - new line, subject - predicate - object - new line Here is the most established RDF format: RDF/XML - unfortunately this is the format most people are exposed to when learning about RDF. It&#x2019;s horrible to read, it&#x2019;s ugly - it&#x2019;s just not user friendly at all! Luckily, there&#x2019;s turtle: it let&#x2019;s you write RDF graphs in a compact text format. In turtle, you can see what those 2 triples are saying: The resource here Ruby, has a type Language, and it&#x2019;s designer is Matz. I like to think of turtle versus RDF/XML in the same way you get YAML and XML - it&#x2019;s just so much nicer to use!
  16. I want to show you what happens when you fetch RDF But first I want to introduce DBpedia, as the examples I&#x2019;ve been showing uses DBpedia URIs.
  17. The DBpedia project is extracting structured data from Wikipedia, and making it available as Linked Data. It&#x2019;s mostly based on extracting data from InfoBoxes on the Wikipedia articles. And it uses the Wikipedia article title in the URI for the RDF resource.
  18. I want to quickly introduce the concept of RDF vocabularies. For those familiar with microformats, these are roughly equivalent to microformat vocabularies like hcard, haudio and so on. Some of the most popular ones are: * FOAF - friend of a friend, allows you to talk about people and their relationships, who knows who - a social graph * DOAP - description of a project, let&#x2019;s you talk about projects and who works on them * Music Ontology - defines the domain of music: artists, composers, works, tracks and so on * Programmes Ontology - defined at the BBC, describes programmes and series and broadcasts and so on In RDF there are two ways to define a vocabulary. Originally, there was RDF Schema which let&#x2019;s you define classes and properties, and restrictions (e.g. a &#x201C;born&#x201D; property can only be applied to a &#x201C;person&#x201D; The Web Ontology Language OWL expands on this, so you have more control on restrictions. e.g. can say that a project must have at least one contributor It also defines a really valuable property: owl:sameAs, so you can say this thing in this data set here is the same thing as that data set over there - really useful for mashups.
  19. Reddy - an RDF/XML parser based on libxml. Redland bindings - crossplatform RDF parsing library ActiveRDF, as the name suggests, is like ActiveRecord for RDF.
  20. you can write stuff back if you add a write enabled adapter, you can store data it&#x2019;s like a openstruct on the web and it&#x2019;s a perfect fit for ruby - try doing that with java - it looks horrendous!
  21. Based on the Friends of a Friend (FOAF) vocabulary. Describes people and their relationships...
  22. takes the foaf profile and builds his homepage uses linked data: e.g. it links to his friend&#x2019;s foaf and fetches information about them (e.g. their homepage). Then when someone updates their homepage in their foaf file it can be picked up automatically here. look at interests: linked to dbpedia concepts, so could fetch more data about the interest on the page
  23. One of the interesting things happening in the Linked Data world is the Linking Open Data initiative. A number of data set owners have been publishing their information as Linked Data, including: * DBPedia * BBC * Freebase * Reuters with Open Calais * Lots of the academic scientific community: eprints, pubmed Many linked data geeks have been writing wrappers around normal APIs: * last.fm * myspace * musicbrainz And these datasets, and how they link together, have been documented on what is called the Linked Data cloud. And it&#x2019;s been really exciting to see this cloud grow over the last couple of years.
  24. I&#x2019;d like to see more Ruby and Rails applications on the Linked Data cloud! So here&#x2019;s a quick guide on the simplest possible technique to publish RDF from Rails. It&#x2019;s not quite automagical, but it gets the job done - and it&#x2019;s the same technique we&#x2019;re using on BBC Music and BBC Programmes. I&#x2019;m taking this example from the UK Companies app I was involved in for Rewired state - I&#x2019;m going to take you through the git change set when I added an RDF view to this application. The app displays information about companies registered in the UK.
  25. The first step is to embrace REST - one subject per resource. But as REST is already second nature to most Rails developers, I won&#x2019;t go into this much more.
  26. Now to dig in to some Rails code - first of all we add the RDF mime type.
  27. In the controller action we want to add RDF to, we need to add a format.rdf.
  28. We then need an application.rdf.erb. As RDF/XML is the most widely supported RDF serialisation, I based the RDF view on it. It&#x2019;s pretty straight forward, it just sets up the XML namespaces for the vocabularies I want to use.
  29. Here&#x2019;s the actual RDF erb for the show action for a company. It&#x2019;s pretty simple to implement. The tricky bit is working out the classes/properties to describe your data. But to build this view, I simply started off with some other RDF example. I think I took the RDF/XML off BBC programmes and then hacking around with it. I went to linked data search engines like DBPedia and searched for some companies to see what kind of vocabulary was used to describe them. And that was enough to get going - I put the RDF out there, and once I tweeted about it within a few hours I&#x2019;d received some feedback about certain aspects of the RDF. Some of those comments I took onboard, and then fed this back into the RDF view. It reminds me of when I was learning HTML - you simply look around for stuff you like, view source, copy/paste and then hack around until it looks right.