Class: RDF::Query::Variable
- Includes:
- SPARQL::Algebra::Expression
- Defined in:
- lib/sparql/algebra/extensions.rb
Overview
Extensions for RDF::Query::Variable
.
Constant Summary
Constants included from SPARQL::Algebra::Expression
SPARQL::Algebra::Expression::PATTERN_PARENTS
Instance Method Summary collapse
-
#evaluate(bindings, **options) ⇒ RDF::Term
Returns the value of this variable in the given
bindings
. -
#optimize(**options) ⇒ RDF::Query::Variable
Return self.
-
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this term.
Methods included from SPARQL::Algebra::Expression
cast, #constant?, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?
Instance Method Details
#evaluate(bindings, **options) ⇒ RDF::Term
Returns the value of this variable in the given bindings
.
598 599 600 601 |
# File 'lib/sparql/algebra/extensions.rb', line 598 def evaluate(bindings, **) raise TypeError if bindings.respond_to?(:bound?) && !bindings.bound?(self) bindings[name.to_sym] end |
#optimize(**options) ⇒ RDF::Query::Variable
Return self
608 609 610 |
# File 'lib/sparql/algebra/extensions.rb', line 608 def optimize(**) self end |
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this term.
The Non-distinguished form (??xxx
) is not part of the grammar, so replace with a blank-node
619 620 621 |
# File 'lib/sparql/algebra/extensions.rb', line 619 def to_sparql(**) self.distinguished? ? super : "_:_nd#{self.name}" end |