Class: SPARQL::Algebra::Operator::IsLiteral
- Inherits:
-
Unary
- Object
- SPARQL::Algebra::Operator
- Unary
- SPARQL::Algebra::Operator::IsLiteral
- Defined in:
- lib/sparql/algebra/operator/is_literal.rb
Overview
The SPARQL isLiteral operator.
Constant Summary
- NAME =
:isLiteral
Constants inherited from Unary
Instance Method Summary (collapse)
-
- (RDF::Literal::Boolean) evaluate(solution)
Returns
trueif the operand is anRDF::Literal,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 an RDF::Literal, false
otherwise.
17 18 19 20 21 22 23 |
# File 'lib/sparql/algebra/operator/is_literal.rb', line 17 def evaluate(solution) case term = operand(0, solution) when RDF::Literal then RDF::Literal::TRUE when RDF::Term then RDF::Literal::FALSE else raise TypeError, "expected an RDF::Term, but got #{term.inspect}" end end |