Skip to content

Commit

Permalink
Merge pull request #199 from ontoportal-lirmm/pr/sync-agroportal-ncbo
Browse files Browse the repository at this point in the history
Feature: Multilingual Support - Add search and languages serialization
  • Loading branch information
alexskr authored May 8, 2024
2 parents 02986ff + fc48343 commit f6764a8
Show file tree
Hide file tree
Showing 34 changed files with 382,747 additions and 964 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.bundle/
*.swp
*.gemtags
.bundle
Expand Down
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ gem 'rest-client'
gem 'rsolr'
gem 'rubyzip', '~> 1.0'
gem 'thin'
gem 'request_store'


# Testing
group :test do
Expand All @@ -31,7 +33,6 @@ end
group :development do
gem 'rubocop', require: false
end

# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'goo', github: 'ncbo/goo', branch: 'master'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'pr/sync-agroportal-bioportal'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'develop'
30 changes: 15 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: ef2d816df2d263c905bd034efd449a964fa4890f
branch: master
remote: https://github.com/ncbo/sparql-client.git
revision: 1657f0dd69fd4b522d3549a6848670175f5e98cc
branch: develop
specs:
sparql-client (1.0.1)
json_pure (>= 1.4)
net-http-persistent (= 2.9.4)
rdf (>= 1.0)

GIT
remote: https://github.com/ontoportal-lirmm/goo.git
revision: f2751fe9324e48a0a5c2a8b15580ab879fc53a2b
branch: pr/sync-agroportal-bioportal
specs:
goo (0.0.2)
addressable (~> 2.8)
Expand All @@ -14,16 +24,6 @@ GIT
sparql-client
uuid

GIT
remote: https://github.com/ncbo/sparql-client.git
revision: e89c26aa96f184dbe9b52d51e04fb3d9ba998dbc
branch: master
specs:
sparql-client (1.0.1)
json_pure (>= 1.4)
net-http-persistent (= 2.9.4)
rdf (>= 1.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -182,8 +182,7 @@ GEM
macaddr (~> 1.0)

PLATFORMS
arm64-darwin-22
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
activesupport (~> 4)
Expand All @@ -204,6 +203,7 @@ DEPENDENCIES
rack
rack-test (~> 0.6)
rake (~> 10.0)
request_store
rest-client
rsolr
rubocop
Expand Down
1,010 changes: 520 additions & 490 deletions config/solr/term_search/schema.xml

Large diffs are not rendered by default.

60 changes: 41 additions & 19 deletions lib/ontologies_linked_data/config/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ def config(&block)
yield @settings, overide_connect_goo if block_given?

# Check to make sure url prefix has trailing slash
@settings.rest_url_prefix = @settings.rest_url_prefix + '/' unless @settings.rest_url_prefix[-1].eql?('/')
@settings.rest_url_prefix = "#{@settings.rest_url_prefix}/" unless @settings.rest_url_prefix[-1].eql?('/')

puts "(LD) >> Using rdf store #{@settings.goo_host}:#{@settings.goo_port}#{@settings.goo_path_query}"
puts "(LD) >> Using term search server at #{@settings.search_server_url}"
puts "(LD) >> Using property search server at #{@settings.property_search_server_url}"
puts '(LD) >> Using HTTP Redis instance at '+
"#{@settings.http_redis_host}:#{@settings.http_redis_port}"
puts '(LD) >> Using Goo Redis instance at '+
"#{@settings.goo_redis_host}:#{@settings.goo_redis_port}"
puts "(LD) >> Using HTTP Redis instance at #{@settings.http_redis_host}:#{@settings.http_redis_port}"
puts "(LD) >> Using Goo Redis instance at #{@settings.goo_redis_host}:#{@settings.goo_redis_port}"

connect_goo unless overide_connect_goo
end
Expand Down Expand Up @@ -132,15 +130,14 @@ def connect_goo
port: @settings.goo_redis_port)

