- From: Christoph Badura <bad@bsd.de>
- Date: Wed, 3 Nov 2010 23:47:48 +0100
- To: public-rdf-ruby@w3.org
Ben Lavender asked me to bring this up on the list.
I discovered that sparql-client can't be used out-of-the-box to query
Joseki repositories. This is because Joseki up to 3.4.2 has a bug
that makes it return N3 for text/plain content type and text/plain seems
to be the only content type in the default Accept: headers that is common
to both..
C.f. http://tech.groups.yahoo.com/group/jena-dev/message/45451 for details
of the bug.
My first workaround was to patch sparql-client to generate the Accept:
header dynamically depending on the RDF::Readers that are loaded.
# also accept content types for other known RDF::Formats
--- lib/sparql/client.rb.orig 2010-10-19 14:35:53.000000000 +0000
+++ lib/sparql/client.rb 2010-10-19 14:42:59.000000000 +0000
@@ -28,7 +28,8 @@
# @param [Hash{Symbol => Object}] options
def initialize(url, options = {}, &block)
@url, @options = RDF::URI.new(url.to_s), options
- @headers = {'Accept' => "#{RESULT_JSON}, #{RESULT_XML}, text/plain"}
+ @headers = {'Accept' => [RESULT_JSON, RESULT_XML,
+ RDF::Format.content_types.collect { |k,v| k.to_s }].join(', ')}
if block_given?
case block.arity
I seems to me it should be possible to influence the acceptable content-types
through an option argument to SPARQL::Client::Repository.new. There's some
support in sparql/client.rb for setting the Accept: header from
options[:content_type] but that relies on options being passed down from
the invoking method.
Any ideas?
--chris
Received on Wednesday, 3 November 2010 22:48:19 UTC