Class: LD::Patch::Algebra::Patch

Inherits:
SPARQL::Algebra::Operator show all
Includes:
SPARQL::Algebra::Update
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/patch.rb

Overview

The LD Patch patch operator.

Transactionally iterates over all operands building bindings along the way

Constant Summary collapse

NAME =
:patch

Constants inherited from SPARQL::Algebra::Operator

SPARQL::Algebra::Operator::ARITY, SPARQL::Algebra::Operator::IsURI, SPARQL::Algebra::Operator::URI

Constants included from SPARQL::Algebra::Expression

SPARQL::Algebra::Expression::PATTERN_PARENTS

Constants included from RDF::Util::Logger

RDF::Util::Logger::IOWrapper

Instance Attribute Summary

Attributes inherited from SPARQL::Algebra::Operator

#operands

Instance Method Summary collapse

Methods included from SPARQL::Algebra::Update

#graph_name=, #unshift, #variables

Methods inherited from SPARQL::Algebra::Operator

#aggregate?, arity, base_uri, #base_uri, base_uri=, #bind, #boolean, #constant?, #deep_dup, #each_descendant, #eql?, #evaluatable?, evaluate, #executable?, #first_ancestor, for, #formulae, #initialize, #inspect, #ndvars, #node?, #operand, #optimize, #optimize!, #parent, #parent=, prefixes, #prefixes, prefixes=, #rewrite, #to_binary, #to_sparql, to_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars

Methods included from SPARQL::Algebra::Expression

cast, #constant?, #evaluate, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?

Methods included from RDF::Util::Logger

#log_debug, #log_depth, #log_error, #log_fatal, #log_info, #log_recover, #log_recovering?, #log_statistics, #log_warn, #logger

Constructor Details

This class inherits a constructor from SPARQL::Algebra::Operator

Instance Method Details

#execute(graph, options = {}) ⇒ RDF::Transactable

Executes this upate on the given transactable graph or repository.

Parameters:

Returns:

Raises:

  • (Error)

    If any error is caught along the way, and rolls back the transaction



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/patch.rb', line 23

def execute(graph, options = {})
  debug(options) {"Delete"}

  if graph.respond_to?(:transaction)
    graph.transaction(mutable: true) do |tx|
      operands.inject(RDF::Query::Solutions.new([RDF::Query::Solution.new])) do |bindings, op|
        # Invoke operand using bindings from prvious operation
        op.execute(tx, options.merge(bindings: bindings))
      end
    end
  else
    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
  end
end