Sha256: f0f91e04600aa08b5e528e0f5b3db0379ceab1ebf24f8b1255e8c65788572291

Contents?: true

Size: 1011 Bytes

Versions: 8

Compression:

Stored size: 1011 Bytes

Contents

module SPARQL; module Algebra
  class Operator
    ##
    # The SPARQL descending sort operator.
    #
    # [24]  OrderCondition          ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var )
    #
    # @example SPARQL Grammar
    #   PREFIX foaf:    <http://xmlns.com/foaf/0.1/>
    #   SELECT ?name
    #   WHERE { ?x foaf:name ?name }
    #   ORDER BY DESC(?name)
    #
    # @example SSE
    #   (prefix ((foaf: <http://xmlns.com/foaf/0.1/>))
    #     (project (?name)
    #       (order ((desc ?name))
    #         (bgp (triple ?x foaf:name ?name)))))
    #
    # @see https://www.w3.org/TR/sparql11-query/#modOrderBy
    class Desc < Operator::Asc
      NAME = :desc

      ##
      #
      # Returns a partial SPARQL grammar for this operator.
      #
      # Provides order to descendant query.
      #
      # @return [String]
      def to_sparql(**options)
        "DESC(#{operands.last.to_sparql(**options)})"
      end
    end # Desc
  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/desc.rb
sparql-3.3.0 lib/sparql/algebra/operator/desc.rb
sparql-3.2.6 lib/sparql/algebra/operator/desc.rb
sparql-3.2.5 lib/sparql/algebra/operator/desc.rb
sparql-3.2.4 lib/sparql/algebra/operator/desc.rb
sparql-3.2.3 lib/sparql/algebra/operator/desc.rb
sparql-3.2.1 lib/sparql/algebra/operator/desc.rb
sparql-3.2.0 lib/sparql/algebra/operator/desc.rb