Skip to content

Commit

Permalink
Fix: enforce to use str() when doing a filter with a string value (#57)
Browse files Browse the repository at this point in the history
* enforce to use str() when doing a filter with a string

* update agraph version to 8.1.0
  • Loading branch information
syphax-bouazzouni committed Apr 3, 2024
1 parent 66b68ab commit 196070c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
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

0 comments on commit 196070c

Please sign in to comment.