-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EOFError when using sparql_client.query ... #18
Comments
I've been running into this with a number of queries. It's a Net::HTTP::Persistent bug. I'm trying upgrading Net::HTTP::Persistent in my own branch, thus far it seems good. Is there any reason to not use a newer version of the gem? (this gem is locked on using v. 1.4 of net-http-persistent, they're now at 2.9.4). |
The only real reason to lock it there is to ensure we stick with 1.x which has been tested. If you test against 2.x, then changing the dependency to '~> 2.9' should do the trick. I did try changing it, but specs fail due to WebMock issues (it is probably not patching around net-http-persistent properly now). Certainly, if you can get this working, please consider submitting a pull-request. Note, I've been experimenting with using an HTTP library with pluggable backends for RDF.rb (rufus-jig). This also supports simple caching. This may be useful for sparql-client too, but I haven't had enough time to look spend on it myself lately. |
Yeah, I tried running the test suite and saw that. I will see what I can do about fixing, because upgrading Net::HTTP::Persistent definitely solves the bug (at least in my application). |
Disable Repository tests, as Dydra is really just too slow for remote testing, and WebMock continues to be enabled, causing errors. This relates to issue #18.
Commented out repository tests, which were testing against an actual endpoint (Dydra). Likely, something changed in net-http-persistent which retains a mock even when switching to a new describe block; perhaps some reset necessary. In any case, these specs should run against a local repository, which can be installed on Travis, to be of real use. |
So I added a WebMock.disable! call in the before block of the RDF tests, as well as:
to ensure it didn't screw anything else up. That solved the initial problem, but I ran the suite against the Dydra endpoint just for testing purposes and got 12 failures, all of which don't seem to be connection related. Here's the short version:
So I'm not sure we're out of the woods just yet...On an unrelated note, I get the same WebMock errors even without the upgrade -- I haven't been following this gem's development so I'm not sure when that started, but I don't think the upgrade to net-http-persistent caused it. I tried running the test suite from the prior commit and encountered the exact same errors. |
There are some issues with the Dydra endpoint, due to differences in how literals are maintained (notably xsd:double). Another reason why I'd like to use a different local endpoint. Note that Repo tests are disabled for Travis, so this doesn't affect the pass status. Thanks for figuring this out! A pull request would be great. |
No, you can comment them back in. Even though there are errors, it's useful for finding regressions when running locally. |
Also, you should definitely add yourself to the CREDITS file and to the Contributors section of the README. Thanks for your contributions! |
Done! No problem. Thanks for maintaining the gem. |
* Some SPARQL servers redirect requests. This allows the library to follow redirects, and raise an error in case of a large number of redirects. (Tom Johnson) * Update dependency on net-http-persistent to ~> 2.9. (Nick Gottlieb) * This relates to issue #18.
* Some SPARQL servers redirect requests. This allows the library to follow redirects, and raise an error in case of a large number of redirects. (Tom Johnson) * Update dependency on net-http-persistent to ~> 2.9. (Nick Gottlieb) * This relates to issue #18.
* Update dependencies for RDF 1.1. Use json gem instead of json_pure, as json is built into all rubies now. * Update to RSpec expect syntax and use webmock for remote resources. * Update travis to run unrestricted version of JRuby * Add rdf-aggregate-repo to Gemfile. * Revert use of Enumerator for solutions. * Update Travis test matrix to use rbx instead of rbx-mode19 * Use Nokogiri instead of REXML for parsing results. Nokogiri is significantly faster, and now has a pure-java backend for use on JRuby. This patch potentially breaks backwards compatibility, as parse_xml_bindings no longer accepts REXML elements. * Add Nokogiri dep to README. * Add Nokogiri as development dependency. * Use Nokogiri instead of REXML for parsing results. Nokogiri is significantly faster, and now has a pure-java backend for use on JRuby. This patch potentially breaks backwards compatibility, as parse_xml_bindings no longer accepts REXML elements. * Add Nokogiri dep to README. * Add Nokogiri as development dependency. * Add tests for XML results parsing. * Simplified xml tests slightly. * Update node hash when parsing json. * Add tests for json parsing. * Add csv parsing test. * Minor fixes to TSV parsing. - save blank nodes in nodes table. - Don't crash when columns are empty. * Add test for TSV parsing. * Make nokogiri really be a soft dependency and fallback to REXML if it doesn't load. * add read_timeout support for requests * Test both with and without nokogiri. * Version 1.1.1. * Remove json dependency * Add Ruby 2.1.0 to Travis CI mix. * Use develop version of sxp. * Add rubinius dependencies to Gemfile. * Require json gem for rbx. * Move .gemspec to sparql-client.gemspec and update Gemfile. * Move .gemspec to sparql-client.gemspec and update Gemfile. * distinct should work with the "*" select form `&&` and `and` are not identical `a = true and false` results in `a` = `true` `a = true && false` results in `a` = `false` as intended in order to achieve the same results with `and` you must indicate the precedence, e.g. `a = (true and false)` message for your changes. Lines starting * Adding support for property paths. See spec for DSL syntax and examples. * Add more specs for query builder. * Update Travis Ruby versions. * Finish WritableRepository * Integrated @curoverse on a Repository using SPARQL::Client. * Use Dydra repository for testing. * Some tests involving matching doubles don't pass. This closes issue ruby-rdf#45 * Version 1.1.2. * Added :endpoint option for #update method to specify an alternative update endpoint * Be more descriminating on Accept headers sent based on different queries. Queries build using the DSL use either RDF content types, or SPARQL Results content types, not both. Those using RDF content types: * CONSTRUCT, DESCRIBE, DELETE DATA, LOAD, CREATE Those using SPARQL Results content types: * ASK, SELECT, INSERT DATA, CLEAR, DROP Hopefully, this makes issues such as come up in ruby-rdf#51 less likely to happen. * Ensured that SPARQL 1.1 JSON typed literals are parsed correctly. The parsing code now supports both SPARQL 1.0 and 1.1 JSON results: {"type": "literal", "value": "S", "datatype": "D"} # SPARQL 1.1 JSON {"type": "typed-literal", "value": "S", "datatype": "D"} # SPARQL 1.0 JSON See: http://www.w3.org/TR/sparql11-results-json/#select-encode-terms See: http://www.w3.org/TR/rdf-sparql-json-res/#variable-binding-results * Update code setting appropriate Accept header, and also add */*;q=0.1 to every request as a fallback. * Only use DELETE DATA for #delete_statements if the statement is both constant, and contains no BNodes, otherwise, it falls back to DELETE/INSERT. * Check error response outputs query. When doing updates, change BNodes to Variables. * Add around block with response delegation to capture query and report on queries run in this example if the example fails. (Not perfect, but still useful). * Remove debug point. * Version 1.1.3. * Follow redirects when querying sparql Some SPARQL servers redirect requests. This allows the library to follow redirects, and raise an error in case of a large number of redirects. * Update dependency on net-http-persistent to ~> 2.9. Disable Repository tests, as Dydra is really just too slow for remote testing, and WebMock continues to be enabled, causing errors. This relates to issue ruby-rdf#18. * disable webmock for rdf-spec repo tests and reenable repo tests * Version 1.1.3.1. * Update build matrix to run both with and without nokogiri. * Gemfile-pure, not Gemfile.pure * Update README.md Change account for Christoph Badura from @b4d to @bad * Option for separate update_endpoint for Client::Repositories * Add a mechanism to override the HTTP verb Marmotta 3.3.0 requires GET for DELETE requests, but can accept POST for INSERT This enables rdf-marmotta to override less of #request. See jcoyne/rdf-marmotta@9b1cf62 * Change Client#method to Client#request_method, as #method replaces Object#method, which is over-broad and broke the repository specs. This fixes ruby-rdf#57. * Version 1.1.4. * When using the SPARQL gem as an update endpoint, use the `:update` option to invoke the proper parser path and catch malformed queries. * Updates to allow a native RDF::Repository instance to be used for SPARQL::Client::Repository URL, which will use the SPARQL gem for doing updates. * Version 1.1.5. * Added support for specifying the sort order in SPARQL::Client::Query.order(*variables). * Update documentation. Add support for `#asc` and `#desc` modifiers. * Version 1.1.6. * Add link to coveralls coverage report. * Improve code coverage. * Use mri 2.2.1, instead of 2.2; this defaults to 2.2.0p0, because of old version of rvm on Travis-CI. * When calling @http.request, use ::URI, not ::RDF::URI. Fixes ruby-rdf#29. * Add that Repository does not support graph_name in addition to context for RDF.rb 2.0. * Don't insert incomplete statement in `Repository::insert_statement(s)`. * Minor updates for RDF.rb 2.0. * Handle `Enumerable` values on `Repository#delete` A test for `RDF::Enumerable` inputs was added by ruby-rdf/rdf-spec#39. This adds conformance, and allows `SPARQL::Client::Repository` to use the new `Mutable#delete_insert` interface. It does not yet implement an effecient SPARQL `#delete_insert`. It may be possible to refactor `#delete_statements` in response to these changes, to remove the code smells called out in the comment in that method. * Update Ruby versions. * Updates for keyword arguments. * Update required ruby version >= 2.0. * Change gemspec dependencies to '>= 1.99', '< 3' in prep for 2.0.0.beta release. * Change calling sequence to Repository to use `uri` named parameter instead of fixed `endpoint` parameter. @no-reply, you might look at the Repository failures, as they related to Transaction changes. * Change pattern of uri named parameter for backwards compatibility with earlier versions of Ruby 2.x * Set version to 2.0.0.beta1 and change gemspec dependencies to '>= 2.0.0.beta', '< 3' until 2.0.0 is released. * Don't run coverage unless the gem is loaded. * Update gemspec. Remove README symlink. * Allow configuration of keep-alive * Add CONTRIBUTING.md. * Fix CONTRIBUTING typos. * Updates for release 2.0.0. * Update Gemfile dependencies. * content_type is always passed to RDF::Reader.for * raise error when no suitable rdf reader is found Currently sparql-client will silently fail with a nil if no suitable rdf reader is found. This can lead to the awkward situation where a nil is returned for the query and the user has to find out what is causing it. This commit tries to quicken this debugging proces by at least indicating the point of failure by raising a descriptive error. * set appropriate content types in mocks because an error is now raised when no rdf reader is found, the content type in the mocked responses needs to be correct * call original when rdf reader is mocked * require rdf/turtle to have a reader for turtle * Fixed quality values in generated Accept headers (closes ruby-rdf#69). * Added pre/post HTTP request hooks for monitoring/debugging. * Bumped the version to 2.0.1. * Update client_spec mock request expectations to expaect "q=.." instead of "p=..". * Update minimum ruby version, and change sxp repo location in Gemfiles. * Remove wirble from Gemfile, as dependency-ci objects that it has no license and it's not really neccessary. * Change Travis JRuby to default and allow failures. * Handle empty response body on update queries Update responses are implementation defined; some servers return an empty body and no content type. This handles that case. * Implements tests for update alternative endpoint * Fixed problems with the alternative endpoint The alternative endpoint is set optionally in the update method if an endpoint is provided in the options. If the next call doesn't provide an alternative endpoint, it should use the instance's configured endpoint. Also: a call to the query method may use the make_post_request method. We should make sure to not keep any previous alternative endpoint. Note: this commit not only fix the current issues with the alternative endpoints, it also implements a new functionality: the possibility to override the configured endpoint when calling the query method. * Improvement: don't parse update response The result of an update is not accessible to the caller. Therefore, there is no point of parsing it and it's a risk that the whole call fails if an error occurs during the parsing. Fixes ruby-rdf#71 * Skip depencency checking on rdf-isomorphic. * Version 2.1.0. * Remove require of 'sparql/client' from Rakefile. * Add block forms for `#where` and `#optional`, this allows sub-queries to be run within the block, and filters to be added to the OPTIONAL block. Fixes ruby-rdf#75. * Add support for UNION, either with triple patterns, subquery, or block form. Fixes ruby-rdf#32. * Add support for MINUS, pretty much equivalent to UNION support. Fixes ruby-rdf#65. * Add documentation for select `:count` option. Not quite what was requested in ruby-rdf#27, but probably good enough. * Add `Repository#each_statement` using a copy from `Enumerable`. This is because the `Dataset#each_statement` uses an internal instance variable which is not set generically. (We may want to think about this, as `Repository` subclasses `Dataset`, and we either need to give guidance to developers on what methods need to be implemented, or fallback to the correct behavior if `@statements` doesn't exist. `SPARQL::Client::Repository#initialize` calls super (`RDF::Repository#initialize`), which doesn't call `RDF::Dataset#initialize`, thus the `@statements` instance variable is never set. * Add supports `literal_equality` so that spec count passes. * Add support for net-http-persistent 3.x * Update webmock to ~> 2.3. Use `Solution#to_h` instead of `#to_hash`. * Use Travis "trusty" build and wildcard Ruby versions. * Fix broken Markdown headings * Remove rubyforge reference. * Fix comment Looks like the comment from the previous block was copy-and-pasted. * Fix example code [insert | delete]_data happen in the context of the sparql client. * Relax dependencies for 3.0 release. * Fix Gemfile. * Version 2.2.0. * Version 2.2.1. * Update yard ~> 0.9.12 due to vulnerability. * Allow VALUES to be specified using `Query#values`. * Update dependencies. * Version 3.0.0 * Improved error message * Remove gemspec deprecations. * use ruby syntax highlighting for readme add links to rubydocs add prefix example * remove prefix example, add as separate pr * add support for RDF::URI prefixes favor class Module::Class over module Module; class Class * match code style in spec ignore rbenv ruby-version file * support prefix hashes update tests leave docs alone since hash format is now supported * added a default graph option * support multiple default graphs * Added Tests for the default-graph feature * Version 3.0.1. * Update travis config to deal with rubygems not supporting ruby < 2.3 any longer. See rubygems/rubygems#2534. * Add 2.6 to travis RVM matrix. * Update Gemfile. * Add default for User-Agent HTTP header, and fix code that sets default headers when creating the client. Fixes ruby-rdf#94. * Add `Client#close` to shutdown any HTTP connection and object finalizer to do the same. Fixes ruby-rdf#86. * Run 2.2.2 on Travis. * Remove jruby-openssl from Gemfiles. * Updates for 3.1 release and Ruby 2.7 calling sequences. * Update URLs to use HTTPS, where possible. * Update doap:license to https://unlicense.org/. * Update doap:license. * Use `each_statement.count` instead of `each_statement {count+=1}`. as Enumerable#count will handle this case. * Use `optimize: true` for queries to the sparql gem. * Update PDD info in the README. * Update gem dependencies. * CI on GitHub. * Fix README badges. * Fix bug in values when value is not a literal. Fixes ruby-rdf#96 * Explicitlly require 'delegate' and add example for ruby-rdf#92. * Version 3.1.1. * Update net-http-dependency to >= 4.0.1 and enable CI on Ruby 3.0. * Change finalizer for closing HTTP connections to a class method. See https://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/ * Version 3.1.2. * Add .coveralls.yml. * Change Nokogiri dependency in Gemfile to ~> 1.10, as 1.11 no requires Ruby ~> 2.5. * Add triple forms parsing to XML and JSON results for RDF-star. * Fixes for REXML used in Gemfile-pure. * Update CI for coveralls. * Update CI. * Update documentation, dependencies, and version sync for 3.2. * CI on Ruby 3.1. * Force CI on Ruby "3.0". * Run client finalizer in a Thread (if possible) for emergent Ruby 3.1 issue with net-http-persistent. * * Force running REXML in addition to Nokogiri by adding `library` keyword argument to `parse_xml_bindings`. * Put documents on GH-pages. * Improve TSV parsing and CSV tests. * Set variable_names in solutions, which might not be the same as the actual variables used in the solutions. * Since cc9812c the interface to specify options has changed * Add test for correct hand over of the graph parameter * remove focus tag * Add WebMock around test for default query specifying default graph. * Version 3.2.1. * Tolerate an empty binding in XML. * CI on 3.2. * Update badges * Adds support for Federated Service with SERVICE keyword. Fixes ruby-rdf#99. * Update dependencies. * Version 3.2.2. * make it work with ruby <= 3.0 * add pry gem to use binding.pry * use INSERT { GRAPH ...} instead of INSERT GRAPH {...} to work for virtuoso * put again NCBO custom code * handle the insert data bug of Virtuoso * put again the fix of the string datatype for 4store and Virtuoso --------- Co-authored-by: Gregg Kellogg <gregg@kellogg-assoc.com> Co-authored-by: Tom Nixon <tom@tomn.co.uk> Co-authored-by: Christophe Desclaux <descl@zouig.org> Co-authored-by: Danny Tran <dannybtran@gmail.com> Co-authored-by: Gregg Kellogg <gregg@greggkellogg.net> Co-authored-by: Ben Peters <ben@bencpeters.com> Co-authored-by: Arto Bendiken <arto@bendiken.net> Co-authored-by: Tom Johnson <thomas.johnson@oregonstate.edu> Co-authored-by: Nick Gottlieb <ngottlieb@gmail.com> Co-authored-by: Marcel Otto <marcelotto@gmx.de> Co-authored-by: Justin Coyne <justin@curationexperts.com> Co-authored-by: Christoph Kindl <mail@ckristo.net> Co-authored-by: Tom Johnson <tom@dp.la> Co-authored-by: nielsv <niels.vandekeybus@tenforce.com> Co-authored-by: Cecile Tonglet <cecile.tonglet@gmail.com> Co-authored-by: Chris Beer <chris@cbeer.info> Co-authored-by: Santiago Castro <santi.1410@hotmail.com> Co-authored-by: David Rupp <david@ruppworks.com> Co-authored-by: Richard Degenne <richdeg2@gmail.com> Co-authored-by: conors_nli <conor.sheehan.2@ucdconnect.ie> Co-authored-by: Nime <sebastianz541@googlemail.com> Co-authored-by: Natanael Arndt <arndtn@gmail.com>
I am pretty sure this is just a very simple mistake on my side but I am not able to find any clues on google or elsewhere.
If I use sparql_client inside a rails 3.07 app to query against a local 4store or virtuoso sparql-endpoint the query results in an
EOFError
end of file reached exception.
Against the dbpedia endpoint the same query works perfectly.
I am pretty sure I have set up my local sparql-endpoints as they should be - and using a simple http request as below returns a valid result.
Any Idea what this may be causing?
The text was updated successfully, but these errors were encountered: