Module: Sinatra::SPARQL

Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/sparql-4e0c4fcf37a2/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)


99
100
101
102
103
104
105
106
107
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/sparql-4e0c4fcf37a2/lib/sinatra/sparql.rb', line 99

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)
end