Sha256: 047bf0addf7b9d64120170f9a25112fbd73c2e3d5bac1f3a91b530d812488b49

Contents?: true

Size: 936 Bytes

Versions: 28

Compression:

Stored size: 936 Bytes

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL logical `not` operator.
    #
    # @example
    #   (! ?x)
    #   (not ?x)
    #
    # @see http://www.w3.org/TR/xpath-functions/#func-not
    class Not < Operator::Unary
      include Evaluatable

      NAME = [:'!', :not]

      ##
      # 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
      def apply(operand)
        case bool = boolean(operand)
          when RDF::Literal::Boolean
            RDF::Literal(bool.false?)
          else super
        end
      end
    end # Not
  end # Operator
end; end # SPARQL::Algebra

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sparql-3.1.0 lib/sparql/algebra/operator/not.rb
sparql-3.0.2 lib/sparql/algebra/operator/not.rb
sparql-3.0.1 lib/sparql/algebra/operator/not.rb
sparql-3.0.0 lib/sparql/algebra/operator/not.rb
sparql-2.2.2 lib/sparql/algebra/operator/not.rb
sparql-2.2.1 lib/sparql/algebra/operator/not.rb
sparql-2.2.0 lib/sparql/algebra/operator/not.rb
sparql-2.1.0 lib/sparql/algebra/operator/not.rb
sparql-2.0.0 lib/sparql/algebra/operator/not.rb
sparql-2.0.0.beta2 lib/sparql/algebra/operator/not.rb
sparql-1.99.1 lib/sparql/algebra/operator/not.rb
sparql-2.0.0.beta1 lib/sparql/algebra/operator/not.rb
sparql-1.1.9.1 lib/sparql/algebra/operator/not.rb
sparql-1.99.0 lib/sparql/algebra/operator/not.rb
sparql-1.1.9 lib/sparql/algebra/operator/not.rb
sparql-1.1.8 lib/sparql/algebra/operator/not.rb
sparql-1.1.7 lib/sparql/algebra/operator/not.rb
sparql-1.1.6 lib/sparql/algebra/operator/not.rb
sparql-1.1.5 lib/sparql/algebra/operator/not.rb
sparql-1.1.4 lib/sparql/algebra/operator/not.rb