Class: SPARQL::Algebra::Operator::Bound
- Inherits:
-
Unary
- Object
- SPARQL::Algebra::Operator
- Unary
- SPARQL::Algebra::Operator::Bound
- Defined in:
- lib/sparql/algebra/operator/bound.rb
Overview
The SPARQL bound operator.
Constant Summary
- NAME =
:bound
Constants inherited from Unary
Instance Method Summary (collapse)
-
- (RDF::Literal::Boolean) evaluate(solution)
Returns
trueif the operand is a variable that is bound to a value in the givensolution,falseotherwise.
Methods inherited from Unary
Methods inherited from SPARQL::Algebra::Operator
#boolean, #constant?, evaluate, #initialize, #operand, #to_sse, #variable?
Constructor Details
This class inherits a constructor from SPARQL::Algebra::Operator::Unary
Instance Method Details
- (RDF::Literal::Boolean) evaluate(solution)
Returns true if the operand is a variable that is bound to a
value in the given solution, false otherwise.
17 18 19 20 21 22 23 |
# File 'lib/sparql/algebra/operator/bound.rb', line 17 def evaluate(solution) case var = operands.first when RDF::Query::Variable, Symbol RDF::Literal(solution.bound?(var)) else raise TypeError, "expected an RDF::Query::Variable, but got #{var.inspect}" end end |