Module: SPARQL::Algebra::Update Abstract

Overview

This module is abstract.

A SPARQL algebra Update can make modifications to it's dataset

Mixin with SPARQL::Algebra::Operator to provide update-like operations on graphs

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Determine if this is an empty query, having no operands

Returns:

  • (Boolean)


29
30
31
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/sparql-aabed0511f97/lib/sparql/algebra/update.rb', line 29

def empty?
  self.operands.empty?
end

#execute(queryable, **options, &block) ⇒ RDF::Writable

Executes this upate on the given queryable graph or repository.

Parameters:

Options Hash (**options):

  • debug (Boolean)

    Query execution debugging

Returns:

Raises:

  • (NotImplementedError)

    If an attempt is made to perform an unsupported operation

See Also:



47
48
49
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/sparql-aabed0511f97/lib/sparql/algebra/update.rb', line 47

def execute(queryable, **options, &block)
  raise NotImplementedError, "#{self.class}#execute(#{queryable})"
end

#graph_name=(value) ⇒ RDF::URI, RDF::Query::Variable

Add graph_name to sub-items, unless they already have a graph_name

Parameters:

Returns:



54
55
56
57
58
59
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/sparql-aabed0511f97/lib/sparql/algebra/update.rb', line 54

def graph_name=(value)
  operands.each do |operand|
    operand.graph_name = value if operand.respond_to?(:graph_name) && operand.graph_name != false
  end
  value
end

#unshift(query)

This method returns an undefined value.

Prepends an operator.

Parameters:



15
16
17
18
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/sparql-aabed0511f97/lib/sparql/algebra/update.rb', line 15

def unshift(query)
  @operands.unshift(query)
  self
end

#variablesHash{Symbol => RDF::Query::Variable}

The variables used in this update.



24
25
26
# File 'vendor/bundler/ruby/3.4.0/bundler/gems/sparql-aabed0511f97/lib/sparql/algebra/update.rb', line 24

def variables
  operands.inject({}) {|hash, o| o.executable? ? hash.merge(o.variables) : hash}
end