Search Mailing List Archives
[bioontology-support] Update vs save an object in bioportal_web_ui
vincent.emonet at lirmm.fr
Thu Mar 30 03:32:23 PDT 2017
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
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
"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:
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the bioontology-support