SlideShare una empresa de Scribd logo
1 de 13
Linked Open Data for Rubyists


    What the Semantic Web brings to Ruby

               Gregg Kellogg
              gregg@greggkellogg.net
                Twitter: @gkellogg
                 G+: greggkellogg
Why RDF for Ruby?


   ✤ Major creative force in Web 2.0
   ✤ Rich eco-system (Gems/Rails/…)
   ✤ Fair support for XML (Nokogiri, anyway)
   ✤ Great environment for prototyping and getting
     stuff done.
   ✤ RDF is relatively virgin territory in Ruby



6 Dec 2012                  Ruby SemWeb              2
Ruby RDF
 ❖ RDF.rb/linkeddata                  ❖ Storage
 ❖ Readers/Writers                          ➡ Cassandra

       ➡ RDF/XML                            ➡ SQL(RDF::DO)

       ➡ N3/Turtle/NTriples                 ➡ MongoDB

       ➡ NQuads/TriX                        ➡ Redstore

       ➡ RDFa/Microdata                     ➡ Sesame

       ➡ JSON-LD/RDF-JSON                   ➡ AlegroGraph

       ➡ Raptor bridge                      ➡ Talis
                                            ➡ 4store
 ❖ Query
       ➡ SPARQL/SSE
       ➡ SPARQL::Client


6 Dec 2012                    Ruby SemWeb                    3
Core Classes
 ❖ RDF::Term                                  ❖ Serializations
       ➡ RDF::Literal                               ➡ RDF::Format
             ➡ XSD subtypes                         ➡ RDF::Reader
       ➡ RDF::Resource                              ➡ RDF::Writer
             ➡ RDF::Node                      ❖ Storage
             ➡ RDF::URI                             ➡ RDF::Repository
             ➡ RDF::List
                                              ❖ Query
             ➡ RDF::Graph
                                                    ➡ RDF::Query
 ❖ RDF::Statement                                   ➡ RDF::Query::Pattern
 ❖ RDF::Vocabulary                                  ➡ RDF::Query::Solution
       ➡ With definitions for common                 ➡ RDF::Query::Variable
         vocabularies

6 Dec 2012                            Ruby SemWeb                            4
Simple Graph Manipulation
require 'rdf'

include RDF
g = Graph.new
g << Statement.new(
  RDF::URI.new("https://github.com/gkellogg/rdf"),
  RDF::URI.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
  RDF::URI.new("http://usefulinc.com/ns/doap#GitRepository"))

# Using common vocabularies
proj = Node.new
g << Statement.new(proj, RDF.type, DOAP.Project)
g << Statement.new(proj, DOAP.repository,
  RDF::URI.new("https://github.com/gkellogg/rdf"))

puts g.dump(:ntriples)




6 Dec 2012                     Ruby SemWeb                           5
Serializing with Writers
   ✤ Graphs can be serialized with available Writers

require 'rdf/ntriples'
require 'rdf/turtle'

puts NTriples::Writer.buffer {|writer| writer << g}

# Also, you can include other formats
Turtle::Writer.buffer {|writer| writer << g}

# Use Graph.dump or Writer.open to save to a file
puts g.dump(:ttl, :standard_prefixes => true)

Turtle::Writer.open('example2.ttl') {|w| w << g}
puts File.read('example2.ttl')




6 Dec 2012                     Ruby SemWeb             6
RDFa Serialization with Haml

   ✤ RDFa writer uses Haml templates write a graph to
     HTML
         ➡   Define your own templates
         ➡   Other examples from Structured Data Linter:
             ➡   http://linter.structured-data.org
             ➡   https://github.com/structured-data/linter/blob/master/lib/rdf/linter/
                 rdfa_template.rb

   ✤ In principle, this can be used to write any XML-
     based format by defining an appropriate template
   ✤ More information in RDFa gem

6 Dec 2012                                 Ruby SemWeb                                   7
Finding Formats
   ✤ Find a format for reading or writing
require 'rdf/rdfa'
require 'rdf/rdfxml'

Writer.for(:ttl)
Writer.for(:content_type => "text/html")
Reader.for('example2.ttl')

# List available formats
RDF::Format.to_a.map(&:to_sym)

# Open a URL and use format detection to find a writer
puts Graph.load('http://greggkellogg.net/foaf').
  dump(:ttl, :base_uri => 'http://greggkellogg.net/foaf',
       :standard_prefixes => true)

