ruby-rdf / sparql-client

SPARQL client for Ruby.
http://rubygems.org/gems/sparql-client
The Unlicense
112 stars 58 forks source link

Ruby warning in query_without_retry method #97

Closed s0rin closed 2 years ago

s0rin commented 3 years ago

Since Ruby 2.7 a warning is shown:

.../lib/sparql/client.rb:10: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
.../.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sparql-client-3.1.0/lib/sparql/client.rb:311: warning: The called method `query_without_retry' is defined here
gkellogg commented 3 years ago

I’ll squash that.

gkellogg commented 3 years ago

I'm not seeing that on the develop branch. Can you give me something to reproduce the error you're seeing?

It may be that your code needs to update the call to query to pass a pattern in an explicit hash, which is what this warning typically means. For example query({subject: foo, predicate: bar}, **options).

See RDF.rb release 3.1.0 release notes.

s0rin commented 3 years ago

Thank you for looking into this.

Here is example where the warnings occurs:

irb(main):001:0> dnbt = RDF::Vocabulary.new("https://d-nb.info/standards/elementset/dnb#")
irb(main):002:0> rdf_gndid = RDF::Literal.new("https://d-nb.info/gnd/1059461498")
irb(main):003:0> sparql_client = SPARQL::Client.new("http://127.0.0.1:3030/GNDAJFTSES201120")
irb(main):004:0> gndo = RDF::Vocabulary.new("http://d-nb.info/gnd/standards/elementset/gnd#")
irb(main):005:0> query = sparql_client.select.where([:subject, dnbt.deprecatedUri, rdf_gndid]).where([:subject, gndo.gndIdentifier, :gndid])
irb(main):006:0> query.each_solution do |solution| new_gndid = solution[:gndid].to_s end
/home/solinux/Documents/AptanaStudio3Workspace/konsys/lib/sparql/client.rb:10: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/home/solinux/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sparql-client-3.1.0/lib/sparql/client.rb:311: warning: The called method `query_without_retry' is defined here
=> []
gkellogg commented 3 years ago

I'm not seeing that error using the development branches of the various gems. I'll be releasing updates to all soon, and I'll check back to see if you're still experiencing the issue then.

In the mean time, you might do a general gem update in case there are newer versions that you don't have. The next update of the linkeddata gem will require the latest versions of all.