Class: PublishMyData::SparqlController

Inherits:
ApplicationController show all
Includes:
SparqlProcessing
Defined in:
app/controllers/publish_my_data/sparql_controller.rb

Instance Method Summary collapse

Instance Method Details

#endpointObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/publish_my_data/sparql_controller.rb', line 10

def endpoint

  @query_text = params[:query]

  if @query_text.blank?
    unless is_request_html_format? #the html view handles this ok
      render :text => "no query supplied", :status => 400
    end
  else
    build_sparql_query(@query_text)
    @sparql_query_result = process_sparql_query(@sparql_query)
    respond_to do |format|
      format.html { render }
      format.any { render text: @sparql_query_result }
    end
  end

end