f = "http://greggkellogg.net/github-lod/doap.ttl"
Turtle::Reader.open(f) do |reader|
  reader.each {|st| puts st.inspect}
end

6 Dec 2012                         Ruby SemWeb              8
BGP Query support
f = "http://greggkellogg.net/github-lod/doap.ttl"
doap = Graph.load(f)
                                                       ✤ Query with
# using RDF::Query
query = Query.new(
                                                         RDF::Query
  :person => {
      RDF.type => FOAF.Person,
      FOAF.name => :name,
      FOAF.mbox => :email,
  })
query.execute(doap).each do |soln|
  puts "name: #{soln.name}, email: #{soln[:email]}"
end; nil

# using Query::Pattern
query = Query.new do
  pattern [:project, DOAP.developer, :person]
  pattern [:person, FOAF.name, :name]
end
query.execute(doap).each do |soln|
  puts "project: #{soln.project} name: #{soln.name}"
end; nil
6 Dec 2012                         Ruby SemWeb                        9
SPARQL
require 'sparql'                                     ❖ SPARQL gem
f = "./dumps/github-lod.nt"                            executes locally
doap = Graph.load(f)
                                                       for against
query = SPARQL.parse(%q(                               RDF::Queryable
  PREFIX doap: <http://usefulinc.com/ns/doap#>
  PREFIX foaf: <http://xmlns.com/foaf/0.1/>            object.
  SELECT ?repo ?name
                                                     ❖ SPARQL::Client
  WHERE {                                              gem executes
    [ a doap:Project;
      doap:name ?repo;
                                                       against a remote
      doap:developer [ a foaf:Person;                  repository
        foaf:name ?name
        ]
                                                       ➡ Best for querying
    ]                                                    large datasets.
  }
  ORDER BY DESC(?repo)
  LIMIT 20
))
query.execute(doap).each do |soln|
   puts "project: #{soln.repo} name: #{soln.name}"
end; nil




                                        10
RDF Behavior
   ✤ Classes can behave like RDF
         ➡   RDF::Countable – #empty?, #count, #size
         ➡   RDF::Durable
         ➡   RDF::Enumerable – must implement #each
             –   #statements, #each, #triples, #quads, ...
         ➡   RDF::Writable – must implement #(insert/delete/each)_statement
             –   #load, #insert, #<<, #update, #delete
         ➡   RDF::Queryable – must implement #each
             ➡   should implement #query_pattern & #query_execute
             –   #query, #first, #first_(subject,predicate,object)
         –   RDF::TypeCheck – raises TypeError on illegal comparison

6 Dec 2012                                 Ruby SemWeb                        11
ActiveRecord with RDF
   ✤ Import #RDF::Enumerable and implement #each
require 'github-api-client'
class GitHub::User
  include RDF::Enumerable
  def each
    u = RDF::URI("http://github.com/#{login}")
    yield RDF::Statement.new(u, RDF::FOAF.name, name)
    yield RDF::Statement.new(u, RDF::mbox, RDF::URI("mailto:#{email}")) unless email.nil?
  end
end

u = GitHub::User.get('gkellogg')
puts u.dump(:ttl, :standard_prefixes => true)




6 Dec 2012                            Ruby SemWeb                               12
Other Resources
   ✤ Spira
         ➡   Get Ruby classes from RDF datastores

   ✤ Distiller
         ➡   Transform between RDF formats, including RDFa generation
         ➡   http://rdf.greggkellogg.net

   ✤ Documentation
         ➡   Comprehensive documentation of Ruby LinkedData related gems available at
             http://rdf.greggkellogg.net/yard/index.html

   ✤ GitHub LOD Demo
         ➡   Examples used in this presentation, along with a demo Sinatra application
             illustrating Ruby RDF usage is available:
             ➡   GitHub project: http://github.com/gkellogg/github-lod (Public Domain)
             ➡   Running demo: http://greggkellogg.net/github-lod
6 Dec 2012                                 Ruby SemWeb                                   13

Más contenido relacionado

La actualidad más candente

An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQLOlaf Hartig
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialAdonisDamian
 
Bigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studiesBigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studiesDiego Valerio Camarda
 
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panicoDiego Valerio Camarda
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQLOlaf Hartig
 
