ncbo / bioportal_web_ui

A Rails application for biological ontologies
http://bioportal.bioontology.org/
Other
21 stars 2 forks source link

Creating mappings between ontology classes fails #282

Open jvendetti opened 10 months ago

jvendetti commented 10 months ago

Steps to reproduce:

  1. Navigate to the Classes tab for any ontology
  2. Select any class in the class tree
  3. Select the Class Mappings tab on the right-hand side
  4. Click the Create mapping button
  5. Fill in the resulting dialog form and click the Create Mapping button

Dialog displays an error message:

Screen Shot 2023-09-11 at 4 16 43 PM

REST logs

Show an HTTP 400 response:

vendetti [11/Sep/2023:22:46:26 +0000] "POST /mappings HTTP/1.1" 400 101 0.3748

Rails console

Shows the following error in a local dev environment:

Started POST "/mappings" for 127.0.0.1 at 2023-09-11 16:02:34 -0700
Processing by MappingsController#create as */*
  Parameters: {"map_from_bioportal_ontology_id"=>"JVTESTONT1", "map_to_bioportal_ontology_id"=>"JVTESTONT3", "map_from_bioportal_full_id"=>"http://www.co-ode.org/ontologies/pizza/pizza.owl#VegetarianPizza", "map_to_bioportal_full_id"=>"http://www.co-ode.org/ontologies/pizza/pizza.owl#VegetarianPizza", "mapping_comment"=>"Testing create new mapping dialog", "mapping_relation"=>"http://www.w3.org/2004/02/skos/core#exactMatch", "mapping_bidirectional"=>"false"}
Completed 500 Internal Server Error in 455582ms (Allocations: 678862)

Exception (["Ontology with ID `https://data.bioontology.org/ontologies/JVTESTONT3` not found"]):

app/controllers/mappings_controller.rb:137:in `create'
syphax-bouazzouni commented 10 months ago

Hi, I think this is an issue in the API, This line https://github.com/ncbo/ontologies_api/blob/master/controllers/mappings_controller.rb#L110

The id does not start with http://, so it calls the function ontology_uri_from_acronym which does not work in this case because the input is not an acronym but a URI id.

I think this PR https://github.com/ncbo/ontologies_api/pull/102 addresses this issue, but it includes a lot of changes not related to this.

Hope it helps, bye

jvendetti commented 10 months ago

Thanks @syphax-bouazzouni for the additional debugging