routes.rb revision 41a28e74548dbac9c1ee8f936906904fb91dda0c
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainenrequire Rails.root.join('lib', 'router_constraints.rb')
bdd36cfdba3ff66d25570a9ff568d69e1eb543cfTimo SirainenSpecroutes.define(Ontohub::Application.routes) do
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen # IRI Routing #
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen ###############
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen # as per Loc/Id definition
d8702d15ee7721ed1fcfc8f00a589970bd6b3598Timo Sirainen # Special (/ref-based) Loc/Id routes
d8702d15ee7721ed1fcfc8f00a589970bd6b3598Timo Sirainen specified_get '/ref/:reference/:repository_id/*locid' => 'api/v1/ontology_versions#show',
2087543679f0b35a8f70e1277b234e66ffdf96edTimo Sirainen RefLocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
ff2f20bbc039ad8e362ead199366e21bc41f18edAki Tuomi # reroute_on_mime 'application/json', to: 'api/v1/ontology_versions#show'
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen doc title: 'Ontology IRI (loc/id) with version reference',
7c849dbc7be089175c1a83a84ee7249ed695810dTimo SirainenWill return a representation of the ontology at a
7c849dbc7be089175c1a83a84ee7249ed695810dTimo Sirainenontology version referenced by the {reference}.
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen specified_get '/ref/:reference/:repository_id/*locid' => 'ontologies#show',
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen as: :ontology_iri_versioned,
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen constraints: [
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen RefLocIdRouterConstraint.new(Ontology, ontology: :id),
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen accept 'text/html'
8eea67470c1bd8562a62e7445d930bb2079b1a43Timo Sirainen doc title: 'Ontology IRI (loc/id) with version reference',
8eea67470c1bd8562a62e7445d930bb2079b1a43Timo Sirainen body: <<-BODY
8eea67470c1bd8562a62e7445d930bb2079b1a43Timo SirainenWill return a representation of the ontology at a
8eea67470c1bd8562a62e7445d930bb2079b1a43Timo Sirainenontology version referenced by the {reference}.
87cc5e9025e7fb6408f0de64c48d2d2897773ba5Timo Sirainen # MMT-Support
f016dec9837e6a41867708e4b89ca5308dedab05Timo Sirainen specified_get '/ref/mmt/:repository_id/*path' => 'ontologies#show',
939451389b8e0ad529277b84fe51dab38a8cf77cTimo Sirainen as: :ontology_iri_mmt,
fe791e96fdf796f7d8997ee0515b163dc5eddd72Aki Tuomi constraints: [
a8dac1be6a0c3adbbce5887ca395f418194c6c06Aki Tuomi MMTRouterConstraint.new(Ontology, ontology: :id),
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen accept 'text/html'
64e244defe74f513ce94f33d000a048ddbe2ea23Timo Sirainen reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
325d17cdbb7a338f7c413788f5e8e42d2e80a7f8Timo Sirainen reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
64e244defe74f513ce94f33d000a048ddbe2ea23Timo Sirainen doc title: 'MMT reference to an ontology',
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen body: <<-BODY
64e244defe74f513ce94f33d000a048ddbe2ea23Timo SirainenWill return a representation of the ontology. The ontology
64e244defe74f513ce94f33d000a048ddbe2ea23Timo Sirainenis determined according to the *path and to the MMT-query-string.
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen specified_get '/ref/mmt/:repository_id/*path' => 'mappings#show',
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen as: :mapping_iri_mmt,
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen constraints: [
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen MMTRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen accept 'text/html'
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen doc title: 'MMT reference to a mapping',
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen body: <<-BODY
18ddd4fba186b1b407cae98bb388fa8add7db48dTimo SirainenWill return a representation of the mapping. The mapping
90ed03ab289947f5576d2c616ada27724f50e9cdTimo Sirainenis determined according to the *path and to the MMT-query-string.
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen specified_get '/ref/mmt/:repository_id/*path' => 'symbols#index',
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen as: :symbol_iri_mmt,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen constraints: [
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen MMTRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id),
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen accept 'text/html'
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen doc title: 'MMT reference to a symbol',
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen body: <<-BODY
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo SirainenWill return a representation of the symbol. The symbol
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainenis determined according to the *path and to the MMT-query-string.
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo SirainenCurrently the representation ist a list of all symbols in the ontology.
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen specified_get '/ref/mmt/:repository_id/*path' => 'axioms#index',
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen as: :axiom_iri_mmt,
64e244defe74f513ce94f33d000a048ddbe2ea23Timo Sirainen constraints: [
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen MMTRouterConstraint.new(Axiom, ontology: :ontology_id),
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen accept 'text/html'
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen doc title: 'MMT reference to a axiom',
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen body: <<-BODY
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo SirainenWill return a representation of the axiom. The axiom
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenis determined according to the *path and to the MMT-query-string.
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo SirainenCurrently the representation is a list of all axioms in the ontology.
66c3f635f2f33905af527d49b27f95322aa7dfa7Timo Sirainen specified_get '/ref/mmt/:repository_id/*path' => 'theorems#show',
66c3f635f2f33905af527d49b27f95322aa7dfa7Timo Sirainen as: :theorem_iri_mmt,
acf3b7bf3a8891b118a71c45e6c48d17bc90b259Timo Sirainen constraints: [
3b8d05391336c0e4d24c8ddcc962f350409ffbd3Timo Sirainen MMTRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
3b8d05391336c0e4d24c8ddcc962f350409ffbd3Timo Sirainen accept 'text/html'