From d6b84e12d61317dbddc1b86cb1451acb37915369 Mon Sep 17 00:00:00 2001 From: mdorf Date: Tue, 15 Oct 2024 12:28:54 -0700 Subject: [PATCH 1/4] small refactoring for the multilingual fixes --- lib/goo.rb | 4 ++++ lib/goo/search/search.rb | 8 -------- lib/goo/sparql/mixins/solution_lang_filter.rb | 6 +----- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/goo.rb b/lib/goo.rb index e85d03d6..e6e64cce 100644 --- a/lib/goo.rb +++ b/lib/goo.rb @@ -265,6 +265,10 @@ def self.sparql_backend_name(name=:main) return @@sparql_backends[name][:backend_name] end + def self.portal_language + @@main_languages.first.downcase.to_sym + end + def self.id_prefix return @@id_prefix end diff --git a/lib/goo/search/search.rb b/lib/goo/search/search.rb index 2987b4e2..730f21de 100644 --- a/lib/goo/search/search.rb +++ b/lib/goo/search/search.rb @@ -65,14 +65,6 @@ def search(q, params={}, connection_name=:main) def indexBatch(collection, connection_name=:main) docs = Array.new collection.each do |c| - - - - # c.bring(:prefLabel) - # binding.pry if c.prefLabel == "biodiversity" - - - docs << c.indexable_object end Goo.search_connection(connection_name).add(docs) diff --git a/lib/goo/sparql/mixins/solution_lang_filter.rb b/lib/goo/sparql/mixins/solution_lang_filter.rb index c1390b9b..92906600 100644 --- a/lib/goo/sparql/mixins/solution_lang_filter.rb +++ b/lib/goo/sparql/mixins/solution_lang_filter.rb @@ -171,17 +171,13 @@ def show_all_languages? end def get_language(languages) - languages = portal_language if languages.nil? || languages.empty? + languages = Goo.portal_language if languages.nil? || languages.empty? lang = languages lang = languages.to_s.split(',') unless lang.is_a?(Array) lang = lang.map { |l| l.upcase.to_sym } lang.length == 1 ? lang.first : lang end - def portal_language - Goo.main_languages.first - end - end end end From 567c466ea1d091c7bf9784f18962344678a9a8d4 Mon Sep 17 00:00:00 2001 From: mdorf Date: Wed, 13 Nov 2024 13:58:07 -0800 Subject: [PATCH 2/4] Gemfile.lock update --- Gemfile.lock | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 69c9a18f..33632a9a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,20 +54,21 @@ GEM domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.7.2) - json_pure (2.7.2) + json (2.8.1) + json_pure (2.8.1) logger (1.6.1) macaddr (1.7.2) systemu (~> 2.6.5) method_source (1.1.0) - mime-types (3.5.2) + mime-types (3.6.0) + logger mime-types-data (~> 3.2015) - mime-types-data (3.2024.0903) + mime-types-data (3.2024.1105) minitest (4.7.5) multi_json (1.15.0) mustermann (3.0.3) ruby2_keywords (~> 0.0.1) - net-http (0.4.1) + net-http (0.5.0) uri net-http-persistent (2.9.4) netrc (0.11.0) @@ -75,7 +76,7 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (6.0.1) - rack (2.2.9) + rack (2.2.10) rack-accept (0.4.5) rack (>= 0.4) rack-post-body-to-params (0.1.8) @@ -97,7 +98,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.3.7) + rexml (3.3.9) rsolr (2.6.0) builder (>= 2.1.2) faraday (>= 0.9, < 3, != 2.0.0) @@ -124,12 +125,13 @@ GEM thread_safe (0.3.6) tilt (2.4.0) tzinfo (0.3.62) - uri (0.13.1) + uri (1.0.1) uuid (2.3.9) macaddr (~> 1.0) PLATFORMS arm64-darwin-22 + arm64-darwin-23 x86_64-darwin-21 x86_64-darwin-23 x86_64-linux @@ -151,4 +153,4 @@ DEPENDENCIES uuid BUNDLED WITH - 2.5.20 + 2.5.11 From 35721855ba808517698d8b94eb38d4553001c4b6 Mon Sep 17 00:00:00 2001 From: mdorf Date: Wed, 13 Nov 2024 13:58:38 -0800 Subject: [PATCH 3/4] implemented a fix for ncbo/ontologies_linked_data#219 - ontology processing errors --- lib/goo/base/resource.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/goo/base/resource.rb b/lib/goo/base/resource.rb index 059fbba8..3a630b58 100644 --- a/lib/goo/base/resource.rb +++ b/lib/goo/base/resource.rb @@ -247,11 +247,11 @@ def self.map_attributes(inst,equivalent_predicates=nil, include_languages: false if object.is_a?(Hash) object = object.transform_values{|values| Array(values).map{|o|o.is_a?(RDF::URI) ? o : o.object}} else - object = object.map {|o| o.is_a?(RDF::URI) ? o : o.object} + object = Array(object).map {|o| o.is_a?(RDF::URI) ? o : o.object} end if klass.range(attr) - object = object.map { |o| + object = Array(object).map { |o| o.is_a?(RDF::URI) ? klass.range_object(attr,o) : o } end From 39f67ab7fae7675b6ff417ace0ab923e40ffcbcd Mon Sep 17 00:00:00 2001 From: Alex Skrenchuk Date: Thu, 14 Nov 2024 09:44:56 -0800 Subject: [PATCH 4/4] Gemfile.lock update --- Gemfile.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 07d4bbf2..0d362be5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,18 +43,18 @@ GEM docile (1.4.1) domain_name (0.6.20240107) eventmachine (1.2.7) - faraday (2.12.0) - faraday-net_http (>= 2.0, < 3.4) + faraday (2.12.1) + faraday-net_http (>= 2.0, < 3.5) json logger - faraday-net_http (3.3.0) - net-http + faraday-net_http (3.4.0) + net-http (>= 0.5.0) http-accept (1.7.0) http-cookie (1.0.7) domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.8.1) + json (2.8.2) json_pure (2.8.1) logger (1.6.1) macaddr (1.7.2) @@ -125,7 +125,7 @@ GEM thread_safe (0.3.6) tilt (2.4.0) tzinfo (0.3.62) - uri (1.0.1) + uri (1.0.2) uuid (2.3.9) macaddr (~> 1.0) @@ -153,4 +153,4 @@ DEPENDENCIES uuid BUNDLED WITH - 2.5.11 + 2.5.20