error on repo.first.subject
in example
#4
Comments
This particular error is in RDF.rb, not rdf-do. The error likely results from an issue in rdf-do originally, but it's shown up in other gems, and RDF.rb should provide a more meaningful error. This gem has languished and does not pass specs, so it needs more attention. From the original email:
require 'rdf'
require 'rdf/ntriples'
require 'data_objects'
require 'do_sqlite3'
require 'rdf/do'
repo = RDF::DataObjects::Repository.new uri: 'sqlite3:test.db'
# repo = RDF::DataObjects::Repository.new uri: 'postgres://postgres@server/database'
# heroku_repo = RDF::DataObjects::Repository.new uri: ENV['DATABASE_URL']
repo.load('http://datagraph.org/jhacker/foaf.nt')
# How many statements did we have?
repo.count
#=> 10
# Get the URI of the first subject
jhacker = repo.first.subject
#=> #<RDF::URI(http://datagraph.org/jhacker/foaf)>
# Delete everything to do with it
jhacker_statements = repo.query(subject: jhacker)
repo.delete *jhacker_statements
repo.count
#=> 7
# with Postgres, we could have done this, but SQLite gives us a locking error:
# repo.delete(*repo.query(subject: jhacker))
# Changed our mind--bring it back
repo.insert *jhacker_statements
repo.count
#=> 10
|
Is there anything I can do to help bring rdf-do up to spec Gregg? |
As you might have seen, specs are not passing with essentially the same error you reported. Also, we've never configured Postgress on Travis. The As you can tell, this gem has languished, due to general lack of use. Generally, for a simple and more performant option, I use rdf-mongo. I also think that a file-backed (or other persistent store) version of the base That said, we do need to get rdf-do working, so whatever you would like to contribute, in terms of a PR, would be helpful. In the mean time, I'll track down the DEPRECATION issue, which may solve a bunch of problems. |
It seems that the problem is because See ruby-rdf/rdf#365. |
BTW, fixing this allows all but one spec to pass in Sqlite3, that being repository count:
I've seen these before in other repos (e.g., rdf-aggregate-repo), and should look there to see how the issue was resolved. |
Do you want me to have a go at fixing it, or are you on top of it? I know you that
but if you want me to take a look at it I will. I'd need to know how to run the specs for rdf-do locally, am unsure how to do that. I'll tell you why I like using the Sqlite back-end rather than a simple file or Mongo. The reason is that when I'm using Rails in dev mode Sqlite is already automatically being used. That means I point th triplestore repo at the dev Sqlite db and have the triples table Anyway, thanks for following so quickly – as has been my experience with Ruby-RDF in the past 👍 |
I'm giving @no-reply a bit more time to respond to ruby-rdf/rdf#365 (PR ruby-rdf/rdf#366) before I merge it, as he did the Note that DataObjects hasn't been updated in a while, and you'll get numerous warnings when running on a Ruby 2.4 code base, but it functions okay. Unfortunately, the release hasn't had much attention. It may be that it's time to deprecate rdf-do, and simply use the sqlite3 gem directly; same could be done for other database backends, but I don't see evidence for Postgres use with RDF.rb. |
I went ahead and merged #366. I'm open minded about how to handle bringing this gem up to date and willing to throw some cycles at it if we can get a sense of what would be most valuable to the community. |
The update to RDF.rb has been pushed, so this gem should work reasonably, other than deprecation messages issued by data_objects (which is way out of date) and the above mentioned error. @igravious if you'd like to track this down, and potentially see about Postgres going on Travis, that would be great. |
…/vendor/cache/ruby/2.3.0/gems/rdf-2.2.11/lib/rdf/model/dataset.rb:67:in
each_statement': undefined methodeach' for nil:NilClass (NoMethodError) from …/vendor/cache/ruby/2.3.0/gems/rdf-2.2.11/lib/rdf/mixin/queryable.rb:172:in
first'from test-store.rb:24:in
<main>'
fwiw
repo.first_subject
worksThe text was updated successfully, but these errors were encountered: