Skip to content

Commit

Permalink
Merge branch 'feature/migrate-to-virtuso' into pr/feature/support-mul…
Browse files Browse the repository at this point in the history
…tiple-backends
  • Loading branch information
syphax-bouazzouni committed Apr 17, 2024
2 parents c7ee4a6 + 09c944f commit 5242514
Show file tree
Hide file tree
Showing 37 changed files with 1,659 additions and 675 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ruby-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '3.0']
triplestore: ['fs', 'ag']
goo-slice: [ '20', '100', '500' ]
ruby-version: [ '2.7', '3.0' ]
triplestore: [ 'fs', 'ag', 'vo', 'gb' ]

steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get -y install raptor2-utils
run: sudo apt-get update && sudo apt-get -y install raptor2-utils
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -27,8 +28,10 @@ jobs:
- name: Add config file
# tempoaray workaround for the config.rb file requirement
run: echo 'Goo.config do |config| end' > config/config.rb
- name: List directory contents
run: ls -R ./test/data
- name: Run tests
run: bundle exec rake test:docker:${{ matrix.triplestore }} TESTOPTS="-v"
run: GOO_SLICES=${{ matrix.goo-slice }} bundle exec rake test:docker:${{ matrix.triplestore }} TESTOPTS="-v"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.8
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gem "activesupport"
gem "cube-ruby", require: "cube"
gem "rake"
gem "uuid"
gem "request_store"

group :test do
gem "minitest", '< 5.0'
Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ GEM
redis-client (>= 0.22.0)
redis-client (0.22.1)
connection_pool
request_store (1.6.0)
rack (>= 1.4)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
Expand Down Expand Up @@ -121,6 +123,8 @@ GEM

PLATFORMS
x86_64-darwin-18
x86_64-darwin-23
x86_64-linux

DEPENDENCIES
activesupport
Expand All @@ -131,6 +135,7 @@ DEPENDENCIES
rack-accept
rack-post-body-to-params
rake
request_store
simplecov
simplecov-cobertura
sinatra
Expand All @@ -139,4 +144,4 @@ DEPENDENCIES
uuid

BUNDLED WITH
2.3.15
2.4.22
61 changes: 49 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
retries: 30

solr-ut:
image: ontoportal/solr-ut:0.1.0
image: ontoportal/solr-ut:0.0.2
ports:
- 8983:8983
healthcheck:
Expand All @@ -28,22 +28,23 @@ services:
- AGRAPH_SUPER_PASSWORD=xyzzy
shm_size: 1g
ports:
# - 10035:10035
- 10000-10035:10000-10035
volumes:
- agdata:/agraph/data
# - ./agraph/etc:/agraph/etc
command: >
bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start
; agtool repos create ontoportal_test --supersede
; agtool users add anonymous
; agtool users grant anonymous root:ontoportal_test:rw
; tail -f /agraph/data/agraph.log"
healthcheck:
test: ["CMD-SHELL", "agtool storage-report ontoportal_test || exit 1"]
start_period: 30s
interval: 10s
timeout: 10s
retries: 10
bash -c "/agraph/bin/agraph-control --config /agraph/etc/agraph.cfg start
; agtool repos create ontoportal_test --supersede
; agtool users add anonymous
; agtool users grant anonymous root:ontoportal_test:rw
; tail -f /agraph/data/agraph.log"
# healthcheck:
# test: ["CMD-SHELL", "curl -sf http://127.0.0.1:10035/repositories/ontoportal_test/status | grep -iqE '(^running|^lingering)' || exit 1"]
# start_period: 10s
# interval: 10s
# timeout: 5s
# retries: 5
profiles:
- ag

Expand All @@ -58,5 +59,41 @@ services:
&& 4s-httpd -D -s-1 -p 9000 ontoportal_kb"
profiles:
- fs
virtuoso-ut:
image: tenforce/virtuoso:virtuoso7.2.5
platform: linux/amd64
environment:
- SPARQL_UPDATE=true
ports:
- 1111:1111
- 8890:8890

profiles:
- vo

graphdb:
image: ontotext/graphdb:10.3.3
platform: linux/amd64
privileged: true
environment:
GDB_HEAP_SIZE: 5G
GDB_JAVA_OPTS: >-
-Xms5g -Xmx5g
ports:
- 7200:7200
- 7300:7300
volumes:
- ./test/data/graphdb-repo-config.ttl:/opt/graphdb/dist/configs/templates/data/graphdb-repo-config.ttl
- ./test/data/graphdb-test-load.nt:/opt/graphdb/dist/configs/templates/data/graphdb-test-load.nt

entrypoint: >
bash -c " importrdf load -f -c /opt/graphdb/dist/configs/templates/data/graphdb-repo-config.ttl -m parallel /opt/graphdb/dist/configs/templates/data/graphdb-test-load.nt ; graphdb -Ddefault.min.distinct.threshold=3000 "
profiles:
- gb

volumes:
agdata:




51 changes: 51 additions & 0 deletions lib/goo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ module Goo

@@resource_options = Set.new([:persistent]).freeze

# Define the languages from which the properties values will be taken
# It choose the first language that match otherwise return all the values
@@main_languages = %w[en]
@@requested_language = nil

@@configure_flag = false
@@sparql_backends = {}
@@model_by_name = {}
Expand All @@ -47,6 +52,52 @@ module Goo

@@slice_loading_size = 500



def self.log_debug_file(str)
debug_file = "./queries.txt"
File.write(debug_file, str.to_s + "\n", mode: 'a')
end



def backend_4s?
sparql_backend_name.downcase.eql?("4store")
end

def backend_ag?
sparql_backend_name.downcase.eql?("allegrograph")
end

def backend_gb?
sparql_backend_name.downcase.eql?("graphdb")
end

def backend_vo?
sparql_backend_name.downcase.eql?("virtuoso")
end


def self.main_languages
@@main_languages
end
def self.main_languages=(lang)
@@main_languages = lang
end

def self.requested_language
@@requested_language
end

def self.requested_language=(lang)
@@requested_language = lang
end

def self.language_includes(lang)
lang_str = lang.to_s
main_languages.index { |l| lang_str.downcase.eql?(l) || lang_str.upcase.eql?(l)}
end

def self.add_namespace(shortcut, namespace,default=false)
if !(namespace.instance_of? RDF::Vocabulary)
raise ArgumentError, "Namespace must be a RDF::Vocabulary object"
Expand Down
Loading

0 comments on commit 5242514

Please sign in to comment.