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


...
BBC Music
   BBC
Programmes
                       API
                      Code
   API
  Code

             Wikipedia


...
BBC Music
   BBC
Programmes
                       API
                      Code
   API
  Code

             Wikipedia


...
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/Histo...
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 b...
RDF
               subject - predicate - object
              Ruby was designed by Matz

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

              Ruby was designed b...
prefix dbprop: <http://dbpedia.org/property/>




       http://dbpedia.org/resource/Yukihiro_Matsumoto

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




                                           “Yukihiro Matsumoto”

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




                                           “Yukihiro Matsumoto”

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




                 http://dbpedia.org/resource/Japan

                     ...
prefix dbprop: <http://dbpedia.org/property/>
prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
                 35.683...
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resou...
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resou...
<http://dbpedia.org/resource/Ruby_(programming_language)> <http://dbpedia.org/property/designer> <http://dbpedia.org/resou...
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 --...
curl --include --location http://dbpedia.org/resource/Yukihiro_Matsumoto

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

=...
rapper http://dbpedia.org/resource/Yukihiro_Matsumoto

=> returns triples


e.g.
<http://dbpedia.org/resource/Ruby_(progra...
rapper -oturtle http://dbpedia.org/property/designer

=> returns data formatted in turtle



@prefix rdf: <http://www.w3.o...
RDF Vocabularies
•   FOAF, DOAP, Music Ontology, Programmes Ontology...




•   RDF Schema (RDFS)

    •   Describe classe...
Ruby and RDF
•   Reddy - http://github.com/tommorris/reddy

•   Redland bindings - http://librdf.org

•   ActiveRDF - http...
require 'rubygems'
require 'active_rdf'

# add DBpedia SPARQL endpoint as a datasource
adapter = ConnectionPool.add_data_s...
matz = RDFS::Resource.new(quot;http://dbpedia.org/resource/Yukihiro_Matsumotoquot;)
=> #<RDFS::Resource:0x1b91a58 @predica...
adapter2 = ConnectionPool.add_data_source :type => :rdflite
adapter2.enabled = true

Namespace.register(:mystuff, 'http://...
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: ...
and it’s all in ruby, check
          it out!
Publishing RDF in Rails


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




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




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




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




               http://bit.ly/rYPWS
http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e...
There’s plenty more!
• Schemas (RDFS) and Ontologies (OWL)
• SPARQL
 • Query language for Linked Data
• Triple stores
 • S...
Linked Data on Rails
Linked Data on Rails
Linked Data on Rails
Upcoming SlideShare
Loading in...5
×

Linked Data on Rails

4,902

Published on

Introduction to Linked Data for Ruby and Rails developers

Published in: Technology, Education
0 Comments
13 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,902
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
136
Comments
0
Likes
13
Embeds 0
No embeds

No notes for slide

  • 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...
  • 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...
  • 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...
  • what if there was a standard way of publishing and querying data on the web?

    It turns out there is!
  • 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;

  • 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/

  • The mechanism for exposing, sharing, and connecting data on the web is called Linked Data.

    And it&#x2019;s based on four rules.
  • 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
  • The second rule of linked data is: Use HTTP URIs so that people can look up those names

    And this is important, because...
  • 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.
  • 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.

  • 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.
  • 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.




  • And using these triple expressions, you build up a graph of data...

  • 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!
  • 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.


  • 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.





  • 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.
  • Reddy - an RDF/XML parser based on libxml.

    Redland bindings - crossplatform RDF parsing library

    ActiveRDF, as the name suggests, is like ActiveRecord for RDF.



  • 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!

  • Based on the Friends of a Friend (FOAF) vocabulary.
    Describes people and their relationships...



  • 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

  • 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.
  • 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.

  • 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.
  • Now to dig in to some Rails code - first of all we add the RDF mime type.

  • In the controller action we want to add RDF to, we need to add a format.rdf.
  • 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.
  • 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.



  • Linked Data on Rails

    1. 1. Linked Data on Rails Patrick Sinclair LRUG 8th June 2009
    2. 2. http://dbtune.org/openhacklondon/London
    3. 3. BBC Music BBC Programmes Wikipedia
    4. 4. BBC Music BBC Programmes API Wikipedia
    5. 5. BBC Music BBC Programmes API API Wikipedia
    6. 6. BBC Music BBC Programmes API API Code Wikipedia
    7. 7. BBC Music BBC Programmes API Code API Code Wikipedia
    8. 8. BBC Music BBC Programmes API Code API Code Wikipedia API
    9. 9. BBC Music BBC Programmes API Code API Code Wikipedia API Code
    10. 10. BBC Music BBC Programmes API Code API Code Wikipedia ? API Code
    11. 11. what if there was a standard way of publishing and querying data on the web?
    12. 12. Information Management: A Proposal Tim Berners-Lee, CERN March 1989, May 1990 - http://www.w3.org/History/1989/proposal.html
    13. 13. http://www.flickr.com/photos/danbri/2415237566/
    14. 14. Linked Data http://linkeddata.org
    15. 15. 1. Use URIs as names for things
    16. 16. 2. Use HTTP URIs so that people can look up those names
    17. 17. 3. When someone looks up a URI, provide useful information
    18. 18. 4. Include links to other URIs, so that they can discover more things
    19. 19. RDF Resource Description Framework
    20. 20. RDF subject - predicate - object
    21. 21. RDF subject - predicate - object Ruby was designed by Matz
    22. 22. RDF subject - predicate - object Ruby was designed by Matz Ruby was designed by Matz
    23. 23. RDF subject - predicate - object Ruby was designed by Matz Ruby was designed by Matz http://dbpedia.org/resource/Ruby_(programming_language)
    24. 24. 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
    25. 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/property/designer http://dbpedia.org/resource/Yukihiro_Matsumoto
    26. 26. prefix dbprop: <http://dbpedia.org/property/> http://dbpedia.org/resource/Yukihiro_Matsumoto dbprop:designer http://dbpedia.org/resource/Ruby_(programming_language)
    27. 27. 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)
    28. 28. 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)
    29. 29. 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)
    30. 30. 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)
    31. 31. <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
    32. 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 <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
    33. 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 @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
    34. 34. http://dbpedia.org
    35. 35. http://en.wikipedia.org/wiki/Ruby_(programming_language) http://dbpedia.org/resource/Ruby_(programming_language)
    36. 36. 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
    37. 37. curl --include --location http://dbpedia.org/resource/Yukihiro_Matsumoto => redirect to http://dbpedia.org/page/Yukihiro_Matsumoto => html representation
    38. 38. curl --include --location --header quot;Accept: application/rdf+xmlquot; http://dbpedia.org/resource/Yukihiro_Matsumoto => rdf representation
    39. 39. 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> .
    40. 40. 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; .
    41. 41. 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
    42. 42. Ruby and RDF • Reddy - http://github.com/tommorris/reddy • Redland bindings - http://librdf.org • ActiveRDF - http://activerdf.org • Like ActiveRecord for RDF data
    43. 43. 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/')
    44. 44. 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
    45. 45. 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;>
    46. 46. njh’s homepage builder http://www.aelius.com/njh/
    47. 47. @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>;
    48. 48. and it’s all in ruby, check it out!
    49. 49. Publishing RDF in Rails http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
    50. 50. Embrace REST!
    51. 51. Add the mime type http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
    52. 52. respond block http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
    53. 53. application.rdf.erb http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
    54. 54. application.rdf.erb http://bit.ly/rYPWS http://github.com/robmckinnon/ukcompanies/commit/c3aa368e7aa50e221a983a79faa8ca45bff8902a
    55. 55. 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
    1. Gostou de algum slide específico?

      Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

    ×