RDF Stream Processing Models (SR4LD2013)
RDF Stream Processing Models (SR4LD2013)RDF Stream Processing Models (SR4LD2013)
RDF Stream Processing Models (SR4LD2013)Daniele Dell'Aglio
 
Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...source{d}
 
SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data
SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)dataSUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data
SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)dataDiego Valerio Camarda
 
Querying the Web of Data with XSPARQL 1.1
Querying the Web of Data with XSPARQL 1.1Querying the Web of Data with XSPARQL 1.1
Querying the Web of Data with XSPARQL 1.1Daniele Dell'Aglio
 
An Introduction to Groovy for Java Developers
An Introduction to Groovy for Java DevelopersAn Introduction to Groovy for Java Developers
An Introduction to Groovy for Java DevelopersKostas Saidis
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
 
JavaCro 2016 - From Java to Groovy: Adventure Time!
JavaCro 2016 - From Java to Groovy: Adventure Time!JavaCro 2016 - From Java to Groovy: Adventure Time!
JavaCro 2016 - From Java to Groovy: Adventure Time!Iván López Martín
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)Olaf Hartig
 

La actualidad más candente (20)

An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
 
XSPARQL Tutorial
XSPARQL TutorialXSPARQL Tutorial
XSPARQL Tutorial
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
 
Bigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studiesBigdive 2014 - RDF, principles and case studies
Bigdive 2014 - RDF, principles and case studies
 
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
 
3 apache-avro
3 apache-avro3 apache-avro
3 apache-avro
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
 
RDF Stream Processing Models (SR4LD2013)
RDF Stream Processing Models (SR4LD2013)RDF Stream Processing Models (SR4LD2013)
RDF Stream Processing Models (SR4LD2013)
 
Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...
 
SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data
SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)dataSUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data
SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data
 
Querying the Web of Data with XSPARQL 1.1
Querying the Web of Data with XSPARQL 1.1Querying the Web of Data with XSPARQL 1.1
Querying the Web of Data with XSPARQL 1.1
 
2007 03 12 Swecr 2
2007 03 12 Swecr 22007 03 12 Swecr 2
2007 03 12 Swecr 2
 
ApacheCon09: Avro
ApacheCon09: AvroApacheCon09: Avro
ApacheCon09: Avro
 
Avro intro
Avro introAvro intro
Avro intro
 
An Introduction to Groovy for Java Developers
An Introduction to Groovy for Java DevelopersAn Introduction to Groovy for Java Developers
An Introduction to Groovy for Java Developers
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
JavaCro 2016 - From Java to Groovy: Adventure Time!
JavaCro 2016 - From Java to Groovy: Adventure Time!JavaCro 2016 - From Java to Groovy: Adventure Time!
JavaCro 2016 - From Java to Groovy: Adventure Time!
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
 
3 avro hug-2010-07-21
3 avro hug-2010-07-213 avro hug-2010-07-21
3 avro hug-2010-07-21
 

Destacado

20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero
20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero
20130628 Taller H2020 Lleida EIP agricultura sostenible: AMonteroFIAB
 
#MoocVT: Introducción a la vigilancia tecnológica para emprender en red
#MoocVT: Introducción a la vigilancia tecnológica para emprender en red#MoocVT: Introducción a la vigilancia tecnológica para emprender en red
#MoocVT: Introducción a la vigilancia tecnológica para emprender en redOVTT
 
Presentación institucional del OVTT (Febrero, 2014)
Presentación institucional del OVTT (Febrero, 2014)Presentación institucional del OVTT (Febrero, 2014)
Presentación institucional del OVTT (Febrero, 2014)OVTT
 
Accion contra el Hambre - The Flying Challenge
Accion contra el Hambre - The Flying ChallengeAccion contra el Hambre - The Flying Challenge
Accion contra el Hambre - The Flying ChallengeAcción contra el Hambre
 
III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...
III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...
III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...OVTT
 
HTML5 and microformats for pragmatists
HTML5 and microformats for pragmatistsHTML5 and microformats for pragmatists
HTML5 and microformats for pragmatistsWojtek Zając
 
Introduction to social media for researchers
Introduction to social media for researchersIntroduction to social media for researchers
Introduction to social media for researchersGilles Couzin
 
