diff --git a/Gemfile b/Gemfile index c836033a..927a1291 100644 --- a/Gemfile +++ b/Gemfile @@ -47,8 +47,8 @@ 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: 'develop' -gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'develop' +gem 'goo', github: 'ncbo/goo', branch: 'multilingual_preflabels' +gem 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'multilingual_preflabels' group :development do diff --git a/Gemfile.lock b/Gemfile.lock index c12a226d..68121ef3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/ncbo/goo.git - revision: 74a012eebb9433d031eb00df5abbe488cb8b4512 - branch: develop + revision: d6b84e12d61317dbddc1b86cb1451acb37915369 + branch: multilingual_preflabels specs: goo (0.0.2) addressable (~> 2.8) @@ -56,8 +56,8 @@ GIT GIT remote: https://github.com/ncbo/ontologies_linked_data.git - revision: 812dd78f02b77c9c6d579b0febf1c2a42d513022 - branch: develop + revision: dec2e789e808e5edea18ca015ee487ddbe02f288 + branch: multilingual_preflabels specs: ontologies_linked_data (0.0.1) activesupport @@ -176,7 +176,7 @@ GEM google-cloud-core (1.7.1) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (2.2.0) + google-cloud-env (2.2.1) faraday (>= 1.0, < 3.a) google-cloud-errors (1.4.0) google-protobuf (3.25.5-aarch64-linux) @@ -189,23 +189,23 @@ GEM grpc (~> 1.41) googleapis-common-protos-types (1.16.0) google-protobuf (>= 3.18, < 5.a) - googleauth (1.11.0) + googleauth (1.11.1) faraday (>= 1.0, < 3.a) google-cloud-env (~> 2.1) jwt (>= 1.4, < 3.0) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - grpc (1.66.0-aarch64-linux) + grpc (1.67.0-aarch64-linux) google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) - grpc (1.66.0-arm64-darwin) + grpc (1.67.0-arm64-darwin) google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) - grpc (1.66.0-x86_64-darwin) + grpc (1.67.0-x86_64-darwin) google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) - grpc (1.66.0-x86_64-linux) + grpc (1.67.0-x86_64-linux) google-protobuf (>= 3.25, < 5.0) googleapis-common-protos-types (~> 1.0) haml (5.2.2) @@ -221,7 +221,7 @@ GEM json-schema (2.8.1) addressable (>= 2.4) json_pure (2.7.2) - jwt (2.9.1) + jwt (2.9.3) base64 kgio (2.11.4) language_server-protocol (3.17.0.3) @@ -250,7 +250,7 @@ GEM net-http (0.4.1) uri net-http-persistent (2.9.4) - net-imap (0.4.16) + net-imap (0.4.17) date net-protocol net-pop (0.1.2) @@ -328,7 +328,7 @@ GEM rsolr (2.6.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) - rubocop (1.66.1) + rubocop (1.67.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -372,7 +372,7 @@ GEM rack-test sinatra (~> 1.4.0) tilt (>= 1.3, < 3) - sshkit (1.23.1) + sshkit (1.23.2) base64 net-scp (>= 1.1.2) net-sftp (>= 2.1.2) diff --git a/test/controllers/test_classes_controller.rb b/test/controllers/test_classes_controller.rb index ab8ff63e..69ae98a0 100644 --- a/test/controllers/test_classes_controller.rb +++ b/test/controllers/test_classes_controller.rb @@ -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 @@ -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"] @@ -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" @@ -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" @@ -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" ] @@ -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 @@ -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 @@ -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', @@ -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" ] @@ -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'] =[ @@ -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" ] @@ -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"] @@ -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