sparql icon indicating copy to clipboard operation
sparql copied to clipboard

Fix invalid CLI examples in the README

Open artob opened this issue 11 months ago • 1 comments

The CLI examples in the README do not actually currently succeed, by the looks of it because we're trying use the N-Triples parser instead of the Turtle parser:

% gem install sparql
% wget https://raw.githubusercontent.com/ruby-rdf/sparql/refs/heads/develop/etc/doap.ttl
% sparql server doap.ttl
ERROR [line 1] Expected subject (found: "@prefix dc: <http://purl.org/dc/terms/> .")
/opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/util/logger.rb:94:in `log_error': Expected subject (found: "@prefix dc: <http://purl.org/dc/terms/> .") (RDF::ReaderError)
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:548:in `fail_subject'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/ntriples/reader.rb:230:in `block in read_triple'
	from <internal:kernel>:187:in `loop'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/ntriples/reader.rb:224:in `read_triple'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:529:in `read_statement'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:419:in `block in each_statement'
	from <internal:kernel>:187:in `loop'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:418:in `each_statement'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/mixin/writable.rb:129:in `insert_statements'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/mixin/mutable.rb:54:in `block in load'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:320:in `initialize'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:244:in `new'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:244:in `block in open'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/util/file.rb:340:in `open_file'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/reader.rb:221:in `open'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/mixin/mutable.rb:44:in `load'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/repository.rb:124:in `block (2 levels) in load'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/repository.rb:123:in `each'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/repository.rb:123:in `block in load'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/repository.rb:163:in `initialize'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/repository.rb:122:in `new'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/rdf-3.3.2/lib/rdf/repository.rb:122:in `load'
	from /opt/homebrew/lib/ruby/gems/3.3.0/gems/sparql-3.3.1/bin/sparql:150:in `<top (required)>'
	from /opt/homebrew/opt/ruby/bin/sparql:25:in `load'
	from /opt/homebrew/opt/ruby/bin/sparql:25:in `<main>'

artob avatar Jan 04 '25 00:01 artob

Looks like Rack 3.x removed Rack::Server, which the CLI uses. That doesn't seem to address finding the wrong reader, but may be related.

There is spec/readme_spec.rb but has a PENDING mark for this particular test. Code was added to skip the server test in 2015 in 1.99.0, so it's been broken for a while, even before the gem change.

gkellogg avatar Jan 04 '25 02:01 gkellogg