Skip to content

Commit 4099c7d

Browse files
committed
Use Transactable Graph instead of Repository again.
1 parent f755979 commit 4099c7d

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

lib/ld/patch/algebra/patch.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ class Patch < SPARQL::Algebra::Operator
1010
NAME = :patch
1111

1212
##
13-
# Executes this upate on the given `repository`.
13+
# Executes this upate on the given `transactable` graph or repository.
1414
#
15-
# @param [RDF::Repository] repository
16-
# the repository to update.
15+
# @param [RDF::Transactable] graph
16+
# the graph to update.
1717
# @param [Hash{Symbol => Object}] options
1818
# any additional options
19-
# @return [RDF::Repository]
20-
# Returns repository.
19+
# @return [RDF::Transactable]
20+
# Returns graph.
2121
# @raise [Error]
2222
# If any error is caught along the way, and rolls back the transaction
23-
def execute(repository, options = {})
23+
def execute(graph, options = {})
2424
debug(options) {"Delete"}
2525

26-
repository.transaction(mutable: true) do |tx|
26+
graph.transaction(mutable: true) do |tx|
2727
operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op|
2828
# Invoke operand using bindings from prvious operation
2929
op.execute(tx, options.merge(bindings: bindings))

spec/algebra_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@
418418
},
419419
}.each do |name, props|
420420
it name do
421-
graph = RDF::Repository.new << RDF::NTriples::Reader.new(props[:data])
421+
graph = RDF::Graph.new << RDF::NTriples::Reader.new(props[:data])
422422
operator = LD::Patch::Parser.new(props[:patch]).parse
423-
result = RDF::Repository.new << RDF::NTriples::Reader.new(props[:result])
423+
result = RDF::Graph.new << RDF::NTriples::Reader.new(props[:result])
424424
operator.execute(graph)
425425
expect(graph).to be_equivalent_graph(result)
426426
end
@@ -469,7 +469,7 @@
469469
},
470470
}.each do |name, props|
471471
it name do
472-
graph = RDF::Repository.new << RDF::NTriples::Reader.new(props[:data])
472+
graph = RDF::Graph.new << RDF::NTriples::Reader.new(props[:data])
473473
operator = LD::Patch::Parser.new(props[:patch]).parse
474474
expect {operator.execute(graph)}.to raise_error(LD::Patch::Error)
475475
end

spec/suite_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ def data
150150
end
151151

152152
def target_graph
153-
@graph ||= RDF::Repository.load(URI.decode(data), base_uri: base)
153+
@graph ||= RDF::Graph.load(URI.decode(data), base_uri: base)
154154
end
155155

156156
def expected
157157
@expected ||= RDF::Util::File.open_file(URI.decode(result)) {|f| f.read}
158158
end
159159

160160
def expected_graph
161-
@expected_graph ||= RDF::Repository.load(URI.decode(result), base_uri: base)
161+
@expected_graph ||= RDF::Graph.load(URI.decode(result), base_uri: base)
162162
end
163163

164164
def evaluate?

0 commit comments

Comments
 (0)