class SPARQL::Algebra::Operator::Abs
The SPARQL
logical `abs` operator.
@example
(abs ?x)
@see www.w3.org/TR/sparql11-query/#func-abs @see www.w3.org/TR/xpath-functions/#func-abs
Constants
- NAME
Public Instance Methods
apply(operand, **options)
click to toggle source
Returns the absolute value of `arg`. An error is raised if `arg` is not a numeric value.
@param [RDF::Literal] operand
the operand
@return [RDF::Literal] literal of same type @raise [TypeError] if the operand is not a numeric value
# File lib/sparql/algebra/operator/abs.rb, line 23 def apply(operand, **options) case operand when RDF::Literal::Numeric then operand.abs else raise TypeError, "expected an RDF::Literal::Numeric, but got #{operand.inspect}" end end