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

Merge development & upstream (2022-12) #15

Merged
merged 31 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bc200dd
Add unit test github actions.
alexskr Apr 15, 2022
e797872
Remove version pin for addressable gem
alexskr Apr 16, 2022
dc653ac
re-pin version of addressable gem to 2.3.5
alexskr Apr 18, 2022
d0d8825
update addressable gem to v2.8
alexskr Apr 19, 2022
b7874b1
Merge pull request #120 from ncbo/update_addressable_gem_2_8
mdorf May 18, 2022
fd7d45c
Resolve merge conflict
jvendetti Jul 14, 2022
5820798
Bump rack from 2.2.3 to 2.2.4
dependabot[bot] Jul 14, 2022
eb60ab4
Bump tzinfo from 0.3.60 to 0.3.61
dependabot[bot] Jul 21, 2022
1f036d9
Merge pull request #125 from ncbo/dependabot/bundler/tzinfo-0.3.61
jvendetti Jul 27, 2022
562826b
Merge pull request #123 from ncbo/dependabot/bundler/rack-2.2.4
jvendetti Jul 27, 2022
7fe22f0
Restore branch specifier to develop
jvendetti Jul 27, 2022
091e0ca
partial fix to ncbo/bioportal-project#251 - spaces in class ids cause…
mdorf Oct 17, 2022
c738990
Gemfile.lock update
mdorf Nov 3, 2022
0e09816
A small (2 line) fix for 3 or 12 (depending on how it is counted) tes…
stdotjohn Nov 4, 2022
b33f6ab
fixed one of the two final errors
stdotjohn Nov 8, 2022
2b4a123
Simplified test_case.rb
stdotjohn Nov 14, 2022
1ef7367
pin ruby/setup-ruby action to v1 release
alexskr Nov 16, 2022
7e3825f
Add code coverage report uploads to codecove.io
alexskr Nov 17, 2022
204cecf
Merge pull request #126 from ncbo/codecov
alexskr Nov 17, 2022
077c674
Merge branch 'develop'
alexskr Nov 17, 2022
ad48ecf
Merge branch 'pr/feature/optimize-sparql-query-build-unions' into dev…
syphax-bouazzouni Nov 23, 2022
25874f8
Merge branch 'pl/add-mainlang-defaults-refactored' into development
syphax-bouazzouni Nov 23, 2022
e26325e
Merge branch 'pl/add-mainlang-defaults-refactored' into development
syphax-bouazzouni Nov 25, 2022
295d794
Merge branch 'pr/feature/optimize-sparql-query-build-unions' into dev…
syphax-bouazzouni Nov 29, 2022
b7d7f7f
Merge branch 'upstream' into merge/merge-to-upstream-v-5.23.1
syphax-bouazzouni Dec 17, 2022
ba4f910
merge partial fix to ncbo/bioportal-project#251
syphax-bouazzouni Dec 17, 2022
3ddcf11
Revert "A small (2 line) fix for 3 or 12 (depending on how it is coun…
stdotjohn Nov 4, 2022
86553d2
fix test_model_complex.rb tests with a uniq and not reused model name
syphax-bouazzouni Dec 17, 2022
352f3ca
fix embed ready only models
syphax-bouazzouni Dec 17, 2022
514311c
Merge branch 'pr/feature/optimize-sparql-query-build-unions' into dev…
syphax-bouazzouni Dec 17, 2022
41b6e62
Merge branch 'merge/merge-to-upstream-v-5.23.1' into development
syphax-bouazzouni Dec 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/ruby-unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Ruby Unit Test

on: [push, pull_request]

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7']

steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: sudo apt-get -y install raptor2-utils
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Start backend services via docker-compose
run: docker compose up -d
- name: Run tests
run: bundle exec rake test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

26 changes: 15 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@ source 'https://rubygems.org'

gemspec

gem 'rake'
gem 'pry'
gem 'simplecov'
gem 'minitest', '< 5.0'
gem 'activesupport'
gem "activesupport"
gem "cube-ruby", require: "cube"
gem "faraday", '~> 1.9'
gem "rake"
gem "uuid"
gem 'cube-ruby', require: "cube"
gem 'faraday', '~> 1.9'

group :test do
gem "minitest", '< 5.0'
gem "pry"
gem 'simplecov'
gem 'simplecov-cobertura' # for submitting code coverage results to codecov.io
end

