class SPARQL::Algebra::Operator::Negate
The SPARQL
numeric unary `-` (negation) operator.
@example
(- ?x) (negate ?x)
@see www.w3.org/TR/xpath-functions/#func-numeric-unary-minus
Constants
- NAME
Public Instance Methods
apply(term, **options)
click to toggle source
Returns the operand with its sign reversed.
@param [RDF::Literal::Numeric] term
a numeric literal
@return [RDF::Literal::Numeric] @raise [TypeError] if the operand is not a numeric literal
# File lib/sparql/algebra/operator/negate.rb, line 23 def apply(term, **options) case term when RDF::Literal::Numeric then -term else raise TypeError, "expected an RDF::Literal::Numeric, but got #{term.inspect}" end end