class SPARQL::Algebra::Operator::Not

The SPARQL logical `not` operator.

@example

(! ?x)
(not ?x)

@see www.w3.org/TR/xpath-functions/#func-not

Constants

NAME

Public Instance Methods

apply(operand, **options) click to toggle source

Returns the logical `NOT` (inverse) of the operand.

Note that this operator operates on the effective boolean value (EBV) of its operand.

@param [RDF::Literal::Boolean] operand

the operand

@return [RDF::Literal::Boolean] `true` or `false` @raise [TypeError] if the operand could not be coerced to a boolean literal

Calls superclass method SPARQL::Algebra::Evaluatable#apply
# File lib/sparql/algebra/operator/not.rb, line 26
def apply(operand, **options)
  case bool = boolean(operand)
    when RDF::Literal::Boolean
      RDF::Literal(bool.false?)
    else super
  end
end