Skip to content

Commit a8cc5e6

Browse files
committed
Don't use a transaction on a mutable/graph which doesn't support transactions.
1 parent 13c5519 commit a8cc5e6

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- 2.5
2424
- 2.6
2525
- 2.7
26+
#- 3.0 # Commented out until net-http-persistent is updaated
2627
#- ruby-head # Commented out until net-http-persistent is updaated
2728
- jruby
2829
steps:

lib/ld/patch/algebra/patch.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ class Patch < SPARQL::Algebra::Operator
2323
def execute(graph, options = {})
2424
debug(options) {"Delete"}
2525

26-
graph.transaction(mutable: true) do |tx|
26+
if graph.respond_to?(:transaction)
27+
graph.transaction(mutable: true) do |tx|
28+
operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op|
29+
# Invoke operand using bindings from prvious operation
30+
op.execute(tx, options.merge(bindings: bindings))
31+
end
32+
end
33+
else
2734
operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op|
2835
# Invoke operand using bindings from prvious operation
29-
op.execute(tx, options.merge(bindings: bindings))
36+
op.execute(graph, options.merge(bindings: bindings))
3037
end
3138
end
3239
end

0 commit comments

Comments
 (0)