Class: SPARQL::Algebra::Operator::Base
- Inherits:
-
Binary
- Object
- SPARQL::Algebra::Operator
- Binary
- SPARQL::Algebra::Operator::Base
- Includes:
- Query
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/base.rb
Overview
The SPARQL GraphPattern base
operator.
[5] BaseDecl ::= 'BASE' IRIREF
Constant Summary collapse
- NAME =
[:base]
Constants inherited from Binary
SPARQL::Algebra::Operator::Binary::ARITY
Constants inherited from SPARQL::Algebra::Operator
Constants included from Expression
Constants included from RDF::Util::Logger
Instance Attribute Summary
Attributes included from Query
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
-
#execute(queryable, **options) {|solution| ... } ⇒ RDF::Queryable, RDF::Query::Solutions
Executes this query on the given
queryable
graph or repository. -
#optimize(**options) ⇒ Base
Return optimized query.
-
#query_yields_boolean? ⇒ Boolean
Query results in a boolean result (e.g., ASK).
-
#query_yields_statements? ⇒ Boolean
Query results statements (e.g., CONSTRUCT, DESCRIBE, CREATE).
-
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this term.
Methods included from Query
#each_solution, #empty?, #failed?, #graph_name=, #matched?, #query_yields_solutions?, #unshift, #variables
Methods inherited from Binary
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!, #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!, 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::Binary
Instance Method Details
#execute(queryable, **options) {|solution| ... } ⇒ RDF::Queryable, RDF::Query::Solutions
Executes this query on the given queryable
graph or repository.
Really a pass-through, as this is a syntactic object used for providing
context for relative URIs.
38 39 40 41 42 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/base.rb', line 38 def execute(queryable, **, &block) debug() {"Base #{operands.first}"} Operator.base_uri = operands.first queryable.query(operands.last, **.merge(depth: [:depth].to_i + 1), &block) end |
#optimize(**options) ⇒ Base
Return optimized query
49 50 51 52 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/base.rb', line 49 def optimize(**) Operator.base_uri = operands.first operands.last.optimize(**) end |
#query_yields_boolean? ⇒ Boolean
Query results in a boolean result (e.g., ASK)
56 57 58 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/base.rb', line 56 def query_yields_boolean? operands.last.query_yields_boolean? end |
#query_yields_statements? ⇒ Boolean
Query results statements (e.g., CONSTRUCT, DESCRIBE, CREATE)
62 63 64 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/base.rb', line 62 def query_yields_statements? operands.last.query_yields_statements? end |
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this term.
71 72 73 74 75 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/base.rb', line 71 def to_sparql(**) str = "BASE #{operands.first.to_sparql}\n" str << operands.last.to_sparql(base_uri: operands.first, **) end |