Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Multilingual support - Add request language middleware #148

Merged
16 changes: 9 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gem 'rake', '~> 10.0'
gem 'sinatra', '~> 1.0'
gem 'sinatra-advanced-routes'
gem 'sinatra-contrib', '~> 1.0'
gem 'request_store'

# Rack middleware
gem 'ffi'
Expand Down Expand Up @@ -40,13 +41,13 @@ gem 'unicorn-worker-killer'
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'
# NCBO gems (can be from a local dev path or from rubygems/git)
gem 'ncbo_annotator', git: 'https://github.com/ncbo/ncbo_annotator.git', branch: 'master'
gem 'ncbo_cron', git: 'https://github.com/ncbo/ncbo_cron.git', branch: 'master'
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'sparql-client', github: 'ncbo/sparql-client', branch: 'master'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'pr/sync-agroportal-bioportal'
gem 'ontologies_linked_data', github: 'ontoportal-lirmm/ontologies_linked_data', branch: 'pr/sync-agroportal-ncbo'

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
Expand Down Expand Up @@ -74,4 +75,5 @@ group :test do
gem 'rack-test'
gem 'simplecov', require: false
gem 'simplecov-cobertura' # for codecov.io
gem 'webmock', '~> 3.19.1'
end
95 changes: 45 additions & 50 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: 33583fd1c1d72b449cd6bb91815e3422b8448983
branch: develop
specs:
goo (0.0.2)
addressable (~> 2.8)
pry
rdf (= 1.0.8)
redis
request_store
rest-client
rsolr
sparql-client
uuid

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: 7531e10ad55ac66e925c099d7fc05a5a3ceae67e
branch: develop
revision: 63c986880aa88c9384043e6611a682434a14aba7
branch: master
specs:
ncbo_annotator (0.0.1)
goo
Expand All @@ -27,13 +11,11 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_cron.git
revision: 26638bfdbec1e6b01f5eb6a8b655bfd70adac8ac
branch: develop
revision: f239b34230131cd7cfb9eec5b34068ba990b698b
branch: master
specs:
ncbo_cron (0.0.1)
dante
faraday (~> 2)
faraday-follow_redirects (~> 0)
goo
google-analytics-data
mlanett-redis-lock
Expand All @@ -45,8 +27,8 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_ontology_recommender.git
revision: f92a42f660635522eb8709e618ff2e641aef0d17
branch: develop
revision: 013abea4af3b10910ec661dbb358a4b6cae198a4
branch: master
specs:
ncbo_ontology_recommender (0.0.1)
goo
Expand All @@ -55,9 +37,35 @@ GIT
redis

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: a3f6cf0493bb595011f98acf95efda33111c537b
branch: develop
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)

GIT
remote: https://github.com/ontoportal-lirmm/goo.git
revision: f2751fe9324e48a0a5c2a8b15580ab879fc53a2b
branch: pr/sync-agroportal-bioportal
specs:
goo (0.0.2)
addressable (~> 2.8)
pry
rdf (= 1.0.8)
redis
request_store
rest-client
rsolr
sparql-client
uuid

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: fc48343ad7a3f1867821c173be900cf16506b4b7
branch: pr/sync-agroportal-ncbo
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand All @@ -74,16 +82,6 @@ GIT
rsolr
rubyzip

GIT
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/palexander/rack-post-body-to-params.git
revision: 0fd30e710386d0cb8a3a6833d9549d7b655d5398
Expand Down Expand Up @@ -132,6 +130,9 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crack (1.0.0)
bigdecimal
rexml
cube-ruby (0.0.3)
dante (0.2.0)
date (3.3.4)
Expand All @@ -142,8 +143,6 @@ GEM
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
faraday-retry (2.2.1)
faraday (~> 2.0)
Expand All @@ -170,8 +169,6 @@ GEM
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-protobuf (3.25.3)
google-protobuf (3.25.3-aarch64-linux)
google-protobuf (3.25.3-arm64-darwin)
google-protobuf (3.25.3-x86_64-darwin)
google-protobuf (3.25.3-x86_64-linux)
Expand All @@ -188,12 +185,6 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.63.0)
google-protobuf (~> 3.25)
googleapis-common-protos-types (~> 1.0)
grpc (1.63.0-aarch64-linux)
google-protobuf (~> 3.25)
googleapis-common-protos-types (~> 1.0)
grpc (1.63.0-arm64-darwin)
google-protobuf (~> 3.25)
googleapis-common-protos-types (~> 1.0)
Expand All @@ -206,6 +197,7 @@ GEM
haml (5.2.2)
temple (>= 0.8.0)
tilt
hashdiff (1.1.0)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
Expand Down Expand Up @@ -382,14 +374,15 @@ GEM
unicorn (>= 4, < 7)
uuid (2.3.9)
macaddr (~> 1.0)
webmock (3.19.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
aarch64-linux
arm64-darwin-22
arm64-darwin-23
ruby
x86_64-darwin-18
x86_64-darwin-21
x86_64-darwin-23
x86_64-linux

Expand Down Expand Up @@ -431,6 +424,7 @@ DEPENDENCIES
redis
redis-rack-cache (~> 2.0)
redis-store (~> 1.10)
request_store
rubocop
shotgun!
simplecov
Expand All @@ -441,6 +435,7 @@ DEPENDENCIES
sparql-client!
unicorn
unicorn-worker-killer
webmock (~> 3.19.1)

BUNDLED WITH
2.4.22
6 changes: 6 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@
require_relative 'lib/rack/cube_reporter'
require_relative 'lib/rack/param_translator'
require_relative 'lib/rack/slice_detection'
require_relative 'lib/rack/request_lang'

# Logging setup
require_relative "config/logging"

# Inflector setup
require_relative "config/inflections"

require 'request_store'

# Protection settings
set :protection, :except => :path_traversal

Expand Down Expand Up @@ -141,6 +144,9 @@
use Rack::PostBodyToParams
use Rack::ParamTranslator

use RequestStore::Middleware
use Rack::RequestLang

use LinkedData::Security::Authorization
use LinkedData::Security::AccessDenied

Expand Down
12 changes: 12 additions & 0 deletions config/solr/property_search/enumsconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<enumsConfig>
<enum name="ontologyType">
<value>ONTOLOGY</value>
<value>VALUE_SET_COLLECTION</value>
</enum>
<enum name="propertyType">
<value>ANNOTATION</value>
<value>DATATYPE</value>
<value>OBJECT</value>
</enum>
</enumsConfig>
Loading