Class: SPARQL::Algebra::Operator::Drop
- Inherits:
-
SPARQL::Algebra::Operator
- Object
- SPARQL::Algebra::Operator
- SPARQL::Algebra::Operator::Drop
- Includes:
- Update
- Defined in:
- vendor/bundler/ruby/2.7.0/bundler/gems/sparql-881ac01048a7/lib/sparql/algebra/operator/drop.rb
Overview
The SPARQL UPDATE drop
operator.
The DROP operation removes the specified graph(s) from the Graph Store
Equivalent to clear
in this implementation
Constant Summary collapse
- NAME =
[:drop]
Constants inherited from SPARQL::Algebra::Operator
Instance Attribute Summary
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
-
#execute(queryable, **options) ⇒ RDF::Queryable
Executes this upate on the given
writable
graph or repository.
Methods included from 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_sxp, #to_sxp_bin, #validate!, #variable?, #vars
Methods included from Expression
cast, #constant?, #evaluate, extension, extensions, for, #invalid?, new, #node?, open, #optimize, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?
Constructor Details
This class inherits a constructor from SPARQL::Algebra::Operator
Instance Method Details
#execute(queryable, **options) ⇒ RDF::Queryable
Executes this upate on the given writable
graph or repository.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/sparql-881ac01048a7/lib/sparql/algebra/operator/drop.rb', line 34 def execute(queryable, **) debug() {"Drop"} silent = operands.first == :silent silent = operands.first == :silent operands.shift if silent raise ArgumentError, "drop expected operand to be 'default', 'named', 'all', or an IRI" unless operands.length == 1 case operands.last when :default queryable.each_graph do |g| g.clear! unless g.graph_name end when :named queryable.each_graph do |g| g.clear! if g.graph_name end when :all queryable.clear! when RDF::URI if g = queryable.each_graph.detect {|c| c.graph_name == operands.last} g.clear! else raise IOError, "drop operation graph does not exist" unless silent end else raise ArgumentError, "drop expected operand to be 'default', 'named', 'all', or an IRI" end queryable end |