dbd_onto_engine 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0617a106bd99fb4312907b5ff0575a8cd5c0d9e3
4
- data.tar.gz: 984ae9fd29422a9cdc400051792982a78007d7b7
3
+ metadata.gz: 24a2e9f3bf0cbaa63aed887623762cabff44208d
4
+ data.tar.gz: 6bbffce2afa32dae65d7e9991549661957a11b30
5
5
  SHA512:
6
- metadata.gz: c90fd518c181a6b3b55b25317c244d3342c547cb4256b6533992eaff2f6fac5de4b066581a08abc799c22dc21dc999de2f1909c772a23e27c11f08c4921e4500
7
- data.tar.gz: 5f5e4396a76ebf68e863940ef5a8b581b92a69ea6039f9c0ef41e1ad3435becb6cbae146396ba75490947ea2e02d6017726ae23132a0c2b6fb40c4fa8af8a993
6
+ metadata.gz: dc74cd90bc69ce6262d5328e36556ad3378a702606c543376b49349578462b082fa96180bc098fbf487929ee4e4e4b8d0c94ba5fe470340b2bee9e91678c4822
7
+ data.tar.gz: b6119fd94e257a6f86fdf72bb978f25f21083b6af466123ed188fc5ea3bde8246278a92e5ba92759401e53df4e724a472dedc3bdca35c437d46e200729f965e7
@@ -3,7 +3,28 @@ require_dependency "dbd_onto_engine/application_controller"
3
3
  module DbdOntoEngine
4
4
  class OntologiesController < ApplicationController
5
5
  def index
6
- @ontologies = %w{context meta}
6
+ @ontologies = supported_ontologies
7
+ end
8
+
9
+ def show
10
+ @ontology = params[:id]
11
+ @ontology_predicates = ontology_class(@ontology).new.
12
+ select{ |e| e.predicate == 'meta:defines_predicate'}.
13
+ map(&:object)
14
+ end
15
+
16
+ private
17
+
18
+ def supported_ontologies
19
+ %w{context meta}
20
+ end
21
+
22
+ def ontology_class(ontology_name)
23
+ if supported_ontologies.include? @ontology
24
+ Object.const_get("DbdOnto::#{@ontology.capitalize}")
25
+ else
26
+ raise "Invalid ontology"
27
+ end
7
28
  end
8
29
  end
9
30
  end
@@ -0,0 +1 @@
1
+ %p= ontology_predicate
@@ -0,0 +1 @@
1
+ %h3= ontology_title.capitalize
@@ -1,3 +1,3 @@
1
1
  %h1 Ontologies
2
2
 
3
- =render partial: 'ontology_entry', collection: @ontologies
3
+ =render partial: 'ontology_title', collection: @ontologies
@@ -0,0 +1,5 @@
1
+ %h1 Ontology #{@ontology.capitalize}
2
+
3
+ %h2 Predicates
4
+
5
+ =render partial: 'ontology_predicate', collection: @ontology_predicates
data/config/routes.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  DbdOntoEngine::Engine.routes.draw do
2
- get('/ontologies' => 'ontologies#index')
2
+ get '/ontologies' => 'ontologies#index'
3
+ get '/ontologies/:id' => 'ontologies#show', as: 'ontology'
3
4
  end
@@ -1,3 +1,3 @@
1
1
  module DbdOntoEngine
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "dbd_onto_engine/engine"
2
+ require "dbd_onto"
2
3
 
3
4
  module DbdOntoEngine
4
5
  end