Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop to master merge, release v5.33.4 #172

Merged
merged 13 commits into from
Nov 26, 2024
Merged
13 changes: 6 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ gem 'haml', '~> 5.2.2' # pin see https://github.com/ncbo/ontologies_api/pull/107
gem 'redcarpet'

# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'ncbo_annotator', github: 'ncbo/ncbo_annotator', branch: 'master'
gem 'ncbo_cron', github: 'ncbo/ncbo_cron', branch: 'master'
gem 'ncbo_ontology_recommender', github: 'ncbo/ncbo_ontology_recommender', branch: 'master'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master'
gem 'goo', github: 'ncbo/goo', branch: 'master'
gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'master'

gem 'goo', github: 'ncbo/goo', branch: 'develop'
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 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'develop'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'develop'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand Down
30 changes: 15 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 39f67ab7fae7675b6ff417ace0ab923e40ffcbcd
branch: master
revision: 35721855ba808517698d8b94eb38d4553001c4b6
branch: develop
specs:
goo (0.0.2)
addressable (~> 2.8)
Expand All @@ -16,8 +16,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: b6d50ebb79f114bf81a1cd89d0f8b4d4cbcddda2
branch: master
revision: 2abcd54c148d0983570d681506002d9d3782d2eb
branch: develop
specs:
ncbo_annotator (0.0.1)
goo
Expand All @@ -27,8 +27,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_cron.git
revision: 095ee0fab70b0fe0f2486655811cc8347b6a63ff
branch: master
revision: 8fa7a03a5a6ca63ebb3675fb9f7b2f1e1f408e2f
branch: develop
specs:
ncbo_cron (0.0.1)
dante
Expand All @@ -45,8 +45,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_ontology_recommender.git
revision: 9dbd4f179e42c52095129d353a5ac584e9bd47f3
branch: master
revision: 084cfc74a78b1c6334f3b74e228ddbf80d36e30a
branch: develop
specs:
ncbo_ontology_recommender (0.0.1)
goo
Expand All @@ -56,8 +56,8 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: 0ce77f2781ac3353716407c22d8fc16d9bfd2c8f
branch: master
revision: 6389fa2052e06ff8e21c64fd1be0030beca4c828
branch: develop
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand All @@ -76,8 +76,8 @@ GIT

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: e89c26aa96f184dbe9b52d51e04fb3d9ba998dbc
branch: master
revision: 1657f0dd69fd4b522d3549a6848670175f5e98cc
branch: develop
specs:
sparql-client (1.0.1)
json_pure (>= 1.4)
Expand Down Expand Up @@ -235,7 +235,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)
Expand All @@ -260,7 +260,7 @@ GEM
net-protocol
net-ssh (7.3.0)
netrc (0.11.0)
newrelic_rpm (9.15.0)
newrelic_rpm (9.16.0)
oj (3.16.7)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
Expand Down Expand Up @@ -456,4 +456,4 @@ DEPENDENCIES
webrick

BUNDLED WITH
2.5.7
2.5.20
121 changes: 82 additions & 39 deletions test/controllers/test_classes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -295,42 +294,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" ]
Expand Down Expand Up @@ -514,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"
Expand All @@ -526,7 +525,7 @@ def test_class_page_with_metric_count
assert page_response["collection"].length == 0
end

def test_default_multilingual
def test_multilingual
ont = Ontology.find("TEST-ONT-0").include(:acronym).first
sub = ont.latest_submission
sub.bring_remaining
Expand Down Expand Up @@ -561,10 +560,54 @@ def test_default_multilingual
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
# show french value as specified in submission naturalLanguage
assert_equal 'Biospecimen Management', page_response["prefLabel"]
assert_equal 'Gestion des échantillons biologiques', page_response["prefLabel"]

sub.naturalLanguage = []
sub.save

# prefLabel NOT present, rdfs:label is defined in multiple languages, default portal language
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Catalog')}?lang=all"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
assert_equal 'Catalog', page_response["prefLabel"]["en"]
assert_equal 'Catalogo', page_response["prefLabel"]["it"]
assert_equal 'Catalogue', page_response["prefLabel"]["fr"]
assert_equal 'Catálogo', page_response["prefLabel"]["es"]
assert_equal 'カタログ', page_response["prefLabel"]["ja"]

# prefLabel NOT present, rdfs:label is defined in multiple languages,
# portal language is set to one of the defined languages
sub.naturalLanguage = ['ja']
sub.save
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Catalog')}"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
# show Japanese value as specified in submission naturalLanguage
assert_equal 'カタログ', page_response["prefLabel"]

sub.naturalLanguage = []
sub.save

# prefLabel NOT present, multiple rdfs:label(s) are defined with no language designation
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Regulatory_Compliance')}"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
assert_equal 'Regulatory Compliance', page_response["prefLabel"]

# prefLabel is defined in a non-language format as well as in French and Italian - default check with no language requested
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Research_Lab_Management')}"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
assert_equal 'Research Lab Management', page_response["prefLabel"]

# prefLabel is defined in a non-language format as well as in French and Italian - all languages are requested
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Research_Lab_Management')}?lang=all"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)

assert_equal 'Research Lab Management', page_response["prefLabel"]["none"]
assert_equal 'Gestion du laboratoire de recherche', page_response["prefLabel"]["fr"]
assert_equal 'Gestione del laboratorio di ricerca', page_response["prefLabel"]["it"]
end

end
34 changes: 18 additions & 16 deletions test/controllers/test_metrics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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
Expand All @@ -49,27 +49,29 @@ 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

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(metrics[k], v)
assert_equal(v, metrics[k])
end
end

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(metrics[k], v)
assert_equal(v, metrics[k])
end
end

Expand Down