- From: Peter Vandenabeele <peter@vandenabeele.com>
- Date: Thu, 20 Jun 2013 10:59:42 +0200
- To: Gregg Kellogg <gregg@greggkellogg.net>
- Cc: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
- Message-ID: <CAC969dKfdA-k7Fa=d58nHpLn+MO01ZuBkrfSSek_PQRFEEZaBQ@mail.gmail.com>
On Thu, Jun 20, 2013 at 1:31 AM, Gregg Kellogg <gregg@greggkellogg.net>wrote: > Just released SPARQL::Client version 1.0.4, which now works against an > RDF::Repository (actually any RDF::Queryable) in addition to remote > endpoints. This allows the DSL to be used along with the SPARQL gem to > access a local Repository, and runs in pure Ruby. For example: > > require 'rdf/turtle' > require 'sparql/client' > repository = RDF::Repository.load(" > https://raw.github.com/ruby-rdf/sparql-client/master/etc/doap.ttl", > :format => :ttl) > > sparql = SPARQL::Client.new(repository) > query = sparql.select.where([:s, :p, :o]).offset(10).limit(10) > > Gregg Kellogg > gregg@greggkellogg.net > > Hi Gregg, I tried your script (in the context of an rvm gemset that was populated with this Gemfile): $ cat Gemfile source 'https://rubygems.org' gem 'rdf' gem 'rdf-turtle' gem 'sparql' gem 'sparql-client' I add the resulting Gemfile.lock below for detailed versions. It works, but I seem to miss the part to execute the actual query or ask the results from it? I must be missing something trivial ... The thrown execption is: NoMethodError: undefined method `execute' for SPARQL:Module Thanks, Peter Vandenabeele $ irb 2.0.0p195 :001 > require 'rdf/turtle' => true 2.0.0p195 :002 > require 'sparql/client' => true 2.0.0p195 :003 > repository = RDF::Repository.load(" https://raw.github.com/ruby-rdf/sparql-client/master/etc/doap.ttl", :format => :ttl) => #<RDF::Repository:0x3ff7f4e347f8()> 2.0.0p195 :004 > 2.0.0p195 :005 > sparql = SPARQL::Client.new(repository) => #<SPARQL::Client:0x3ff7f50d7438(#<RDF::Repository:0x007fefe9c68ff0>)> 2.0.0p195 :006 > query = sparql.select.where([:s, :p, :o]).offset(10).limit(10) => #<SPARQL::Client::Query:0x3ff7f51130a0(SELECT * WHERE { ?s ?p ?o . } OFFSET 10 LIMIT 10)> 2.0.0p195 :007 > query.result ## same execption for `query.execute` NoMethodError: undefined method `execute' for SPARQL:Module from /Users/peter_v/.rvm/gems/ruby-2.0.0-p195@ruby-rdf/gems/sparql-client-1.0.4/lib/sparql/client.rb:259:in `query' from /Users/peter_v/.rvm/gems/ruby-2.0.0-p195@ruby-rdf/gems/sparql-client-1.0.4/lib/sparql/client.rb:232:in `block in call_query_method' from /Users/peter_v/.rvm/gems/ruby-2.0.0-p195@ruby-rdf/gems/sparql-client-1.0.4/lib/sparql/client/query.rb:306:in `result' from (irb):7 from /Users/peter_v/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in `<main>' As a reference, the Gemfile.lock with the actual versions: /Users/peter_v/data/rdf/rdf-ruby $ cat Gemfile.lock GEM remote: https://rubygems.org/ specs: addressable (2.3.4) builder (3.2.2) ebnf (0.3.1) rdf sxp json (1.8.0) json_pure (1.8.0) mini_portile (0.5.0) net-http-persistent (2.8) nokogiri (1.6.0) mini_portile (~> 0.5.0) rdf (1.0.7) addressable (>= 2.2) rdf-aggregate-repo (0.1.2) rdf (>= 1.0) rdf-turtle (1.0.8) ebnf (>= 0.3.0) rdf (>= 1.0.7) rdf-xsd (1.0.2.1) nokogiri (>= 1.5.0) rdf (>= 0.3.4) sparql (1.0.8) builder (>= 3.0) ebnf (>= 0.3.0) json (>= 1.7) rdf (>= 1.0.6) rdf-aggregate-repo rdf-xsd (>= 1.0) sparql-client (>= 1.0) sxp (>= 0.1.0) sparql-client (1.0.4) json_pure (>= 1.4) net-http-persistent (>= 1.4) rdf (>= 1.0) sxp (0.1.3) json (>= 1.1.1) PLATFORMS ruby DEPENDENCIES rdf rdf-turtle sparql sparql-client -- Peter Vandenabeele http://www.linkedin.com/in/petervandenabeele https://github.com/petervandenabeele https://twitter.com/peter_v gsm: +32-478-27.40.69 e-mail: peter@vandenabeele.com skype: peter_v_be
Received on Thursday, 20 June 2013 13:18:01 UTC