Conferencia virtual del OVTT para Colombia (COMPLETO)
Conferencia virtual del OVTT para Colombia (COMPLETO)Conferencia virtual del OVTT para Colombia (COMPLETO)
Conferencia virtual del OVTT para Colombia (COMPLETO)OVTT
 
Plan Estratégico 2012 - 2014
Plan Estratégico 2012 - 2014Plan Estratégico 2012 - 2014
Plan Estratégico 2012 - 2014laspalmasgces
 
I Convención Internacional de Ciencia y Tecnología
I Convención Internacional de Ciencia y TecnologíaI Convención Internacional de Ciencia y Tecnología
I Convención Internacional de Ciencia y TecnologíaOVTT
 
JSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web AppsJSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web AppsGregg Kellogg
 
M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...
M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...
M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...Torres Salinas
 
Twitterology - The Science of Twitter
Twitterology - The Science of TwitterTwitterology - The Science of Twitter
Twitterology - The Science of TwitterBruno Gonçalves
 
Human Mobility (with Mobile Devices)
Human Mobility (with Mobile Devices)Human Mobility (with Mobile Devices)
Human Mobility (with Mobile Devices)Bruno Gonçalves
 
OVTT: Internet como espacio de relación y transformación para innovar en el s...
OVTT: Internet como espacio de relación y transformación para innovar en el s...OVTT: Internet como espacio de relación y transformación para innovar en el s...
OVTT: Internet como espacio de relación y transformación para innovar en el s...OVTT
 
Innovación abierta y transferencia de tecnología desde la Universidad de Alic...
Innovación abierta y transferencia de tecnología desde la Universidad de Alic...Innovación abierta y transferencia de tecnología desde la Universidad de Alic...
Innovación abierta y transferencia de tecnología desde la Universidad de Alic...OVTT
 
OVTT: Vigilancia tecnológica para innovar en red
OVTT: Vigilancia tecnológica para innovar en redOVTT: Vigilancia tecnológica para innovar en red
OVTT: Vigilancia tecnológica para innovar en redOVTT
 
Plan de Emergencias Municipal
Plan de Emergencias Municipal Plan de Emergencias Municipal
Plan de Emergencias Municipal laspalmasgces
 

Destacado (20)

20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero
20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero
20130628 Taller H2020 Lleida EIP agricultura sostenible: AMontero
 
#MoocVT: Introducción a la vigilancia tecnológica para emprender en red
#MoocVT: Introducción a la vigilancia tecnológica para emprender en red#MoocVT: Introducción a la vigilancia tecnológica para emprender en red
#MoocVT: Introducción a la vigilancia tecnológica para emprender en red
 
Presentación institucional del OVTT (Febrero, 2014)
Presentación institucional del OVTT (Febrero, 2014)Presentación institucional del OVTT (Febrero, 2014)
Presentación institucional del OVTT (Febrero, 2014)
 
Accion contra el Hambre - The Flying Challenge
Accion contra el Hambre - The Flying ChallengeAccion contra el Hambre - The Flying Challenge
Accion contra el Hambre - The Flying Challenge
 
LPA_GC: Smart City
LPA_GC: Smart CityLPA_GC: Smart City
LPA_GC: Smart City
 
III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...
III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...
III Congreso Internacional RedUE-ALCUE: redes de valor para la vigilancia tec...
 
HTML5 and microformats for pragmatists
HTML5 and microformats for pragmatistsHTML5 and microformats for pragmatists
HTML5 and microformats for pragmatists
 
Introduction to social media for researchers
Introduction to social media for researchersIntroduction to social media for researchers
Introduction to social media for researchers
 
Conferencia virtual del OVTT para Colombia (COMPLETO)
Conferencia virtual del OVTT para Colombia (COMPLETO)Conferencia virtual del OVTT para Colombia (COMPLETO)
Conferencia virtual del OVTT para Colombia (COMPLETO)
 
Plan Estratégico 2012 - 2014
Plan Estratégico 2012 - 2014Plan Estratégico 2012 - 2014
Plan Estratégico 2012 - 2014
 
Presentation
PresentationPresentation
Presentation
 
I Convención Internacional de Ciencia y Tecnología
I Convención Internacional de Ciencia y TecnologíaI Convención Internacional de Ciencia y Tecnología
I Convención Internacional de Ciencia y Tecnología
 
JSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web AppsJSON-LD: Linked Data for Web Apps
JSON-LD: Linked Data for Web Apps
 
