Sha256: aed3ea5815f43d9736a3e8324f56e314027ae1cd13e9e94ca2c5f4e54a334091

Contents?: true

Size: 1.36 KB

Versions: 7

Compression:

Stored size: 1.36 KB

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL GraphPattern `prefix` operator.
    #
    # @example
    #   (update
    #     (modify
    #       (bgp (triple ?s ?p ?o))
    #       (insert ((triple ?s ?p "q")))))
    #
    # @see https://www.w3.org/TR/sparql11-update/#graphUpdate
    class Update < Operator
      include SPARQL::Algebra::Update
      
      NAME = [:update]

      ##
      # Executes this upate on the given `queryable` graph or repository.
      #
      # @param  [RDF::Queryable] queryable
      #   the graph or repository to write
      # @param  [Hash{Symbol => Object}] options
      #   any additional keyword options
      # @option options [Boolean] debug
      #   Query execution debugging
      # @return [RDF::Queryable]
      #   Returns the dataset.
      # @raise [NotImplementedError]
      #   If an attempt is made to perform an unsupported operation
      # @raise [IOError]
      #   If `queryable` is immutable
      # @see    https://www.w3.org/TR/sparql11-update/
      def execute(queryable, **options)
        debug(options) {"Update"}
        raise IOError, "queryable is not mutable" unless queryable.mutable?
        operands.each do |op|
          op.execute(queryable, depth: options[:depth].to_i + 1, **options)
        end
        queryable
      end
    end # Update
  end # Operator
end; end # SPARQL::Algebra

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sparql-3.1.8 lib/sparql/algebra/operator/update.rb
sparql-3.1.7 lib/sparql/algebra/operator/update.rb
sparql-3.1.6 lib/sparql/algebra/operator/update.rb
sparql-3.1.5 lib/sparql/algebra/operator/update.rb
sparql-3.1.4 lib/sparql/algebra/operator/update.rb
sparql-3.1.3 lib/sparql/algebra/operator/update.rb
sparql-3.1.2 lib/sparql/algebra/operator/update.rb