Class: SPARQL::Algebra::Operator::Bound
- Inherits:
-
Unary
- Object
- SPARQL::Algebra::Operator
- Unary
- SPARQL::Algebra::Operator::Bound
- Includes:
- Evaluatable
- Defined in:
- lib/sparql/algebra/operator/bound.rb
Overview
The SPARQL bound operator.
Constant Summary
- NAME =
:bound
Constants inherited from Unary
Constants inherited from SPARQL::Algebra::Operator
Instance Attribute Summary
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary (collapse)
-
- (RDF::Literal::Boolean) evaluate(bindings = {})
Returns
trueif the operand is a variable that is bound to a value in the givenbindings,falseotherwise. -
- (Bound) initialize(var, options = {})
constructor
Initializes a new operator instance.
Methods included from Evaluatable
Methods inherited from SPARQL::Algebra::Operator
arity, base_uri, #base_uri, base_uri=, #boolean, #constant?, #eql?, #evaluatable?, evaluate, #executable?, for, #inspect, #operand, #optimize, prefixes, #prefixes, prefixes=, #to_sse, #to_sxp, #variable?
Methods included from Expression
cast, #constant?, for, new, open, #optimize, parse, #to_sse, #variable?
Constructor Details
- (Bound) initialize(var, options = {})
Initializes a new operator instance.
28 29 30 |
# File 'lib/sparql/algebra/operator/bound.rb', line 28 def initialize(var, = {}) super end |
Instance Method Details
- (RDF::Literal::Boolean) evaluate(bindings = {})
Returns true if the operand is a variable that is bound to a
value in the given bindings, false otherwise.
39 40 41 42 43 44 45 |
# File 'lib/sparql/algebra/operator/bound.rb', line 39 def evaluate(bindings = {}) case var = operand when Variable operand.evaluate(bindings) ? RDF::Literal::TRUE : RDF::Literal::FALSE else raise TypeError, "expected an RDF::Query::Variable, but got #{var.inspect}" end end |