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
.
571 572 573 574 |
# File 'lib/sparql/algebra/extensions.rb', line 571 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
581 582 583 |
# File 'lib/sparql/algebra/extensions.rb', line 581 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
592 593 594 |
# File 'lib/sparql/algebra/extensions.rb', line 592 def to_sparql(**) self.distinguished? ? super : "_:_nd#{self.name}" end |