routes.rb revision 273b30f33fe1a753893887c8eb94f8078cc96928
a847d9812b328c048773e705606b10875a929034Eugen Kuksarequire Rails.root.join('lib', 'router_constraints.rb')
a4344d37747b6733bbd0d8df738b614cb385316cTim ReddehaseSpecroutes.define(Ontohub::Application.routes) do
5ec1c6ff5da427d945d7fb708567ce3526c4c741Tim Reddehase # IRI Routing #
5ec1c6ff5da427d945d7fb708567ce3526c4c741Tim Reddehase ###############
98ba1c38b1cce99ecc61117259f2ae05ffe98469Tim Reddehase # as per Loc/Id definition
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase # Special (/ref-based) Loc/Id routes
10be32b36246121321399ec3ab26d4d723d550e3Tim Reddehase specified_get '/ref/:reference/:repository_id/*locid' => 'api/v1/ontology_versions#show',
10be32b36246121321399ec3ab26d4d723d550e3Tim Reddehase RefLocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
10be32b36246121321399ec3ab26d4d723d550e3Tim Reddehase # reroute_on_mime 'application/json', to: 'api/v1/ontology_versions#show'
10be32b36246121321399ec3ab26d4d723d550e3Tim Reddehase doc title: 'Ontology IRI (loc/id) with version reference',
10be32b36246121321399ec3ab26d4d723d550e3Tim ReddehaseWill return a representation of the ontology at a
10be32b36246121321399ec3ab26d4d723d550e3Tim Reddehaseontology version referenced by the {reference}.
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase specified_get '/ref/:reference/:repository_id/*locid' => 'ontologies#show',
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase as: :ontology_iri_versioned,
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase constraints: [
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase RefLocIdRouterConstraint.new(Ontology, ontology: :id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'Ontology IRI (loc/id) with version reference',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the ontology at a
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehaseontology version referenced by the {reference}.
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase # MMT-Support
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase specified_get '/ref/mmt/:repository_id/*path' => 'ontologies#show',
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase as: :ontology_iri_mmt,
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase constraints: [
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase MMTRouterConstraint.new(Ontology, ontology: :id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'MMT reference to an ontology',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the ontology. The ontology
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehaseis determined according to the *path and to the MMT-query-string.
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase specified_get '/ref/mmt/:repository_id/*path' => 'mappings#show',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase as: :mapping_iri_mmt,
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase constraints: [
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase MMTRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'MMT reference to a mapping',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the mapping. The mapping
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehaseis determined according to the *path and to the MMT-query-string.
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase specified_get '/ref/mmt/:repository_id/*path' => 'symbols#index',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase as: :symbol_iri_mmt,
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase constraints: [
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase MMTRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'MMT reference to a symbol',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the symbol. The symbol
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehaseis determined according to the *path and to the MMT-query-string.
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseCurrently the representation ist a list of all symbols in the ontology.
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase specified_get '/ref/mmt/:repository_id/*path' => 'axioms#index',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase as: :axiom_iri_mmt,
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase constraints: [
4949048bda09e116ee3627383e831455954cbe41Tim Reddehase MMTRouterConstraint.new(Axiom, ontology: :ontology_id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'MMT reference to a axiom',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the axiom. The axiom
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehaseis determined according to the *path and to the MMT-query-string.
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseCurrently the representation is a list of all axioms in the ontology.
81a6387a4ab56a24194ecbabd6609c6bcca568b7Tim Reddehase specified_get '/ref/mmt/:repository_id/*path' => 'theorems#index',
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim Reddehase as: :theorem_iri_mmt,
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase constraints: [
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase MMTRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase accept 'text/html'
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim Reddehase doc title: 'MMT reference to a theorem',
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase body: <<-BODY
503ccb65bd740225668eb51be966d60fb4ae29e1Tim ReddehaseWill return a representation of the theorem. The theorem
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim Reddehaseis determined according to the *path and to the MMT-query-string.
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim ReddehaseCurrently the representation is a list of all theorems in the ontology.
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim Reddehase specified_get '/ref/mmt/:repository_id/*path' => 'api/v1/proof_attempt_configurations#show',
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim Reddehase as: :proof_attempt_configuration_iri_mmt,
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase constraints: [
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase MMTRouterConstraint.new(ProofAttemptConfiguration, ontology: :ontology_id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'application/json'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'MMT reference to a proof attempt configuration',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the proof attempt configuration. The proof
7c0f71e3e6e26af2cc91112fdbe3905879bfd893Tim Reddehaseattempt configuration is determined according to the *path and to the
cc3ee169b3cbf177eaf03e9a590ff9e30c338bd2Tim ReddehaseMMT-query-string.
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase # Subsites for ontologies
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase ontology_subsites = %i(
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase comments metadata graphs
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase projects categories tasks
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase ontology_api_subsites = %i(
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase mappings symbols children
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase axioms theorems
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase ontology_versions
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase license_models formality_levels
503ccb65bd740225668eb51be966d60fb4ae29e1Tim Reddehase proof_attempt_configurations
98ba1c38b1cce99ecc61117259f2ae05ffe98469Tim Reddehase ontology_subsites.each do |category|
98ba1c38b1cce99ecc61117259f2ae05ffe98469Tim Reddehase specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
98ba1c38b1cce99ecc61117259f2ae05ffe98469Tim Reddehase as: :"ontology_iri_#{category}",
d51cee8257d50d1f2d7c0818d968b32096f6b795Tim Reddehase constraints: [
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase accept 'text/html'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: "Ontology subsite about #{category.to_s.gsub(/_/, ' ')}",
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill provide a subsite of a specific ontology.
5ec1c6ff5da427d945d7fb708567ce3526c4c741Tim Reddehase ontology_api_subsites.each do |category|
7dadc1a5aa3845c2ce19ad1daa2c63dfd7b59979Tim Reddehase specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
7dadc1a5aa3845c2ce19ad1daa2c63dfd7b59979Tim Reddehase as: :"ontology_iri_#{category}",
7dadc1a5aa3845c2ce19ad1daa2c63dfd7b59979Tim Reddehase constraints: [
7dadc1a5aa3845c2ce19ad1daa2c63dfd7b59979Tim Reddehase LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: "api/v1/#{category}#index"
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: "Ontology subsite about #{category.to_s.gsub(/_/, ' ')}",
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill provide a subsite of a specific ontology.
d51cee8257d50d1f2d7c0818d968b32096f6b795Tim Reddehase specified_get "/:repository_id/*locid///sentences" => "api/v1/sentences#index",
d51cee8257d50d1f2d7c0818d968b32096f6b795Tim Reddehase as: :"ontology_iri_sentences",
d51cee8257d50d1f2d7c0818d968b32096f6b795Tim Reddehase constraints: [
772288cf17d57e84a4799c56949263f7ff098773Tim Reddehase LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'application/json'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: "Ontology subsite about sentences",
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill provide a subsite of a specific ontology.
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase # Loc/Id-Show(-equivalent) routes
d51cee8257d50d1f2d7c0818d968b32096f6b795Tim Reddehase specified_get '/:repository_id/*locid' => 'ontologies#show',
653f8d7c88abc38a2c42f12b80b3e3efd882e039Tim Reddehase as: :ontology_iri,
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase constraints: [
653f8d7c88abc38a2c42f12b80b3e3efd882e039Tim Reddehase LocIdRouterConstraint.new(Ontology, ontology: :id),
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase accept 'text/html'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase doc title: 'loc/id reference to an ontology',
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehase body: <<-BODY
23f0ab4a423943eb59109df37074ef0c330d07c0Tim ReddehaseWill return a representation of the ontology. The ontology
23f0ab4a423943eb59109df37074ef0c330d07c0Tim Reddehaseis determined according to the *locid.
653f8d7c88abc38a2c42f12b80b3e3efd882e039Tim Reddehase specified_get '/:repository_id/*locid' => 'mappings#show',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase as: :mapping_iri,
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase constraints: [
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase LocIdRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase doc title: 'loc/id reference to a mapping',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase body: <<-BODY
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim ReddehaseWill return a representation of the mapping. The mapping
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehaseis determined according to the *locid.
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase specified_get '/:repository_id/*locid' => 'symbols#index',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase as: :symbol_iri,
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase constraints: [
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase LocIdRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id, element: :id),
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase doc title: 'loc/id reference to a symbol',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase body: <<-BODY
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim ReddehaseWill return a representation of the symbol. The symbol
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehaseis determined according to the *locid.
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim ReddehaseCurrently this will return the list of all symbols of the ontology.
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase specified_get '/:repository_id/*locid' => 'axioms#index',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase as: :axiom_iri,
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase constraints: [
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase LocIdRouterConstraint.new(Axiom, ontology: :ontology_id, element: :id),
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase accept 'text/html'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase doc title: 'loc/id reference to an axiom',
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehase body: <<-BODY
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim ReddehaseWill return a representation of the axiom. The axiom
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim Reddehaseis determined according to the *locid.
db8aaeeeb3b24f487a5d02c60d18e96e55f6ba85Tim ReddehaseCurrently this will return the list of all axioms of the ontology.
5ec1c6ff5da427d945d7fb708567ce3526c4c741Tim Reddehase specified_get '/:repository_id/*locid' => 'theorems#index',
5ec1c6ff5da427d945d7fb708567ce3526c4c741Tim Reddehase as: :theorem_iri,
5ec1c6ff5da427d945d7fb708567ce3526c4c741Tim Reddehase constraints: [
9789c65179e43e0e8c91aa11c67e60b02250cba9Sascha Graef LocIdRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
c7dbfa39641dbdf8d00d1fac2ce96d50a97fcb74henning mueller accept 'text/html'
c7dbfa39641dbdf8d00d1fac2ce96d50a97fcb74henning mueller reroute_on_mime 'application/json', to: 'api/v1/theorems#show'
c7dbfa39641dbdf8d00d1fac2ce96d50a97fcb74henning mueller doc title: 'loc/id reference to a theorem',
c7dbfa39641dbdf8d00d1fac2ce96d50a97fcb74henning mueller body: <<-BODY
560baaad7d614c8aa6b7871e3a99ce33a137d93bJulian KornbergerWill return a representation of the theorem. The theorem
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehaseis determined according to the *locid.
634abf6594d5960c4ca0b0701b69a81231b05aceChristian Clausen proof_attempt_configuration_api_subsites =
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase %i(selected_axioms selected_theorems)
634abf6594d5960c4ca0b0701b69a81231b05aceChristian Clausen proof_attempt_configuration_api_subsites.each do |subsite|
a0b65fd7d17589196751bea546f738c3534c4facChristian Clausen specified_get "/:repository_id/*locid///#{subsite}" => "api/v1/proof_attempt_configurations##{subsite}",
634abf6594d5960c4ca0b0701b69a81231b05aceChristian Clausen as: :"proof_attempt_configuration_iri_#{subsite}",
ee5342a8882c2fc7631fcffb5497e6597747887cTim Reddehase constraints: [
7c7f3cf9415077b18027586822f15ac1dafbbaa3Christian Clausen LocIdRouterConstraint.new(ProofAttemptConfiguration, ontology: :ontology_id, element: :id),
7c7f3cf9415077b18027586822f15ac1dafbbaa3Christian Clausen accept 'application/json'
3b82fa8c1f93a0572ec0d480c8f1645c6ea18e0bTim Reddehase doc title: 'loc/id reference to a proof attempt configuration subsite',
b23869f9e7504049f5d28bbbc54d812c8ca36abbEugen Kuksa body: <<-BODY
b23869f9e7504049f5d28bbbc54d812c8ca36abbEugen Kuksa Will return a subsite of the proof attempt configuration. The proof attempt
b23869f9e7504049f5d28bbbc54d812c8ca36abbEugen Kuksa configuration is determined according to the *locid.