Skip to content
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

appropriate representation of the requested resource sparql #32

Closed
GilJ opened this issue Apr 29, 2014 · 3 comments
Closed

appropriate representation of the requested resource sparql #32

GilJ opened this issue Apr 29, 2014 · 3 comments

Comments

@GilJ
Copy link

GilJ commented Apr 29, 2014

I created a new rails 3.2.12 project, with the 0.9.3 version of Tripod.
I have an endpoint at: http://ewi.mmlab.be/geo/ which I place in my configuration like this:

  Tripod.configure do |config|
    config.query_endpoint = 'http://ewi.mmlab.be/geo/'
    config.timeout_seconds = 30
    config.logger = Logger.new(STDOUT)
  end

I created the following model to get data from the endpoint:

class Category
  include Tripod::Resource

  rdf_type 'http://ewi.mmlab.be/ns#StatisticCategory'
  field :title, RDF::RDFS.label
end

However, when I try to fetch all categories I get the following error:

An appropriate representation of the requested resource sparql could not be found on this server.

I think the problem is with the request wanting 'application/n-triples', but the endpoint associates 'text/plain' with n-triples. Is there any way for me to configure this?

Full error output:

Loading development environment (Rails 3.2.12)
1.9.3p448 :001 > Category.all.resources
TRIPOD: building select query for criteria...
TRIPOD: with return_graph: true
TRIPOD caching is off!
TRIPOD: About to run query: SELECT DISTINCT ?uri ?graph WHERE { GRAPH ?graph { ?uri a <http://ewi.mmlab.be/ns#StatisticCategory> . ?uri ?p ?o } }
TRIPOD: Streaming fron url: http://ewi.mmlab.be/geo/
TRIPOD: Streaming opts: {:accept=>"application/sparql-results+json", :timeout_seconds=>30, :response_limit_bytes=>5242880}
TRIPOD: received response code: 200 in: 0.390161 secs
TRIPOD: 1761 bytes streamed in: 0.002473 secs
TRIPOD: total request time: 0.392842 secs
TRIPOD caching is off!
TRIPOD: About to run query: DESCRIBE ?uri WHERE { SELECT DISTINCT ?uri ?graph WHERE { GRAPH ?graph { ?uri a <http://ewi.mmlab.be/ns#StatisticCategory> . ?uri ?p ?o } } }
TRIPOD: Streaming fron url: http://ewi.mmlab.be/geo/
TRIPOD: Streaming opts: {:accept=>"application/n-triples", :timeout_seconds=>30, :response_limit_bytes=>5242880}
TRIPOD: received response code: 406 in: 0.212619 secs
Tripod::Errors::BadSparqlRequest: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>406 Not Acceptable</h1>
<p>An appropriate representation of the requested resource sparql could not be found on this server.</p>
Available variant(s):
<ul>
<li><a href="sparql">sparql</a> , type text/turtle, charset UTF-8</li>
</ul>
</body></html>

    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/streaming.rb:35:in `block in get_data'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1323:in `block (2 levels) in transport_request'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:2672:in `reading_body'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1322:in `block in transport_request'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1294:in `request'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:746:in `start'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1285:in `request'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
    from /Users/gilj/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1240:in `request_post'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/streaming.rb:30:in `get_data'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/sparql_client.rb:30:in `block in query'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/sparql_client.rb:41:in `call'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/sparql_client.rb:41:in `query'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/finders.rb:184:in `_raw_describe_select_results'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/finders.rb:164:in `_create_and_hydrate_resources_from_sparql'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/finders.rb:135:in `_resources_from_sparql'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/tripod-0.9.3/lib/tripod/criteria/execution.rb:15:in `resources'
    from (irb):1
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
    from /Users/gilj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'1.9.3p448 :002 > 
@fonji
Copy link

fonji commented Apr 29, 2014

If it can be of any help, my fork uses text/plain instead of n-triples because my endpoint didn't support it either. Please note that I didn't include the latest commits yet.

Here's my issue.

@GilJ
Copy link
Author

GilJ commented Apr 29, 2014

Thanks @fonji !

Sorry for not searching enough!

@GilJ GilJ closed this as completed Apr 29, 2014
@fonji
Copy link

fonji commented Apr 29, 2014

Quick update: I just merged my fork with the current version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants