From 8afc6d866df5f91895f9c1dde59381742be1f701 Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Fri, 9 Feb 2024 16:07:40 -0800 Subject: [PATCH] Revert "Merge branch 'pr/refactor/use-replace-url-prefix' of https://github.com/ontoportal-lirmm/ontologies_api" This reverts commit 38a3b7ecab0f444a313652824e11b01c8add9c33, reversing changes made to 3e7204306ff2c07ce2d400de17c7a08075367361. --- Gemfile | 12 ++++++------ Gemfile.lock | 24 ++++++++++++------------ helpers/application_helper.rb | 3 ++- helpers/batch_helper.rb | 10 +++++++--- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Gemfile b/Gemfile index e1050f63..ec1f76f3 100644 --- a/Gemfile +++ b/Gemfile @@ -41,12 +41,12 @@ gem 'haml', '~> 5.2.2' # pin see https://github.com/ncbo/ontologies_api/pull/107 gem 'redcarpet' # NCBO -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' +gem 'goo', github: 'ncbo/goo', branch: 'master' +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 'ontologies_linked_data', github: 'ncbo/ontologies_linked_data', branch: 'master' +gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master' 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 diff --git a/Gemfile.lock b/Gemfile.lock index 35b4a373..a772c452 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/ncbo/goo.git - revision: 7a897a8e9c01d3a412d9011df8e26d770d58cd7d - branch: develop + revision: 75436fe8e387febc53e34ee31ff0e6dd837a9d3f + branch: master specs: goo (0.0.2) addressable (~> 2.8) @@ -15,8 +15,8 @@ GIT GIT remote: https://github.com/ncbo/ncbo_annotator.git - revision: f60341e8426adcad447a6fc3adb5b80207c5987a - branch: develop + revision: 63c986880aa88c9384043e6611a682434a14aba7 + branch: master specs: ncbo_annotator (0.0.1) goo @@ -26,8 +26,8 @@ GIT GIT remote: https://github.com/ncbo/ncbo_cron.git - revision: 6185e9f59f35fe131bf53624ef82dd8e399e5448 - branch: develop + revision: 46bd8e7eb7cfde6d173bdf55808a8e28d6700f1e + branch: master specs: ncbo_cron (0.0.1) dante @@ -42,8 +42,8 @@ GIT GIT remote: https://github.com/ncbo/ncbo_ontology_recommender.git - revision: 41e61ddccdde09a45961b0f2bf7ad0ddb18b382e - branch: develop + revision: 013abea4af3b10910ec661dbb358a4b6cae198a4 + branch: master specs: ncbo_ontology_recommender (0.0.1) goo @@ -53,8 +53,8 @@ GIT GIT remote: https://github.com/ncbo/ontologies_linked_data.git - revision: c77d0b390e19c394989e9467e447fcc653b53fa5 - branch: develop + revision: ec3236a71ff172579923245646d0ea058844794e + branch: master specs: ontologies_linked_data (0.0.1) activesupport @@ -73,8 +73,8 @@ GIT GIT remote: https://github.com/ncbo/sparql-client.git - revision: 55e7dbf858eb571c767bc67868f9af61663859cb - branch: develop + revision: d418d56a6c9ff5692f925b45739a2a1c66bca851 + branch: master specs: sparql-client (1.0.1) json_pure (>= 1.4) diff --git a/helpers/application_helper.rb b/helpers/application_helper.rb index bbf3bbb1..b7d26990 100644 --- a/helpers/application_helper.rb +++ b/helpers/application_helper.rb @@ -346,7 +346,8 @@ def uri_as_needed(id) # If the setting is enabled, replace the URL prefix with the proper id prefix # EX: http://stagedata.bioontology.org/ontologies/BRO would become http://data.bioontology.org/ontologies/BRO def replace_url_prefix(id) - LinkedData::Models::Base.replace_url_prefix_to_id(id) + id = id.sub(LinkedData.settings.rest_url_prefix, LinkedData.settings.id_url_prefix) if LinkedData.settings.replace_url_prefix && id.start_with?(LinkedData.settings.rest_url_prefix) + id end def retrieve_latest_submissions(options = {}) diff --git a/helpers/batch_helper.rb b/helpers/batch_helper.rb index 2de90faa..bc4ec0d7 100644 --- a/helpers/batch_helper.rb +++ b/helpers/batch_helper.rb @@ -20,8 +20,9 @@ def batch_class_lookup(class_id_by_ontology, goo_include) class_id_to_ontology = Hash.new class_id_by_ontology.keys.each do |ont_id_orig| ont_id = ont_id_orig - ont_id = LinkedData::Models::Base.replace_url_prefix_to_id(ont_id_orig.to_s) - + if LinkedData.settings.replace_url_prefix && ont_id_orig.to_s.start_with?(LinkedData.settings.rest_url_prefix) + ont_id = ont_id_orig.sub(LinkedData.settings.rest_url_prefix, LinkedData.settings.id_url_prefix) + end if all_latest_by_id[ont_id] latest_submissions << all_latest_by_id[ont_id] all_class_ids << class_id_by_ontology[ont_id_orig] @@ -42,7 +43,10 @@ def batch_class_lookup(class_id_by_ontology, goo_include) ont_classes.each do |cls| if class_id_to_ontology[cls.id.to_s] ont_id_orig = class_id_to_ontology[cls.id.to_s] - ont_id = LinkedData::Models::Base.replace_url_prefix_to_id(ont_id_orig.to_s) + ont_id = ont_id_orig + if LinkedData.settings.replace_url_prefix && ont_id_orig.to_s.start_with?(LinkedData.settings.rest_url_prefix) + ont_id = ont_id_orig.sub(LinkedData.settings.rest_url_prefix, LinkedData.settings.id_url_prefix) + end if all_latest_by_id[ont_id] cls.submission = all_latest_by_id[ont_id] to_reply << cls