ruby-rdf / sparql-client

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

Follow redirects when querying sparql #52

Closed no-reply closed 9 years ago

no-reply commented 9 years ago

This is maybe a little naive (I haven't done my research about whether/which redirects are okay for SPARQL) but Marmotta's Kiwi endpoint returns 303 redirects for direct queries which chokes this library. This patch fixes that.

If this looks good, in theory, I'll do due diligence and clean it up for a better PR.

no-reply commented 9 years ago

Got it. I'll patch the infinite loop issue and work up test cases, and ping this thread. I may be interested in helping with an RDF::Util::File.open_file refactor at a later date, but can't commit the time to it right now.

In the meanwhile, I wonder if you know of a good workaround for the fact that Marmotta hasn't implemented Direct Post requests. I can fall back on get for queries, but can't see a way to access UPDATE with url encoded params.

Do I just need to be working on a Direct Post implementation in Marmotta?

gkellogg commented 9 years ago

Great! Check out the "http-caching" feature branch of RDF.rb. I'm using the rufus-jig gem (at least temporarily), which can do some session caching, and will adapt to different libraries that could could help performance a lot.

The idea would be that File.open_file could take an option to cache multiple sessions to maintain an effective LRU cache over different sites. There are some changes that could be made, though, and it may be work forking this to create a separate gem:

For sparql-client, it may just be that the multi-library support is the most useful, and caching isn't as interesting, but support for HTTP sessions probably would be useful.

Anyway, if you'd like to contribute here or there, that would be great, as I'm pretty time constrained right now.

Thanks again!

no-reply commented 9 years ago

Updated PR is more complete.