From 7640adeab7e3b705af64aa763935bbd419b89488 Mon Sep 17 00:00:00 2001 From: mdorf Date: Wed, 20 Nov 2024 12:18:22 -0800 Subject: [PATCH 1/6] Gemfile.lock --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 927a1291..82a20aa9 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,7 @@ gem 'ncbo_annotator', github: 'ncbo/ncbo_annotator', branch: 'develop' gem 'ncbo_cron', github: 'ncbo/ncbo_cron', branch: 'develop' gem 'ncbo_ontology_recommender', github: 'ncbo/ncbo_ontology_recommender', branch: 'develop' gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'develop' -gem 'goo', github: 'ncbo/goo', branch: 'multilingual_preflabels' +gem 'goo', github: 'ncbo/goo', branch: 'develop' gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'multilingual_preflabels' From 6e2e4f0c275ba361f1ee95ad3851f52a66d42959 Mon Sep 17 00:00:00 2001 From: mdorf Date: Thu, 21 Nov 2024 14:01:54 -0800 Subject: [PATCH 2/6] Gemfile.lock update --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index be642f4a..ebd691ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,7 +56,7 @@ GIT GIT remote: https://github.com/ncbo/ontologies_linked_data.git - revision: 3aadf69fa004886b8e08830003788d09e9d550d5 + revision: cbada0066156727195b350ca365de480e5fdde7a branch: multilingual_preflabels specs: ontologies_linked_data (0.0.1) @@ -234,7 +234,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2024.1105) mini_mime (1.1.5) - minitest (5.25.1) + minitest (5.25.2) minitest-hooks (1.5.2) minitest (> 5.3) minitest-stub_any_instance (1.0.3) From 9f9b8f1d694b6a20e0bcad58a3b1260dc5959f13 Mon Sep 17 00:00:00 2001 From: mdorf Date: Thu, 21 Nov 2024 15:30:00 -0800 Subject: [PATCH 3/6] fixed failing unit tests as a result of modifying the test ontologies --- Gemfile.lock | 2 +- test/controllers/test_classes_controller.rb | 67 +++++++++++---------- test/controllers/test_metrics_controller.rb | 28 ++++----- 3 files changed, 49 insertions(+), 48 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ebd691ab..26e296d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,7 +56,7 @@ GIT GIT remote: https://github.com/ncbo/ontologies_linked_data.git - revision: cbada0066156727195b350ca365de480e5fdde7a + revision: 0598b9f6e8a37a42938f1db8648ff1b3355be519 branch: multilingual_preflabels specs: ontologies_linked_data (0.0.1) diff --git a/test/controllers/test_classes_controller.rb b/test/controllers/test_classes_controller.rb index 9e1f9609..1811062d 100644 --- a/test/controllers/test_classes_controller.rb +++ b/test/controllers/test_classes_controller.rb @@ -295,42 +295,43 @@ def test_descendants_for_cls descendants_data = {} descendants_data['http://bioontology.org/ontologies/ResearchArea.owl#Area_of_Research'] =[ "http://bioontology.org/ontologies/ResearchArea.owl#Behavioral_Science", - "http://bioontology.org/ontologies/ResearchArea.owl#Bioinformatics", - "http://bioontology.org/ontologies/ResearchArea.owl#Biostatistics", - "http://bioontology.org/ontologies/ResearchArea.owl#Clinical_Studies", - "http://bioontology.org/ontologies/ResearchArea.owl#Computational_Biology", - "http://bioontology.org/ontologies/ResearchArea.owl#Epidemiology", - "http://bioontology.org/ontologies/ResearchArea.owl#Genomics", - "http://bioontology.org/ontologies/ResearchArea.owl#Metabolomics", - "http://bioontology.org/ontologies/ResearchArea.owl#Nursing", - "http://bioontology.org/ontologies/ResearchArea.owl#Outcomes_Research", - "http://bioontology.org/ontologies/ResearchArea.owl#Pathology", - "http://bioontology.org/ontologies/ResearchArea.owl#Pediatrics", - "http://bioontology.org/ontologies/ResearchArea.owl#Pharmacokinetics_Pharmacodynamics", - "http://bioontology.org/ontologies/ResearchArea.owl#Physiology", - "http://bioontology.org/ontologies/ResearchArea.owl#Preclinical", - "http://bioontology.org/ontologies/ResearchArea.owl#Proteomics", - "http://bioontology.org/ontologies/ResearchArea.owl#Psychometrics", - "http://bioontology.org/ontologies/ResearchArea.owl#Research_IT", - "http://bioontology.org/ontologies/ResearchArea.owl#Toxicology"] + "http://bioontology.org/ontologies/ResearchArea.owl#Bioinformatics", + "http://bioontology.org/ontologies/ResearchArea.owl#Biostatistics", + "http://bioontology.org/ontologies/ResearchArea.owl#Clinical_Studies", + "http://bioontology.org/ontologies/ResearchArea.owl#Computational_Biology", + "http://bioontology.org/ontologies/ResearchArea.owl#Epidemiology", + "http://bioontology.org/ontologies/ResearchArea.owl#Genomics", + "http://bioontology.org/ontologies/ResearchArea.owl#Metabolomics", + "http://bioontology.org/ontologies/ResearchArea.owl#Nursing", + "http://bioontology.org/ontologies/ResearchArea.owl#Outcomes_Research", + "http://bioontology.org/ontologies/ResearchArea.owl#Pathology", + "http://bioontology.org/ontologies/ResearchArea.owl#Pediatrics", + "http://bioontology.org/ontologies/ResearchArea.owl#Pharmacokinetics_Pharmacodynamics", + "http://bioontology.org/ontologies/ResearchArea.owl#Physiology", + "http://bioontology.org/ontologies/ResearchArea.owl#Preclinical", + "http://bioontology.org/ontologies/ResearchArea.owl#Proteomics", + "http://bioontology.org/ontologies/ResearchArea.owl#Psychometrics", + "http://bioontology.org/ontologies/ResearchArea.owl#Research_IT", + "http://bioontology.org/ontologies/ResearchArea.owl#Toxicology"] descendants_data['http://bioontology.org/ontologies/Activity.owl#Activity'] = ["http://bioontology.org/ontologies/Activity.owl#Biospecimen_Management", - "http://bioontology.org/ontologies/Activity.owl#Community_Engagement", - "http://bioontology.org/ontologies/Activity.owl#Gene_Therapy", - "http://bioontology.org/ontologies/Activity.owl#Health_Services", - "http://bioontology.org/ontologies/Activity.owl#IRB", - "http://bioontology.org/ontologies/Activity.owl#Medical_Device_Development", - "http://bioontology.org/ontologies/Activity.owl#Regulatory_Compliance", - "http://bioontology.org/ontologies/Activity.owl#Research_Funding", - "http://bioontology.org/ontologies/Activity.owl#Research_Lab_Management", - "http://bioontology.org/ontologies/Activity.owl#Resource_Inventory", - "http://bioontology.org/ontologies/Activity.owl#Small_Molecule", - "http://bioontology.org/ontologies/Activity.owl#Social_Networking", - "http://bioontology.org/ontologies/Activity.owl#Software_Development", - "http://bioontology.org/ontologies/Activity.owl#Surgical_Procedure", - "http://bioontology.org/ontologies/Activity.owl#Therapeutics", - "http://bioontology.org/ontologies/Activity.owl#Training"] + "http://bioontology.org/ontologies/Activity.owl#Catalog", + "http://bioontology.org/ontologies/Activity.owl#Community_Engagement", + "http://bioontology.org/ontologies/Activity.owl#Gene_Therapy", + "http://bioontology.org/ontologies/Activity.owl#Health_Services", + "http://bioontology.org/ontologies/Activity.owl#IRB", + "http://bioontology.org/ontologies/Activity.owl#Medical_Device_Development", + "http://bioontology.org/ontologies/Activity.owl#Regulatory_Compliance", + "http://bioontology.org/ontologies/Activity.owl#Research_Funding", + "http://bioontology.org/ontologies/Activity.owl#Research_Lab_Management", + "http://bioontology.org/ontologies/Activity.owl#Resource_Inventory", + "http://bioontology.org/ontologies/Activity.owl#Small_Molecule", + "http://bioontology.org/ontologies/Activity.owl#Social_Networking", + "http://bioontology.org/ontologies/Activity.owl#Software_Development", + "http://bioontology.org/ontologies/Activity.owl#Surgical_Procedure", + "http://bioontology.org/ontologies/Activity.owl#Therapeutics", + "http://bioontology.org/ontologies/Activity.owl#Training"] clss_ids = [ 'http://bioontology.org/ontologies/Activity.owl#Activity', "http://bioontology.org/ontologies/ResearchArea.owl#Area_of_Research" ] diff --git a/test/controllers/test_metrics_controller.rb b/test/controllers/test_metrics_controller.rb index 0d8b547d..eb06c3f8 100644 --- a/test/controllers/test_metrics_controller.rb +++ b/test/controllers/test_metrics_controller.rb @@ -9,15 +9,15 @@ def before_suite end OntologySubmission.all.each {|s| s.delete } Ontology.all.each {|o| o.delete } - @@data = {"classes"=>486, - "averageChildCount"=>5, - "maxChildCount"=>65, - "classesWithOneChild"=>14, - "classesWithMoreThan25Children"=>2, - "classesWithNoDefinition"=>11, - "individuals"=>124, - "properties"=>63, - "maxDepth"=> 7 } + @@data = {"classes" => 487, + "averageChildCount" => 5, + "maxChildCount" => 65, + "classesWithOneChild" => 14, + "classesWithMoreThan25Children" => 2, + "classesWithNoDefinition" => 11, + "individuals" => 124, + "properties" => 63, + "maxDepth" => 7 } @@options = { ont_count: 2, submission_count: 3, submissions_to_process: [1, 2], @@ -35,8 +35,8 @@ def test_all_metrics #TODO: improve this test and test for two different ontologies #though this is tested in LD metrics.each do |m| - @@data.each do |k,v| - assert_equal(m[k], v) + @@data.each do |k, v| + assert_equal(v, m[k]) end assert m["@id"] == m["submission"].first + "/metrics" end @@ -49,7 +49,7 @@ def test_single_metrics metrics = MultiJson.load(last_response.body) @@data.each do |k,v| - assert_equal(metrics[k], v) + assert_equal(v, metrics[k]) end end @@ -59,7 +59,7 @@ def test_metrics_with_submission_id assert last_response.ok? metrics = MultiJson.load(last_response.body) @@data.each do |k,v| - assert_equal(metrics[k], v) + assert_equal(v, metrics[k]) end end @@ -69,7 +69,7 @@ def test_metrics_with_submission_id_as_param assert last_response.ok? metrics = MultiJson.load(last_response.body) @@data.each do |k,v| - assert_equal(metrics[k], v) + assert_equal(v, metrics[k]) end end From 637eed0db6c4f0fea09ef9ca4556fd5e138c0166 Mon Sep 17 00:00:00 2001 From: mdorf Date: Thu, 21 Nov 2024 21:25:39 -0800 Subject: [PATCH 4/6] another fix to the metrics unit tests that were faling --- test/controllers/test_metrics_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/controllers/test_metrics_controller.rb b/test/controllers/test_metrics_controller.rb index eb06c3f8..8031d967 100644 --- a/test/controllers/test_metrics_controller.rb +++ b/test/controllers/test_metrics_controller.rb @@ -55,9 +55,10 @@ def test_single_metrics def test_metrics_with_submission_id ontology = 'TEST-ONT-0' - get "/ontologies/#{ontology}/submissions/1/metrics" + get "/ontologies/#{ontology}/submissions/2/metrics" assert last_response.ok? metrics = MultiJson.load(last_response.body) + @@data.each do |k,v| assert_equal(v, metrics[k]) end @@ -65,9 +66,10 @@ def test_metrics_with_submission_id def test_metrics_with_submission_id_as_param ontology = 'TEST-ONT-0' - get "/ontologies/#{ontology}/metrics?submissionId=1" + get "/ontologies/#{ontology}/metrics?ontology_submission_id=2" assert last_response.ok? metrics = MultiJson.load(last_response.body) + @@data.each do |k,v| assert_equal(v, metrics[k]) end From e0e4ab903ccdee211de1faa37f501ddebc821e5a Mon Sep 17 00:00:00 2001 From: mdorf Date: Thu, 21 Nov 2024 21:25:39 -0800 Subject: [PATCH 5/6] another fix to the metrics unit tests that were failing --- test/controllers/test_metrics_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/controllers/test_metrics_controller.rb b/test/controllers/test_metrics_controller.rb index eb06c3f8..8031d967 100644 --- a/test/controllers/test_metrics_controller.rb +++ b/test/controllers/test_metrics_controller.rb @@ -55,9 +55,10 @@ def test_single_metrics def test_metrics_with_submission_id ontology = 'TEST-ONT-0' - get "/ontologies/#{ontology}/submissions/1/metrics" + get "/ontologies/#{ontology}/submissions/2/metrics" assert last_response.ok? metrics = MultiJson.load(last_response.body) + @@data.each do |k,v| assert_equal(v, metrics[k]) end @@ -65,9 +66,10 @@ def test_metrics_with_submission_id def test_metrics_with_submission_id_as_param ontology = 'TEST-ONT-0' - get "/ontologies/#{ontology}/metrics?submissionId=1" + get "/ontologies/#{ontology}/metrics?ontology_submission_id=2" assert last_response.ok? metrics = MultiJson.load(last_response.body) + @@data.each do |k,v| assert_equal(v, metrics[k]) end From f765dbd98fe0f120f4a958abfd97dfa6de9b2d6e Mon Sep 17 00:00:00 2001 From: mdorf Date: Thu, 21 Nov 2024 22:29:24 -0800 Subject: [PATCH 6/6] some tests still failed due to the changes to the test ontology --- test/controllers/test_classes_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/controllers/test_classes_controller.rb b/test/controllers/test_classes_controller.rb index 1811062d..838385d7 100644 --- a/test/controllers/test_classes_controller.rb +++ b/test/controllers/test_classes_controller.rb @@ -106,8 +106,7 @@ def test_all_class_pages assert last_response.ok? count_terms = count_terms + page_response["collection"].length end while page_response["nextPage"] - #bnodes thing got fixed. changed to 486. - assert_equal 486, count_terms + assert_equal 487, count_terms #one more page should bring no results call = "/ontologies/#{ont.acronym}/classes" @@ -515,8 +514,7 @@ def test_class_page_with_metric_count assert last_response.ok? count_terms = count_terms + page_response["collection"].length end while page_response["nextPage"] - #bnodes thing got fixed. changed to 486. - assert_equal 486, count_terms + assert_equal 487, count_terms #one more page should bring no results call = "/ontologies/#{ont.acronym}/classes"