Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[bioontology-support] Update vs save an object in bioportal_web_ui

Vincent Emonet vincent.emonet at lirmm.fr
Thu Mar 30 03:32:23 PDT 2017


Hi,


I met an interesting problem with the data model.


In our version of bioportal_web_ui we were updating the ontology object 
using the .update method (which is the proper way to update an already 
existing object according to the documentation of 
ontologies_api_ruby_client)

But updating the object this way for ontologies that have Views was 
causing trouble on the ontologies_api side : "attribute views is not 
loaded". So I tried to load the view attribute, and in this case I met 
"`views` is an inverse attribute. Values cannot be assigned."

I appears that the web_ui was sending the following parameters to 
update: {"views"=>["http://data.bioontology.org/ontologies/THE_VIEW"], 
"splat"=>[], "captures"=>["MY_ONT"], "acronym"=>"MY_ONT"}

So the data model was trying to update the views attr even if it is an 
inverse attribute (so it knows that it can't be updated from this object)


In the end, the good way to update the ontology object was to use the 
.save method (which is the way to save an object that don't already 
exist according to the documentation)

We can see it here: 
https://github.com/ncbo/bioportal_web_ui/blob/master/app/controllers/submissions_controller.rb#L53

Update is used for submission and save for ontology, even if the 2 
object already exist. It is pretty confusing


Another little note on the data model: why is the model crashing on the 
"attribute not loaded" problem? If the view attribute is asked but not 
loaded, then it could be automatically loaded. It would increase 
performance, and be way more comfortable for developpers: instead of 
having to use various methods to try to get all the attribute loaded 
(sometimes include, sometimes bring, sometimes goo_attrs_to_load, 
sometimes goo_aggregates_to_load) it would load dynamically. But I guess 
that now it would be a big change to do to the data model.


Vincent



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/bioontology-support/attachments/20170330/10f62a51/attachment.html>


More information about the bioontology-support mailing list