Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A small (2 line) fix for 3 or 12 (depending on how it is counted) tes…
…ts + removal at least one error. The problem was that when a 'parents' attribute is added, it was verified possibly wrongly. The constraints said that this should be a list of classes. The list constraint passed, but the classes constraint was not covered and failed.
- Loading branch information
0e09816
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stdotjohn ,
I agree with your problem discription "the classes constraint was not covered", but i don't think that disabling it is the fix (and may break the ontologies_linked_data models).
For information also, here the constrain
:class
for an attribute means it will be instanciate as a Class resource (owl:Class , not the ruby class)This behavior is done the else state of the switch
goo/lib/goo/validators/enforce.rb
Lines 98 to 113 in 0e09816
@mdorf can give a second review of this
0e09816
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0e09816
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have time to test it localy, but I think the error would be in this call http://data.bioontology.org/ontologies/CL/classes?display=parents, where the parents would be no more instantiated as Classes but only URIs.
But maybe I'm wrong (and I'm sorry if its the case)
0e09816
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking over the else case more closely, I agree with your diagnosis. I will write a test in ontologies_linked_data (or in goo) to distinguish the solutions. I have also (finally) found a fixx though I am not sure that it is best.
The problem is that there is more that one model named :class and Goo.model_by_name is returning the wrong one in the failing tests. There is no provision in the code for having more than one model with a given name. There are several solutions for this:
to name a few. I decided on the last questionable approach because it was easy to do. It will be committed and pushed soon.
0e09816
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Sorry for my late reponse, I agree totaly on your diagnosis (and observed it locally). Model name
:class
was used for two models in the filetest_model_complex.rb
asTerm
andtest_schemaless.rb
asKlass
.So its more a bug in the tests than the code.
I suggest to (I'm not sure if it is exactly what you proposeed to do, if it's the case great 👍):
Goo.add_model
) raise an Exeception if a Model had already the same name