M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...
M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...
M2.Curso Apoyo Investigación Bibliotecas. Bibliotecarios integrados (embedded...
 
Twitterology - The Science of Twitter
Twitterology - The Science of TwitterTwitterology - The Science of Twitter
Twitterology - The Science of Twitter
 
Human Mobility (with Mobile Devices)
Human Mobility (with Mobile Devices)Human Mobility (with Mobile Devices)
Human Mobility (with Mobile Devices)
 
OVTT: Internet como espacio de relación y transformación para innovar en el s...
OVTT: Internet como espacio de relación y transformación para innovar en el s...OVTT: Internet como espacio de relación y transformación para innovar en el s...
OVTT: Internet como espacio de relación y transformación para innovar en el s...
 
Innovación abierta y transferencia de tecnología desde la Universidad de Alic...
Innovación abierta y transferencia de tecnología desde la Universidad de Alic...Innovación abierta y transferencia de tecnología desde la Universidad de Alic...
Innovación abierta y transferencia de tecnología desde la Universidad de Alic...
 
OVTT: Vigilancia tecnológica para innovar en red
OVTT: Vigilancia tecnológica para innovar en redOVTT: Vigilancia tecnológica para innovar en red
OVTT: Vigilancia tecnológica para innovar en red
 
Plan de Emergencias Municipal
Plan de Emergencias Municipal Plan de Emergencias Municipal
Plan de Emergencias Municipal
 

Similar a Ruby semweb 2011-12-06

RejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbRejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbFumihiro Kato
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2Dimitris Kontokostas
 
Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012scorlosquet
 
Apache Jena Elephas and Friends
Apache Jena Elephas and FriendsApache Jena Elephas and Friends
Apache Jena Elephas and FriendsRob Vesse
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebShamod Lacoul
 
Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011Juan Sequeda
 
Semantic Web introduction
Semantic Web introductionSemantic Web introduction
Semantic Web introductionGraphity
 
RDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use itRDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use itJose Luis Lopez Pino
 
Quadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystemQuadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystemRob Vesse
 
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph DatabaseBringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph DatabaseJimmy Angelakos
 
Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)ArangoDB Database
 
The Semantic Web and Drupal 7 - Loja 2013
The Semantic Web and Drupal 7 - Loja 2013The Semantic Web and Drupal 7 - Loja 2013
The Semantic Web and Drupal 7 - Loja 2013scorlosquet
 
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
 
Ks2008 Semanticweb In Action
Ks2008 Semanticweb In ActionKs2008 Semanticweb In Action
Ks2008 Semanticweb In ActionRinke Hoekstra
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaPlatypus
 

Similar a Ruby semweb 2011-12-06 (20)

RejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rbRejectKaigi2010 - RDF.rb
RejectKaigi2010 - RDF.rb
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2
 
Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012Slides semantic web and Drupal 7 NYCCamp 2012
Slides semantic web and Drupal 7 NYCCamp 2012
 
Apache Jena Elephas and Friends
Apache Jena Elephas and FriendsApache Jena Elephas and Friends
Apache Jena Elephas and Friends
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic Web
 
Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011Publishing Linked Data 3/5 Semtech2011
Publishing Linked Data 3/5 Semtech2011
 
Semantic Web introduction
Semantic Web introductionSemantic Web introduction
Semantic Web introduction
 
RDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use itRDFa: introduction, comparison with microdata and microformats and how to use it
RDFa: introduction, comparison with microdata and microformats and how to use it
 
Taming NoSQL with Spring Data
Taming NoSQL with Spring DataTaming NoSQL with Spring Data
Taming NoSQL with Spring Data
 
Quadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystemQuadrupling your elephants - RDF and the Hadoop ecosystem
Quadrupling your elephants - RDF and the Hadoop ecosystem
 
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph DatabaseBringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
Bringing the Semantic Web closer to reality: PostgreSQL as RDF Graph Database
 
Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)
 
The Semantic Web and Drupal 7 - Loja 2013
The Semantic Web and Drupal 7 - Loja 2013The Semantic Web and Drupal 7 - Loja 2013
The Semantic Web and Drupal 7 - Loja 2013
 
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
 
Demo 0.9.4
Demo 0.9.4Demo 0.9.4
Demo 0.9.4
 