group :profiling do
gem 'sinatra'
gem 'rack-accept'
gem 'rack-post-body-to-params'
gem 'thin'
gem "rack-accept"
gem "rack-post-body-to-params"
gem "sinatra"
gem "thin"
end

gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'master'
58 changes: 35 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ PATH
remote: .
specs:
goo (0.0.2)
addressable (= 2.3.5)
addressable (~> 2.8)
pry
rdf (= 1.0.8)
redis
rest-client
rsolr
sparql-client
systemu
uuid

GEM
Expand All @@ -31,17 +30,19 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.5)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
builder (3.2.4)
coderay (1.1.3)
concurrent-ruby (1.1.9)
concurrent-ruby (1.1.10)
connection_pool (2.3.0)
cube-ruby (0.0.3)
daemons (1.4.1)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
eventmachine (1.2.7)
faraday (1.10.0)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
Expand All @@ -57,19 +58,19 @@ GEM
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
http-accept (1.7.0)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json_pure (2.6.1)
json_pure (2.6.2)
macaddr (1.7.2)
systemu (~> 2.6.5)
method_source (1.0.0)
Expand All @@ -78,30 +79,35 @@ GEM
mime-types-data (3.2022.0105)
minitest (4.7.5)
multi_json (1.15.0)
multipart-post (2.1.1)
mustermann (1.1.1)
multipart-post (2.2.3)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
net-http-persistent (2.9.4)
netrc (0.11.0)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.3)
public_suffix (5.0.0)
rack (2.2.4)
rack-accept (0.4.5)
rack (>= 0.4)
rack-post-body-to-params (0.1.8)
activesupport (>= 2.3)
rack-protection (2.2.0)
rack-protection (3.0.3)
rack
rake (13.0.6)
rdf (1.0.8)
addressable (>= 2.2)
redis (4.6.0)
redis (5.0.5)
redis-client (>= 0.9.0)
redis-client (0.11.1)
connection_pool
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rsolr (2.5.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand All @@ -110,29 +116,34 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (2.2.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.2.0)
sinatra (3.0.3)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.0.3)
tilt (~> 2.0)
systemu (2.6.5)
thin (1.8.1)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (0.3.60)
tilt (2.0.11)
tzinfo (0.3.61)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.1)
unf_ext (0.0.8.2)
uuid (2.3.9)
macaddr (~> 1.0)

PLATFORMS
x86_64-darwin-21
ruby
x86_64-darwin-16
x86_64-linux

DEPENDENCIES
activesupport
Expand All @@ -145,10 +156,11 @@ DEPENDENCIES
rack-post-body-to-params
rake
simplecov
simplecov-cobertura
sinatra
sparql-client!
thin
uuid

BUNDLED WITH
2.3.5
2.3.22
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3'

services:
4store:
image: bde2020/4store
ports:
- 9000:9000
command: >
bash -c "4s-backend-setup --segments 4 ontoportal_kb
&& 4s-backend ontoportal_kb
&& 4s-httpd -D -s-1 -p 9000 ontoportal_kb"

redis:
image: redis
ports:
- 6379:6379
healthcheck:
test: redis-cli ping
interval: 1s
timeout: 3s
retries: 30

