Sha256: a44886d92b3584ca7145bf61a263f4e718aff4614f97abe8e91709a3cea87ad8

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

require_dependency "dbd_onto_engine/application_controller"

module DbdOntoEngine
  class OntologiesController < ApplicationController

    def index
      @ontologies = supported_ontologies
    end

    def show
      @ontology = params[:id]
      @ontology_predicates = ontology(@ontology).resources
    end

  private

    def supported_ontologies
      %w{context meta schema dbd}
    end

    def ontology(ontology_name)
      ontology_class(ontology_name).new
    end

    def ontology_class(ontology_name)
      if supported_ontologies.include?(ontology_name)
        "DbdOnto::#{ontology_name.capitalize}".constantize
      else
        raise "Invalid ontology"
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dbd_onto_engine-0.0.9 app/controllers/dbd_onto_engine/ontologies_controller.rb
dbd_onto_engine-0.0.8 app/controllers/dbd_onto_engine/ontologies_controller.rb
dbd_onto_engine-0.0.7 app/controllers/dbd_onto_engine/ontologies_controller.rb