Class: SPARQL::Algebra::Operator::Sequence
- Inherits:
-
SPARQL::Algebra::Operator
- Object
- SPARQL::Algebra::Operator
- SPARQL::Algebra::Operator::Sequence
- Includes:
- Update
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/sequence.rb
Overview
The SPARQL UPDATE sequence
operator.
Sequences through each operand.
[103] CollectionPath ::= '(' GraphNodePath+ ')'
Constant Summary collapse
- NAME =
:sequence
Constants inherited from SPARQL::Algebra::Operator
Constants included from Expression
Constants included from RDF::Util::Logger
Instance Attribute Summary
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
-
#execute(queryable, **options) {|solution| ... } ⇒ Object
Basically a JOIN across multiple operands.
-
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
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, #mergable?, #ndvars, #node?, #operand, #optimize, #optimize!, #parent, #parent=, #prefixes, prefixes, prefixes=, #rewrite, #to_binary, to_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars
Methods included from 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(queryable, **options) {|solution| ... } ⇒ Object
Basically a JOIN across multiple operands
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/sequence.rb', line 31 def execute(queryable, **, &block) debug() {"Sequence #{operands.to_sse}"} last = queryable.query(operands.shift, **.merge(depth: [:depth].to_i + 1)) debug() {"(sequence)=>(last) #{last.map(&:to_h).to_sse}"} operands.each do |op| this = queryable.query(op, **.merge(depth: [:depth].to_i + 1)) debug() {"(sequence)=>(this) #{this.map(&:to_h).to_sse}"} last = last.map do |s1| this.map do |s2| s2.merge(s1) if s2.compatible?(s1) end end.flatten.compact debug() {"(sequence)=>(next) #{last.map(&:to_h).to_sse}"} end @solutions = RDF::Query::Solutions.new(last) debug() {"(sequence)=> #{@solutions.map(&:to_h).to_sse}"} @solutions.each(&block) if block_given? @solutions end |
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
60 61 62 63 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/sequence.rb', line 60 def to_sparql(**) str = "{\n" + operands.to_sparql(top_level: false, **) + "\n}" Operator.to_sparql(str, **) end |