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

Fix: enforce to use str() when doing a filter with a string value #57

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ PATH
remote: .
specs:
goo (0.0.2)
addressable (~> 2.8)
pry
rdf (= 3.2.11)
rdf-raptor
Expand All @@ -32,6 +33,8 @@ GEM
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
builder (3.2.4)
coderay (1.1.3)
Expand Down Expand Up @@ -71,7 +74,8 @@ GEM
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.8)
public_suffix (5.0.4)
rack (2.2.8.1)
rack-accept (0.4.5)
rack (>= 0.4)
rack-post-body-to-params (0.1.8)
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
retries: 5

agraph-ut:
image: franzinc/agraph:v8.0.0.rc1
image: franzinc/agraph:v8.1.0
platform: linux/amd64
environment:
- AGRAPH_SUPER_USER=test
Expand Down
1 change: 1 addition & 0 deletions goo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Gem::Specification.new do |s|
s.email = "manuelso@stanford.edu"
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", "3.2.11") #unpin when we support only Ruby >= 3.0
s.add_dependency("rdf-vocab")
Expand Down
5 changes: 4 additions & 1 deletion lib/goo/sparql/query_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,12 @@ def query_filter_sparql(klass, filter, filter_patterns, filter_graphs,
value = RDF::Literal.new(filter_operation.value)
if filter_operation.value.is_a? String
value = RDF::Literal.new(filter_operation.value)
filter_var = "str(?#{filter_var})"
else
filter_var = "?#{filter_var}"
end
filter_operations << (
"?#{filter_var.to_s} #{sparql_op_string(filter_operation.operator)} " +
"#{filter_var.to_s} #{sparql_op_string(filter_operation.operator)} " +
" #{value.to_ntriples}")
end

Expand Down
Loading