Skip to content

Commit

Permalink
Merge pull request #170 from ncbo/develop
Browse files Browse the repository at this point in the history
Develop -> Master merge, Release v5.33.1
  • Loading branch information
alexskr authored Oct 22, 2024
2 parents b5422b1 + 8d3d031 commit ae2d27d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 33 deletions.
13 changes: 6 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ gem 'unicorn-worker-killer'
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 '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 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'develop'


group :development do
Expand Down
26 changes: 13 additions & 13 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: f943ac33e87c55c88131c32d826ed5d39c89302c
branch: master
revision: a27d6ca79d47eb045b1bdfe311531827428aa504
branch: multilingual_preflabels
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: d46d667ec1b2343fbcdab587f1a70e763b894133
branch: master
revision: b2731c98bfef0958fecb440c8648b7755a670895
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: 25d54ae938e63e9d1a6f4b8eb697e0ec2ff1ef87
branch: master
revision: 4255106846207d79a41716615bc57a379256212b
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: 9ab4be437ed84f5a480e7f0d8799824fcea310ae
branch: master
revision: a65341b714f2734c6ad5fd1999c9e1bf03a17585
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 @@ -456,4 +456,4 @@ DEPENDENCIES
webrick

BUNDLED WITH
2.5.7
2.5.20
39 changes: 26 additions & 13 deletions test/controllers/test_classes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_notation_lookup
assert response["@id"] == "http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Ontology_Development_and_Management"
end


def test_all_class_pages
ont = Ontology.find("TEST-ONT-0").include(:acronym).first

Expand All @@ -99,7 +98,7 @@ def test_all_class_pages
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
page_response["collection"].each do |item|
assert_instance_of String, item["prefLabel"]
assert_instance_of String, item["prefLabel"], item["@id"]
assert_instance_of String, item["@id"]
assert_instance_of Hash, item["@context"]
assert_instance_of Hash, item["links"]
Expand Down Expand Up @@ -131,6 +130,7 @@ def test_single_cls_all
ont = Ontology.find("TEST-ONT-0").include(:acronym).first
clss_ids = [ 'http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_Interaction',
"http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Electron_Microscope" ]

clss_ids.each do |cls_id|
escaped_cls= CGI.escape(cls_id)
call = "/ontologies/#{ont.acronym}/classes/#{escaped_cls}?include=all"
Expand All @@ -149,6 +149,7 @@ def test_single_cls_properties
ont = Ontology.find("TEST-ONT-0").include(:acronym).first
clss_ids = [ 'http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_Interaction',
"http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Electron_Microscope" ]

clss_ids.each do |cls_id|
escaped_cls= CGI.escape(cls_id)
call = "/ontologies/#{ont.acronym}/classes/#{escaped_cls}?include=properties"
Expand All @@ -163,7 +164,6 @@ def test_single_cls_properties

def test_single_cls
ont = Ontology.find("TEST-ONT-0").include(:acronym).first

clss_ids = [ 'http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_Interaction',
"http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Electron_Microscope" ]

Expand Down Expand Up @@ -208,7 +208,7 @@ def test_roots_for_cls
roots = MultiJson.load(last_response.body)
assert_equal 9, roots.length
roots.each do |r|
assert_instance_of String, r["prefLabel"]
assert_instance_of String, r["prefLabel"], r["@id"]
assert_instance_of String, r["@id"]
assert r.include?"hasChildren"
#By definition roots have no parents
Expand All @@ -221,7 +221,6 @@ def test_roots_for_cls
end

def test_classes_for_not_parsed_ontology

ont = Ontology.find("TEST-ONT-0").include(:acronym).first

#first submission was not parsed
Expand All @@ -232,7 +231,6 @@ def test_classes_for_not_parsed_ontology
end

def test_tree

ont = Ontology.find("TEST-ONT-0").include(:acronym).first

clss_ids = [ 'http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_Interaction',
Expand All @@ -251,7 +249,6 @@ def test_tree
end

def test_path_to_root_for_cls

ont = Ontology.find("TEST-ONT-0").include(:acronym).first
clss_ids = [ 'http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_Interaction',
"http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Electron_Microscope" ]
Expand All @@ -264,7 +261,6 @@ def test_path_to_root_for_cls
end

def test_ancestors_for_cls

ont = Ontology.find("TEST-ONT-0").include(:acronym).first
ancestors_data = {}
ancestors_data['http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_Interaction'] =[
Expand Down Expand Up @@ -454,7 +450,6 @@ def test_calls_not_found
end

def test_children_for_cls_round_trip

clss_ids = [ 'http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Molecular_and_Cellular_Data',
"http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Microscope" ]

Expand Down Expand Up @@ -511,7 +506,7 @@ def test_class_page_with_metric_count
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
page_response["collection"].each do |item|
assert_instance_of String, item["prefLabel"]
assert_instance_of String, item["prefLabel"], item["@id"]
assert_instance_of String, item["@id"]
assert_instance_of Hash, item["@context"]
assert_instance_of Hash, item["links"]
Expand All @@ -536,22 +531,40 @@ def test_default_multilingual
sub = ont.latest_submission
sub.bring_remaining

get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Biospecimen_Management')}"
# rdfs:label is NOT present and the prefLabel is NOT defined for the ontology or portal language
sub.naturalLanguage = ['es']
sub.save
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Community_Engagement')}"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
# does not contain a value in english show the generated one
assert_equal 'Community_Engagement', page_response["prefLabel"]

# rdfs:label is present but NOT for either the ontology or portal language
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Biospecimen_Management')}"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
# does not contain a value in english show the generated one
assert_equal 'Biospecimen_Management', page_response["prefLabel"]

# prefLabel NOT present, rdfs:label is present but NOT for either the ontology or portal language
get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Gene_Therapy')}"
assert last_response.ok?
page_response = MultiJson.load(last_response.body)
# does not contain a value in english show the generated one
assert_equal 'Gene_Therapy', page_response["prefLabel"]

# prefLabel is present in the ontology language
sub.naturalLanguage = ['fr']
sub.save

get "/ontologies/#{ont.acronym}/classes/#{CGI.escape('http://bioontology.org/ontologies/Activity.owl#Biospecimen_Management')}"
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"]

sub.naturalLanguage = []
sub.save
end

end

0 comments on commit ae2d27d

Please sign in to comment.