Sha256: f36c3327e70fd16093db01c810fbfae371d0805e7c6552f23be3d735893c638a

Contents?: true

Size: 1.56 KB

Versions: 8

Compression:

Stored size: 1.56 KB

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL relational `>=` (greater than or 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/xpath-functions/#func-compare
    # @see https://www.w3.org/TR/xpath-functions/#func-numeric-greater-than
    # @see https://www.w3.org/TR/xpath-functions/#func-boolean-greater-than
    # @see https://www.w3.org/TR/xpath-functions/#func-dateTime-greater-than
    class GreaterThanOrEqual < Compare
      NAME = :>=

      ##
      # Returns `true` if the first operand is greater than or equal to the
      # second operand; returns `false` otherwise.
      #
      # @param  [RDF::Literal] left
      #   a literal
      # @param  [RDF::Literal] right
      #   a literal
      # @return [RDF::Literal::Boolean] `true` or `false`
      # @raise  [TypeError] if either operand is not a literal
      def apply(left, right, **options)
        RDF::Literal(super >= RDF::Literal(0))
      end
    end # GreaterThanOrEqual
  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/greater_than_or_equal.rb
sparql-3.3.0 lib/sparql/algebra/operator/greater_than_or_equal.rb
sparql-3.2.6 lib/sparql/algebra/operator/greater_than_or_equal.rb
sparql-3.2.5 lib/sparql/algebra/operator/greater_than_or_equal.rb
sparql-3.2.4 lib/sparql/algebra/operator/greater_than_or_equal.rb
sparql-3.2.3 lib/sparql/algebra/operator/greater_than_or_equal.rb
sparql-3.2.1 lib/sparql/algebra/operator/greater_than_or_equal.rb
sparql-3.2.0 lib/sparql/algebra/operator/greater_than_or_equal.rb