Class: SPARQL::Algebra::Operator::Plus
- Inherits:
-
Unary
- Object
- SPARQL::Algebra::Operator
- Unary
- SPARQL::Algebra::Operator::Plus
- Defined in:
- lib/sparql/algebra/operator/plus.rb
Overview
The SPARQL numeric unary + operator.
Constant Summary
- NAME =
:+
Constants inherited from Unary
Instance Method Summary (collapse)
-
- (RDF::Literal::Numeric) evaluate(solution)
Returns the operand incremented by one.
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::Numeric) evaluate(solution)
Returns the operand incremented by one.
16 17 18 19 20 21 22 |
# File 'lib/sparql/algebra/operator/plus.rb', line 16 def evaluate(solution) case term = operand(0, solution) when RDF::Literal::Numeric, Numeric RDF::Literal(term + 1) else raise TypeError, "expected an RDF::Literal::Numeric, but got #{term.inspect}" end end |