Linked Data on Rails
Linked Data on RailsLinked Data on Rails
Linked Data on Rails
 
Ks2008 Semanticweb In Action
Ks2008 Semanticweb In ActionKs2008 Semanticweb In Action
Ks2008 Semanticweb In Action
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFa
 
How RDFa works
How RDFa worksHow RDFa works
How RDFa works
 

Más de Gregg Kellogg

JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017Gregg Kellogg
 
Tabular Data on the Web
Tabular Data on the WebTabular Data on the Web
Tabular Data on the WebGregg Kellogg
 
JSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social WebJSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social WebGregg Kellogg
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataGregg Kellogg
 

Más de Gregg Kellogg (6)

JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017
 
JSON-LD Update
JSON-LD UpdateJSON-LD Update
JSON-LD Update
 
Tabular Data on the Web
Tabular Data on the WebTabular Data on the Web
Tabular Data on the Web
 
JSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social WebJSON-LD: JSON for the Social Web
JSON-LD: JSON for the Social Web
 
JSON-LD and MongoDB
JSON-LD and MongoDBJSON-LD and MongoDB
JSON-LD and MongoDB
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
 

Último

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Último (20)

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Ruby semweb 2011-12-06

  • 1. Linked Open Data for Rubyists What the Semantic Web brings to Ruby Gregg Kellogg gregg@greggkellogg.net Twitter: @gkellogg G+: greggkellogg
  • 2. Why RDF for Ruby? ✤ Major creative force in Web 2.0 ✤ Rich eco-system (Gems/Rails/…) ✤ Fair support for XML (Nokogiri, anyway) ✤ Great environment for prototyping and getting stuff done. ✤ RDF is relatively virgin territory in Ruby 6 Dec 2012 Ruby SemWeb 2
  • 3. Ruby RDF ❖ RDF.rb/linkeddata ❖ Storage ❖ Readers/Writers ➡ Cassandra ➡ RDF/XML ➡ SQL(RDF::DO) ➡ N3/Turtle/NTriples ➡ MongoDB ➡ NQuads/TriX ➡ Redstore ➡ RDFa/Microdata ➡ Sesame ➡ JSON-LD/RDF-JSON ➡ AlegroGraph ➡ Raptor bridge ➡ Talis ➡ 4store ❖ Query ➡ SPARQL/SSE ➡ SPARQL::Client 6 Dec 2012 Ruby SemWeb 3
  • 4. Core Classes ❖ RDF::Term ❖ Serializations ➡ RDF::Literal ➡ RDF::Format ➡ XSD subtypes ➡ RDF::Reader ➡ RDF::Resource ➡ RDF::Writer ➡ RDF::Node ❖ Storage ➡ RDF::URI ➡ RDF::Repository ➡ RDF::List ❖ Query ➡ RDF::Graph ➡ RDF::Query ❖ RDF::Statement ➡ RDF::Query::Pattern ❖ RDF::Vocabulary ➡ RDF::Query::Solution ➡ With definitions for common ➡ RDF::Query::Variable vocabularies 6 Dec 2012 Ruby SemWeb 4
  • 5. Simple Graph Manipulation require 'rdf' include RDF g = Graph.new g << Statement.new( RDF::URI.new("https://github.com/gkellogg/rdf"), RDF::URI.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), RDF::URI.new("http://usefulinc.com/ns/doap#GitRepository")) # Using common vocabularies proj = Node.new g << Statement.new(proj, RDF.type, DOAP.Project) g << Statement.new(proj, DOAP.repository, RDF::URI.new("https://github.com/gkellogg/rdf")) puts g.dump(:ntriples) 6 Dec 2012 Ruby SemWeb 5
  • 6. Serializing with Writers ✤ Graphs can be serialized with available Writers require 'rdf/ntriples' require 'rdf/turtle' puts NTriples::Writer.buffer {|writer| writer << g} # Also, you can include other formats Turtle::Writer.buffer {|writer| writer << g} # Use Graph.dump or Writer.open to save to a file puts g.dump(:ttl, :standard_prefixes => true) Turtle::Writer.open('example2.ttl') {|w| w << g} puts File.read('example2.ttl') 6 Dec 2012 Ruby SemWeb 6
  • 7. RDFa Serialization with Haml ✤ RDFa writer uses Haml templates write a graph to HTML ➡ Define your own templates ➡ Other examples from Structured Data Linter: ➡ http://linter.structured-data.org ➡ https://github.com/structured-data/linter/blob/master/lib/rdf/linter/ rdfa_template.rb ✤ In principle, this can be used to write any XML- based format by defining an appropriate template ✤ More information in RDFa gem 6 Dec 2012 Ruby SemWeb 7
  • 8. Finding Formats ✤ Find a format for reading or writing require 'rdf/rdfa' require 'rdf/rdfxml' Writer.for(:ttl) Writer.for(:content_type => "text/html") Reader.for('example2.ttl') # List available formats RDF::Format.to_a.map(&:to_sym) # Open a URL and use format detection to find a writer puts Graph.load('http://greggkellogg.net/foaf'). dump(:ttl, :base_uri => 'http://greggkellogg.net/foaf', :standard_prefixes => true) f = "http://greggkellogg.net/github-lod/doap.ttl" Turtle::Reader.open(f) do |reader| reader.each {|st| puts st.inspect} end 6 Dec 2012 Ruby SemWeb 8
  • 9. BGP Query support f = "http://greggkellogg.net/github-lod/doap.ttl" doap = Graph.load(f) ✤ Query with # using RDF::Query query = Query.new( RDF::Query :person => { RDF.type => FOAF.Person, FOAF.name => :name, FOAF.mbox => :email, }) query.execute(doap).each do |soln| puts "name: #{soln.name}, email: #{soln[:email]}" end; nil # using Query::Pattern query = Query.new do pattern [:project, DOAP.developer, :person] pattern [:person, FOAF.name, :name] end query.execute(doap).each do |soln| puts "project: #{soln.project} name: #{soln.name}" end; nil 6 Dec 2012 Ruby SemWeb 9
  • 10. SPARQL require 'sparql' ❖ SPARQL gem f = "./dumps/github-lod.nt" executes locally doap = Graph.load(f) for against query = SPARQL.parse(%q( RDF::Queryable PREFIX doap: <http://usefulinc.com/ns/doap#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> object. SELECT ?repo ?name ❖ SPARQL::Client WHERE { gem executes [ a doap:Project; doap:name ?repo; against a remote doap:developer [ a foaf:Person; repository foaf:name ?name ] ➡ Best for querying ] large datasets. } ORDER BY DESC(?repo) LIMIT 20 )) query.execute(doap).each do |soln| puts "project: #{soln.repo} name: #{soln.name}" end; nil 10
  • 11. RDF Behavior ✤ Classes can behave like RDF ➡ RDF::Countable – #empty?, #count, #size ➡ RDF::Durable ➡ RDF::Enumerable – must implement #each – #statements, #each, #triples, #quads, ... ➡ RDF::Writable – must implement #(insert/delete/each)_statement – #load, #insert, #<<, #update, #delete ➡ RDF::Queryable – must implement #each ➡ should implement #query_pattern & #query_execute – #query, #first, #first_(subject,predicate,object) – RDF::TypeCheck – raises TypeError on illegal comparison 6 Dec 2012 Ruby SemWeb 11
  • 12. ActiveRecord with RDF ✤ Import #RDF::Enumerable and implement #each require 'github-api-client' class GitHub::User include RDF::Enumerable def each u = RDF::URI("http://github.com/#{login}") yield RDF::Statement.new(u, RDF::FOAF.name, name) yield RDF::Statement.new(u, RDF::mbox, RDF::URI("mailto:#{email}")) unless email.nil? end end u = GitHub::User.get('gkellogg') puts u.dump(:ttl, :standard_prefixes => true) 6 Dec 2012 Ruby SemWeb 12
  • 13. Other Resources ✤ Spira ➡ Get Ruby classes from RDF datastores ✤ Distiller ➡ Transform between RDF formats, including RDFa generation ➡ http://rdf.greggkellogg.net ✤ Documentation ➡ Comprehensive documentation of Ruby LinkedData related gems available at http://rdf.greggkellogg.net/yard/index.html ✤ GitHub LOD Demo ➡ Examples used in this presentation, along with a demo Sinatra application illustrating Ruby RDF usage is available: ➡ GitHub project: http://github.com/gkellogg/github-lod (Public Domain) ➡ Running demo: http://greggkellogg.net/github-lod 6 Dec 2012 Ruby SemWeb 13

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n