You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error:
>> client = SPARQL::Client.new('http://data.linkedmdb.org/sparql')
>> result = client.query('DESCRIBE ?kb WHERE { ?kb http://data.linkedmdb.org/resource/movie/actor_name "Kevin Bacon" . }')
>> result.map {|e| e.to_hash }
RDF::ReaderError: expected subject in #StringIO:0x19b37f4 line 2
from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/reader.rb:177:in fail_subject' from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/ntriples/reader.rb:176:inread_triple'
from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/ntriples/reader.rb:170:in loop' from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/ntriples/reader.rb:170:inread_triple'
from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/reader.rb:165:in `read_statement'
I printed debug statements and found the error was occurring on the first line of the result on @prefix. Here's the results returned by the above query. Since @prefix is n3 notation, it seems @client.query is detecting the wrong format in @client.parse_rdf_serialization. I have rdf-n3 installed but it doesn't seem to be picking it up. This may be the website's fault for returning the wrong content type. If that's the case, perhaps @client.query should take an option to explicitly set the reader in @client.parse_rdf_serialization.
Thoughts?
The text was updated successfully, but these errors were encountered:
The problem seems to be that the SPARQL server in question is specifying an incorrect content type for the results returned. That is, it is returning RDF data in Turtle format but with a content type of "text/plain" (which indicates N-Triples) instead of the correct "text/turtle".
So, yes, it does indeed seem that we will need to add a way to manually specify the parser to be used for dealing with broken servers like this one.
Note, btw, that you can use either of the rdf-raptor or the rdf-n3 gems to parse Turtle data.
I get the following error:
>> client = SPARQL::Client.new('http://data.linkedmdb.org/sparql')
>> result = client.query('DESCRIBE ?kb WHERE { ?kb http://data.linkedmdb.org/resource/movie/actor_name "Kevin Bacon" . }')
>> result.map {|e| e.to_hash }
RDF::ReaderError: expected subject in #StringIO:0x19b37f4 line 2
from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/reader.rb:177:in
fail_subject' from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/ntriples/reader.rb:176:in
read_triple'from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/ntriples/reader.rb:170:in
loop' from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/ntriples/reader.rb:170:in
read_triple'from /Library/Ruby/Gems/1.8/gems/rdf-0.1.10/lib/rdf/reader.rb:165:in `read_statement'
I printed debug statements and found the error was occurring on the first line of the result on
@prefix
. Here's the results returned by the above query. Since@prefix
is n3 notation, it seems@client.query
is detecting the wrong format in@client.parse_rdf_serialization
. I have rdf-n3 installed but it doesn't seem to be picking it up. This may be the website's fault for returning the wrong content type. If that's the case, perhaps@client.query
should take an option to explicitly set the reader in@client.parse_rdf_serialization
.Thoughts?
The text was updated successfully, but these errors were encountered: