Sha256: 10f26e809d085761cfa4ff8eba005a2791d8bbbcf0dece8e4784a1385af49d07

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL relational `!=` (not equal) comparison operator.
    #
    # [114] RelationalExpression    ::= NumericExpression ('!=' NumericExpression)?
    #
    # @example SPARQL Grammar
    #   PREFIX  xsd: <http://www.w3.org/2001/XMLSchema#>
    #   PREFIX  : <http://example.org/things#>
    #   SELECT  ?x
    #   WHERE { ?x :p ?v . FILTER ( ?v != 1 ) }
    #
    # @example SSE
    #   (prefix
    #    ((xsd: <http://www.w3.org/2001/XMLSchema#>) (: <http://example.org/things#>))
    #    (project (?x) (filter (!= ?v 1) (bgp (triple ?x :p ?v)))))
    #
    # @see https://www.w3.org/TR/sparql11-query/#OperatorMapping
    # @see https://www.w3.org/TR/sparql11-query/#func-RDFterm-equal
    class NotEqual < Equal
      NAME = :'!='

      ##
      # Returns `true` if the operands are not equal; returns `false`
      # otherwise.
      #
      # Comparing unknown datatypes might have different lexical forms but be the same value.
      #
      # @param  [RDF::Term] term1
      #   an RDF term
      # @param  [RDF::Term] term2
      #   an RDF term
      # @return [RDF::Literal::Boolean] `true` or `false`
      # @raise  [TypeError] if either operand is not an RDF term
      def apply(term1, term2, **options)
        RDF::Literal(super.false?)
      end
    end # NotEqual
  end # Operator
end; end # SPARQL::Algebra

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sparql-3.3.1 lib/sparql/algebra/operator/not_equal.rb
sparql-3.3.0 lib/sparql/algebra/operator/not_equal.rb
sparql-3.2.6 lib/sparql/algebra/operator/not_equal.rb
sparql-3.2.5 lib/sparql/algebra/operator/not_equal.rb
sparql-3.2.4 lib/sparql/algebra/operator/not_equal.rb
sparql-3.2.3 lib/sparql/algebra/operator/not_equal.rb
sparql-3.2.1 lib/sparql/algebra/operator/not_equal.rb
sparql-3.2.0 lib/sparql/algebra/operator/not_equal.rb