Module: Sinatra::SPARQL

Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/sparql-36baa432eb7f/lib/sinatra/sparql.rb

Overview

The Sinatra::SPARQL module adds Rack::SPARQL middleware support for responding to SPARQL requests. It is the responsibility of the application to manage the SPARQL endpoint and perform the query. The query results are then sent as the response body. Rack::SPARQL middleware uses content negotiation to format the results appropriately.

To override negotiation on Content-Type, set :format in sparql_options to a RDF Format class, or symbol identifying a format.

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Class Method Details

.registered(app)

This method returns an undefined value.

  • Registers Rack::SPARQL::ContentNegotiation
  • adds helpers
  • includes SPARQL, RDF and LinkedData
  • defines sparql_options, which are passed to the Rack middleware available as settings.sparql_options and as options within the Rack::SPARQL middleware.

Parameters:

  • app (Sinatra::Base)


144
145
146
147
148
149
150
151
152
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-36baa432eb7f/lib/sinatra/sparql.rb', line 144

def self.registered(app)
  options = {}
  app.set :sparql_options, options
  app.use(Rack::SPARQL::ContentNegotiation, options)
  app.helpers(Sinatra::SPARQL::Helpers)
  app.send(:include, ::SPARQL)
  app.send(:include, ::RDF)
  app.send(:include, ::LinkedData) if defined?(::LinkedData)
end