class SPARQL::Algebra::Operator::Prefix

The SPARQL GraphPattern `prefix` operator.

@example

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

@see www.w3.org/TR/sparql11-query/#QSynIRI

Constants

NAME

Public Instance Methods

execute(queryable, **options, &block) click to toggle source

Executes this query on the given `queryable` graph or repository. Really a pass-through, as this is a syntactic object used for providing graph_name for URIs.

@param [RDF::Queryable] queryable

the graph or repository to query

@param [Hash{Symbol => Object}] options

any additional keyword options

@yield [solution]

each matching solution, statement or boolean

@yieldparam [RDF::Statement, RDF::Query::Solution, Boolean] solution @yieldreturn [void] ignored @return [RDF::Query::Solutions]

the resulting solution sequence

@see www.w3.org/TR/sparql11-query/#sparqlAlgebra

# File lib/sparql/algebra/operator/prefix.rb, line 33
def execute(queryable, **options, &block)
  debug(options) {"Prefix"}
  @solutions = queryable.query(operands.last, depth: options[:depth].to_i + 1, **options, &block)
end
merge!(other) click to toggle source

Combine two prefix definitions, merging their definitions @param [Prefix] other @return [Prefix] self

# File lib/sparql/algebra/operator/prefix.rb, line 52
def merge!(other)
  operands[0] += other.operands[0]
  self
end
optimize(**options) click to toggle source

Returns an optimized version of this query.

Replace with the query with URIs having their lexical shortcut removed

@return [Prefix] a copy of `self` @see SPARQL::Algebra::Expression#optimize

# File lib/sparql/algebra/operator/prefix.rb, line 45
def optimize(**options)
  operands.last.optimize(**options)
end
query_yields_boolean?() click to toggle source

Query results in a boolean result (e.g., ASK) @return [Boolean]

# File lib/sparql/algebra/operator/prefix.rb, line 59
def query_yields_boolean?
  operands.last.query_yields_boolean?
end
query_yields_statements?() click to toggle source

Query results statements (e.g., CONSTRUCT, DESCRIBE, CREATE) @return [Boolean]

# File lib/sparql/algebra/operator/prefix.rb, line 65
def query_yields_statements?
  operands.last.query_yields_statements?
end