diff --git a/lib/goo.rb b/lib/goo.rb index cfdf9ea3..e85d03d6 100644 --- a/lib/goo.rb +++ b/lib/goo.rb @@ -110,25 +110,7 @@ def self.add_sparql_backend(name, *opts) @@sparql_backends[name][:backend_name] = opts[:backend_name] @@sparql_backends.freeze end - - def self.test_reset - if @@sparql_backends[:main][:query].url.to_s["localhost"].nil? - raise Exception, "only for testing" - end - @@sparql_backends[:main][:query]=Goo::SPARQL::Client.new("http://localhost:9000/sparql/", - {protocol: "1.1", "Content-Type" => "application/x-www-form-urlencoded", - read_timeout: 300, - redis_cache: @@redis_client }) - end - - def self.main_lang - @@main_lang - end - - def self.main_lang=(value) - @@main_lang = value - end - + def self.use_cache=(value) @@use_cache = value set_sparql_cache diff --git a/lib/goo/sparql/mixins/solution_lang_filter.rb b/lib/goo/sparql/mixins/solution_lang_filter.rb index d93f20c5..80236efe 100644 --- a/lib/goo/sparql/mixins/solution_lang_filter.rb +++ b/lib/goo/sparql/mixins/solution_lang_filter.rb @@ -50,7 +50,7 @@ def models_unmapped_to_array(m) def set_value(model, predicate, value, &block) language = object_language(value) - + if requested_lang.eql?(:ALL) || !literal?(value) || (language_match?(language) && can_add_new_value?(model,predicate, language)) block.call end @@ -102,9 +102,9 @@ def language_match?(language) # no_lang means that the object is not a literal return true if language.eql?(:no_lang) - return requested_lang.include?(language) if requested_lang.is_a?(Array) + return requested_lang.include?(language.upcase) if requested_lang.is_a?(Array) - language.eql?(requested_lang) + language.upcase.eql?(requested_lang) end def literal?(object) @@ -113,7 +113,7 @@ def literal?(object) def store_objects_by_lang(id, predicate, object, language) # store objects in this format: [id][predicate][language] = [objects] - return if requested_lang.is_a?(Array) && !requested_lang.include?(language) && !language.eql?('@none') + return if requested_lang.is_a?(Array) && !requested_lang.include?(language.upcase) && !language.eql?('@none') language_key = language.downcase