ES-DOC / esdoc-questionnaire

ES-DOC Questionnaire (webform generator for creating CIM Documents). POC: @allynt
Other
2 stars 1 forks source link

Registering multiple ontologies changes the structure of existing ontologies #551

Closed allynt closed 7 years ago

allynt commented 7 years ago

Registering multiple ontologies changes the structure of existing ontologies.

I noticed that after registering the ocean realm, some of the properties belonging to the seaice realm were no longer present.

This is a massively massive bug!

allynt commented 7 years ago

This required a change to the underlying db.

It turned out that a property proxy could only belong to a single model proxy. This clearly doesn't work for inherited properties. For example, the "seaice" realm defined in the seaice specialization ought to inherit the "responsible_party" property from the "realm" class defined in the CIM schema. That was happening, but b/c it was a foreign-key relation rather than a many-to-many relation it actually dropped the existing schema relation. I never noticed, though, b/c the realm class defined in the CIM schema is not a document type that the Q edits. However, when registering ocean, it dropped the existing specialization relation (to seaice) and that was noticed.

To change it I had to make QPropertyProxy (and QCategoryProxy) use a many-to-many relationship to QModelProxy, and change the ontology registration code accordingly.

allynt commented 7 years ago

Part of the solution required every CIM element (even schema properties; not just specializaiton properties) to have unique cim_ids. This is to ensure that reregistering doesn't accidentally recreate existing elements.

allynt commented 7 years ago

a708c419157fe6f203de028cc41bd1c73cd19bbb fixed this. I will have to go back and rebuild the QProxy admin interface, though. This will be done in #552.