@@ -294,7 +294,7 @@ def optimize!(**options)
294294 # Alias for `:graph_name`.
295295 # @param [Hash{Symbol => Object}] options
296296 # any additional keyword options
297- # @option options [Hash{Symbol => RDF::Term}] bindings
297+ # @option options [Hash{Symbol => RDF::Term}, RDF::Query::Solution ] bindings
298298 # optional variable bindings to use
299299 # @option options [Boolean] :optimize
300300 # Optimize query before execution.
@@ -313,6 +313,7 @@ def execute(queryable, bindings: {}, solutions: Solution.new, graph_name: nil, n
313313 # Otherwise, a quick empty solution simplifies the logic below; no special case for
314314 # the first pattern
315315 @solutions = Query ::Solutions ( solutions )
316+ bindings = bindings . to_h if bindings . is_a? ( Solution )
316317
317318 # If there are no patterns, just return the empty solution
318319 if empty?
@@ -341,7 +342,7 @@ def execute(queryable, bindings: {}, solutions: Solution.new, graph_name: nil, n
341342 bindings . each_key do |variable |
342343 if pattern . variables . include? ( variable )
343344 unbound_solutions , old_solutions = old_solutions , Query ::Solutions ( )
344- bindings [ variable ] . each do |binding |
345+ Array ( bindings [ variable ] ) . each do |binding |
345346 unbound_solutions . each do |solution |
346347 old_solutions << solution . merge ( variable => binding )
347348 end
0 commit comments