Sha256: e3e140592cf2f3886c73316c6f21899500bff866096e6908ace0dbec82624c30
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
module LD::Patch::Algebra ## # The LD Patch `patch` operator. # # Transactionally iterates over all operands building bindings along the way class Patch < SPARQL::Algebra::Operator include SPARQL::Algebra::Update NAME = :patch ## # Executes this upate on the given `writable` graph or repository. # # @param [RDF::Queryable] queryable # the graph or repository to write # @param [Hash{Symbol => Object}] options # any additional options # @return [RDF::Queryable] # Returns queryable. # @raise [Error] # If any error is caught along the way, and rolls back the transaction def execute(queryable, options = {}) debug(options) {"Delete"} # FIXME: due to insufficient transaction support, this is implemented by running through operands twice: the first using a clone of the graph, and the second acting on the graph directly graph = RDF::Graph.new << queryable loop do operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op| # Invoke operand using bindings from prvious operation op.execute(graph, options.merge(bindings: bindings)) end break if graph.equal?(queryable) graph = queryable end queryable end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ld-patch-0.2.0 | lib/ld/patch/algebra/patch.rb |
ld-patch-0.1.1 | lib/ld/patch/algebra/patch.rb |
ld-patch-0.1.0 | lib/ld/patch/algebra/patch.rb |