Sha256: 119f4be8fc5726abaa7f7f3e620563268cef23e7f02f04a5a056be662c2f7e17

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require_dependency "publish_my_data/application_controller"

module PublishMyData
  class QueriesController < ApplicationController

    include PublishMyData::SparqlProcessing

    before_filter :check_format, :only => [:show]

    # not implemented yet - will list all named queries
    # GET /queries/:id, where id is the slug.
    def show
      @query_text = get_query_sparql(params[:id])
      @sparql_query = build_sparql_query(@query_text)
      @sparql_query_result = process_sparql_query(@sparql_query)
      respond_with(@sparql_query_result) do |format|
        format.html { head :status => 406 }
      end
    end

    # not implemented yet - will list all named queries
    # GET /queries
    def index; end

    private

    def get_query_sparql(slug)
      sparql = queries_hash[slug]
      raise Tripod::Errors::ResourceNotFound.new unless sparql
      sparql
    end

    # for now this is a hard coded hash of all our queries. Override this in the
    # target app

    def queries_hash
      {'query-name' => 'sparql-goes-here'}
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
publish_my_data-0.0.31 app/controllers/publish_my_data/queries_controller.rb
publish_my_data-0.0.30 app/controllers/publish_my_data/queries_controller.rb