if @settings.enable_monitoring
puts "(LD) >> Enable SPARQL monitoring with cube #{@settings.cube_host}:"+
"#{@settings.cube_port}"
puts "(LD) >> Enable SPARQL monitoring with cube #{@settings.cube_host}:#{@settings.cube_port}"
conf.enable_cube do |opts|
opts[:host] = @settings.cube_host
opts[:port] = @settings.cube_port
end
end
end
rescue Exception => e
rescue StandardError => e
abort("EXITING: Cannot connect to triplestore and/or search server:\n #{e}\n#{e.backtrace.join("\n")}")
end
end
Expand All @@ -153,23 +150,48 @@ def goo_namespaces
conf.add_namespace(:omv, RDF::Vocabulary.new("http://omv.ontoware.org/2005/05/ontology#"))
conf.add_namespace(:skos, RDF::Vocabulary.new("http://www.w3.org/2004/02/skos/core#"))
conf.add_namespace(:owl, RDF::Vocabulary.new("http://www.w3.org/2002/07/owl#"))
conf.add_namespace(:rdf, RDF::Vocabulary.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#"))
conf.add_namespace(:rdfs, RDF::Vocabulary.new("http://www.w3.org/2000/01/rdf-schema#"))
conf.add_namespace(:metadata,
RDF::Vocabulary.new("http://data.bioontology.org/metadata/"),
default = true)
conf.add_namespace(:metadata_def,
RDF::Vocabulary.new("http://data.bioontology.org/metadata/def/"))
conf.add_namespace(:metadata, RDF::Vocabulary.new("http://data.bioontology.org/metadata/"), default = true)
conf.add_namespace(:metadata_def, RDF::Vocabulary.new("http://data.bioontology.org/metadata/def/"))
conf.add_namespace(:dc, RDF::Vocabulary.new("http://purl.org/dc/elements/1.1/"))
conf.add_namespace(:xsd, RDF::Vocabulary.new("http://www.w3.org/2001/XMLSchema#"))
conf.add_namespace(:oboinowl_gen,
RDF::Vocabulary.new("http://www.geneontology.org/formats/oboInOwl#"))
conf.add_namespace(:oboinowl_gen, RDF::Vocabulary.new("http://www.geneontology.org/formats/oboInOwl#"))
conf.add_namespace(:obo_purl, RDF::Vocabulary.new("http://purl.obolibrary.org/obo/"))
conf.add_namespace(:umls,
RDF::Vocabulary.new("http://bioportal.bioontology.org/ontologies/umls/"))
conf.id_prefix = "http://data.bioontology.org/"
conf.add_namespace(:umls, RDF::Vocabulary.new("http://bioportal.bioontology.org/ontologies/umls/"))
conf.add_namespace(:door, RDF::Vocabulary.new("http://kannel.open.ac.uk/ontology#"))
conf.add_namespace(:dct, RDF::Vocabulary.new("http://purl.org/dc/terms/"))

conf.add_namespace(:void, RDF::Vocabulary.new("http://rdfs.org/ns/void#"))
conf.add_namespace(:foaf, RDF::Vocabulary.new("http://xmlns.com/foaf/0.1/"))
conf.add_namespace(:vann, RDF::Vocabulary.new("http://purl.org/vocab/vann/"))
conf.add_namespace(:adms, RDF::Vocabulary.new("http://www.w3.org/ns/adms#"))
conf.add_namespace(:voaf, RDF::Vocabulary.new("http://purl.org/vocommons/voaf#"))
conf.add_namespace(:dcat, RDF::Vocabulary.new("http://www.w3.org/ns/dcat#"))
conf.add_namespace(:mod, RDF::Vocabulary.new("http://www.isibang.ac.in/ns/mod#"))
conf.add_namespace(:prov, RDF::Vocabulary.new("http://www.w3.org/ns/prov#"))
conf.add_namespace(:cc, RDF::Vocabulary.new("http://creativecommons.org/ns#"))
conf.add_namespace(:schema, RDF::Vocabulary.new("http://schema.org/"))
conf.add_namespace(:doap, RDF::Vocabulary.new("http://usefulinc.com/ns/doap#"))
conf.add_namespace(:bibo, RDF::Vocabulary.new("http://purl.org/ontology/bibo/"))
conf.add_namespace(:wdrs, RDF::Vocabulary.new("http://www.w3.org/2007/05/powder-s#"))
conf.add_namespace(:cito, RDF::Vocabulary.new("http://purl.org/spar/cito/"))
conf.add_namespace(:pav, RDF::Vocabulary.new("http://purl.org/pav/"))
conf.add_namespace(:oboInOwl, RDF::Vocabulary.new("http://www.geneontology.org/formats/oboInOwl#"))
conf.add_namespace(:idot, RDF::Vocabulary.new("http://identifiers.org/idot/"))
conf.add_namespace(:sd, RDF::Vocabulary.new("http://www.w3.org/ns/sparql-service-description#"))
conf.add_namespace(:org, RDF::Vocabulary.new("http://www.w3.org/ns/org#"))
conf.add_namespace(:cclicense, RDF::Vocabulary.new("http://creativecommons.org/licenses/"))
conf.add_namespace(:nkos, RDF::Vocabulary.new("http://w3id.org/nkos#"))
conf.add_namespace(:skosxl, RDF::Vocabulary.new("http://www.w3.org/2008/05/skos-xl#"))
conf.add_namespace(:dcterms, RDF::Vocabulary.new("http://purl.org/dc/terms/"))
conf.add_namespace(:uneskos, RDF::Vocabulary.new("http://purl.org/umu/uneskos#"))


conf.id_prefix = 'http://data.bioontology.org/'
conf.pluralize_models(true)
end
end
self.goo_namespaces
goo_namespaces

end
22 changes: 11 additions & 11 deletions lib/ontologies_linked_data/models/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ def self.goo_attrs_to_load(attributes = [], level = 0)
raise ArgumentError, "`attributes` should be an array" unless attributes.is_a?(Array)

# Get attributes, either provided, all, or default
if !attributes.empty?
if attributes.first == :all
default_attrs = self.attributes
else
default_attrs = attributes
end
elsif self.hypermedia_settings[:serialize_default].empty?
default_attrs = self.attributes
else
default_attrs = self.hypermedia_settings[:serialize_default].dup
end
default_attrs = if !attributes.empty?
if attributes.first == :all
(self.attributes + self.hypermedia_settings[:serialize_default]).uniq
else
attributes
end
elsif self.hypermedia_settings[:serialize_default].empty?
self.attributes
else
self.hypermedia_settings[:serialize_default].dup
end

embed_attrs = {}
extra_attrs = []
Expand Down
Loading

0 comments on commit f6764a8

Please sign in to comment.