Skip to content

Instantly share code, notes, and snippets.

@zimeon zimeon/gist:11273436
Last active Aug 29, 2015

Embed
What would you like to do?
Trying out rdf-4store with Ruby RDF

Goal is to try out 4store plugin for Ruby RDF. Was playing with Ruby 2.1.1 under rvm and assuming RDF already installed. Working on a Mac.

Grab current rdf-4store, seems that last commit was Oct 2013, about half a year ago:

simeon@RottenApple ldcx-play>git clone https://github.com/fumi/rdf-4store.git
Cloning into 'rdf-4store'...
remote: Counting objects: 169, done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 169 (delta 44), reused 169 (delta 44)
Receiving objects: 100% (169/169), 76.71 KiB, done.
Resolving deltas: 100% (44/44), done.
simeon@RottenApple ldcx-play>cd rdf-4store
simeon@RottenApple rdf-4store>git log -1
commit 4a04008dfb3a6c9bc2c3354d736d0cb059f769fb
Merge: cc1a6f1 1620552
Author: Rufus Post <rufuspost@gmail.com>
Date:   Thu Oct 3 18:06:44 2013 -0700
...

Now need to set up 4store in order to be able to run tests. Create repo tmp123

simeon@RottenApple rdf-4store>4s-backend-setup tmp123
Apr 24 16:22:38 Simeons-MacBook-Pro.local 4store[31717] <Info>: backend-setup.c:186 erased files for KB tmp123
Apr 24 16:22:38 Simeons-MacBook-Pro.local 4store[31717] <Info>: backend-setup.c:318 created RDF metadata for KB tmp123

Start 4store server, and httpd SPARQL enpoint on top of this. The tests for rdf-4store assume that it will be running in unsafe mode (-U flag, updates allowed), and that it will be on port 10008 (-p option):

simeon@RottenApple rdf-4store>4s-backend tmp123
simeon@RottenApple rdf-4store>4s-httpd -U -p 10008 tmp123

Can then run tests. The rdf-4store test code just sets up rdf-4store as the repository and then runs the examples that come with RDF::Repository. Lots of failures:

simeon@RottenApple rdf-4store>rspec
...........................................................................F...FFFF..FF......F...FFFF..F......F...FFFF..F.......................*..F.......................................F...........FF.FFF....F....F....F............................F............F............

First example is as follows and many are of this type:

simeon@RottenApple rdf-4store>rspec --example "when enumerating statements RDF::Enumerable when enumerating subjects #subjects"
Run options: include {:full_description=>/when\ enumerating\ statements\ RDF::Enumerable\ when\ enumerating\ subjects\ \#subjects/}
.F..
 
Failures:
 
  1) RDF::FourStore::Repository RDF::Repository when enumerating statements RDF::Enumerable when enumerating subjects #subjects
     Failure/Error: specify {subject.each { |value| expect(value).to be_a_resource }}
     NoMethodError:
       undefined method `[]' for nil:NilClass
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/sparql-client-1.1.1/lib/sparql/client/repository.rb:74:in `block in each_subject'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-1.1.3/lib/rdf/query.rb:447:in `each'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-1.1.3/lib/rdf/query.rb:447:in `each_solution'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/sparql-client-1.1.1/lib/sparql/client/repository.rb:74:in `each_subject'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-1.1.3/lib/rdf/mixin/queryable.rb:299:in `block in enum_for'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-spec-1.1.3/lib/rdf/spec/enumerable.rb:230:in `each'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-spec-1.1.3/lib/rdf/spec/enumerable.rb:230:in `each'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-spec-1.1.3/lib/rdf/spec/enumerable.rb:230:in `block (4 levels) in <module:RDF_Enumerable>'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:114:in `instance_eval'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:114:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:111:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:390:in `block in run_examples'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:386:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:386:in `run_examples'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:371:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:372:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in `map'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in `block in run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:58:in `report'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:25:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
     # /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
 
Finished in 3.86 seconds
4 examples, 1 failure
 
Failed examples:
 
rspec /Users/simeon/.rvm/gems/ruby-2.1.1/gems/rdf-spec-1.1.3/lib/rdf/spec/enumerable.rb:230 # RDF::FourStore::Repository RDF::Repository when enumerating statements RDF::Enumerable when enumerating subjects #subjects

Kill 4store stuff:

simeon@RottenApple rdf-4store>killall 4s-httpd 4s-backend
simeon@RottenApple rdf-4store>ps auxwww | grep 4s
simeon         31786   0.0  0.0  2434892    516 s000  R+    4:42PM   0:00.00 grep 4s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.