solr:
image: ontoportal/solr-ut:0.1
ports:
- 8983:8983
26 changes: 12 additions & 14 deletions goo.gemspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
Gem::Specification.new do |s|
s.name = 'goo'
s.version = '0.0.2'
s.date = '2012-11-21'
s.summary = ""
s.name = "goo"
s.version = "0.0.2"
s.summary = "Graph Oriented Objects (GOO) for Ruby. A RDF/SPARQL based ORM."
s.authors = ["Manuel Salvadores", "Paul Alexander"]
s.email = '[email protected]'
s.files = Dir['lib/**/*.rb']
s.homepage = 'http://github.com/ncbo/goo'
s.add_dependency("uuid")
s.add_dependency("systemu") # remove when https://github.com/ahoward/macaddr/pull/20 is resolved
s.add_dependency("rsolr")
s.email = "[email protected]"
s.files = Dir["lib/**/*.rb"]
s.homepage = "http://github.com/ncbo/goo"
s.add_dependency("addressable", "~> 2.8")
s.add_dependency("pry")
s.add_dependency("rdf", "= 1.0.8")
s.add_dependency("sparql-client")
s.add_dependency("addressable", "= 2.3.5")
s.add_dependency("rest-client")
s.add_dependency("redis")
s.add_dependency("pry")
s.add_dependency("rest-client")
s.add_dependency("rsolr")
s.add_dependency("sparql-client")
s.add_dependency("uuid")
end
2 changes: 1 addition & 1 deletion lib/goo/sparql/mixins/solution_lang_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def save_other_lang_val(id, attr, index, value)
def matched_languages(index_values, model_attribute_val)
not_matched_lang = index_values[:not_matched]
matched_lang = index_values.reject { |key| key == :not_matched }
unless model_attribute_val.nil? || model_attribute_val.empty?
unless model_attribute_val.nil? || Array(model_attribute_val).empty?
matched_lang[:no_lang] = Array(model_attribute_val)
end
[matched_lang, not_matched_lang]
Expand Down
15 changes: 8 additions & 7 deletions lib/goo/sparql/query_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def build_select_query(ids, variables, graphs, patterns,
variables, optional_patterns = get_aggregate_vars(@aggregate, @collection, graphs,
@klass, @unions, variables, internal_variables)

@order_by, variables, patterns = init_order_by(@count, @klass, @order_by, patterns, variables)
@order_by, variables, optional_patterns = init_order_by(@count, @klass, @order_by, optional_patterns, variables)
variables, patterns = add_some_type_to_id(patterns, query_options, variables)

query_filter_str, patterns, optional_patterns =
Expand Down Expand Up @@ -71,7 +71,6 @@ def build_select_query(ids, variables, graphs, patterns,
query_options = { rules: ['NONE'] }
end
@query.options[:query_options] = query_options

[@query, aggregate_projections]
end

Expand Down Expand Up @@ -148,7 +147,7 @@ def ids_filter(ids)
filter_id = []

ids.each do |id|
filter_id << "?id = #{id.to_ntriples.to_s}"
filter_id << "?id = #{id.to_ntriples.to_s.gsub(' ', '%20')}"
end
filter_id_str = filter_id.join ' || '
@query.filter filter_id_str
Expand Down Expand Up @@ -258,19 +257,21 @@ def get_client
Goo.sparql_query_client(@store)
end

def init_order_by(count, klass, order_by, patterns, variables)
def init_order_by(count, klass, order_by, optional_patterns, variables)
order_by = nil if count
if order_by
order_by = order_by.first
#simple ordering ... needs to use pattern inspection
order_by.each do |attr, direction|
quad = query_pattern(klass, attr)
patterns << quad[1]
optional_patterns << quad[1]
#patterns << quad[1]
#mdorf, 9/22/16 If an ORDER BY clause exists, the columns used in the ORDER BY should be present in the SPARQL select
variables << attr unless variables.include?(attr)
#variables << attr unless variables.include?(attr)
end
variables = %i[id attributeProperty attributeObject]
end
[order_by, variables, patterns]
[order_by, variables, optional_patterns]
end

def sparql_op_string(op)
Expand Down
4 changes: 3 additions & 1 deletion lib/goo/sparql/solutions_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ def include_embed_attributes(incl_embed, objects_new)
}.values
unless range_objs.empty?
range_objs.uniq!
attr_range.where().models(range_objs).in(@collection).include(*next_attrs).all
query = attr_range.where().models(range_objs).in(@collection).include(*next_attrs)
query = query.read_only if @read_only
query.all
end
end
end
Expand Down
20 changes: 15 additions & 5 deletions test/test_case.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Start simplecov if this is a coverage task
if ENV["COVERAGE"].eql?("true")
require 'simplecov'
# Start simplecov if this is a coverage task or if it is run in the CI pipeline
if ENV["COVERAGE"] == "true" || ENV["CI"] == "true"
require "simplecov"
require "simplecov-cobertura"
# https://github.com/codecov/ruby-standard-2
# Generate HTML and Cobertura reports which can be consumed by codecov uploader
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::CoberturaFormatter
])
SimpleCov.start do
add_filter "/test/"
add_filter "app.rb"
Expand Down Expand Up @@ -34,16 +41,19 @@ def _run_suites(suites, type)
end

def _run_suite(suite, type)
[1,5,10,200].each do |slice_size|
%[1,5,10,20]
ret = []
[1,5,10,20].each do |slice_size|
puts "\nrunning test with slice_loading_size=#{slice_size}"
Goo.slice_loading_size=slice_size
begin
suite.before_suite if suite.respond_to?(:before_suite)
super(suite, type)
ret += super(suite, type)
ensure
suite.after_suite if suite.respond_to?(:after_suite)
end
end
return ret
end
end

Expand Down
Loading