Class: LD::Patch::Algebra::Prefix

Inherits:
SPARQL::Algebra::Operator::Binary show all
Includes:
SPARQL::Algebra::Update
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/prefix.rb

Overview

The LD Patch prefix operator.

Examples:

(prefix ((: <http://example/>))
  (graph ?g
    (bgp (triple ?s ?p ?o))))

See Also:

Constant Summary collapse

NAME =
:prefix

Constants inherited from SPARQL::Algebra::Operator::Binary

SPARQL::Algebra::Operator::Binary::ARITY

Constants inherited from SPARQL::Algebra::Operator

SPARQL::Algebra::Operator::ARITY, SPARQL::Algebra::Operator::IsURI, SPARQL::Algebra::Operator::URI

Constants included from SPARQL::Algebra::Expression

SPARQL::Algebra::Expression::PATTERN_PARENTS

Constants included from RDF::Util::Logger

RDF::Util::Logger::IOWrapper

Instance Attribute Summary

Attributes inherited from SPARQL::Algebra::Operator

#operands

Instance Method Summary collapse

Methods included from SPARQL::Algebra::Update

#graph_name=, #unshift, #variables

Methods inherited from SPARQL::Algebra::Operator::Binary

#initialize

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_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars

Methods included from SPARQL::Algebra::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::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 URIs.

Parameters:

  • queryable (RDF::Queryable)

    the graph or repository to query

  • options (Hash{Symbol => Object}) (defaults to: {})

    any additional keyword options

Yields:

  • (solution)

    each matching solution, statement or boolean

Yield Parameters:

Yield Returns:

  • (void)

    ignored

Returns:

See Also:



32
33
34
35
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/prefix.rb', line 32

def execute(queryable, options = {}, &block)
  debug(options) {"Prefix"}
  @solutions = queryable.query(operands.last, **options.merge(depth: options[:depth].to_i + 1), &block)
end

#optimizeUnion, RDF::Query

Returns an optimized version of this query.

If optimize operands, and if the first two operands are both Queries, replace with the unique sum of the query elements

Returns:



44
45
46
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/prefix.rb', line 44

def optimize
  operands.last.optimize
end