class SPARQL::Algebra::Operator::Count

The SPARQL `count` set function.

@example

(prefix ((: <http://www.example.org>))
  (project (?C)
    (extend ((?C ??.0))
      (group () ((??.0 (count ?O)))
        (bgp (triple ?S ?P ?O))))))

@see www.w3.org/TR/sparql11-query/#defn_aggCount

Constants

NAME

Public Instance Methods

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

Count is a SPARQL set function which counts the number of times a given expression has a bound, and non-error value within the aggregate group.

@param [Enumerable<Array<RDF::Term>>] enum

enum of evaluated operand

@return [RDF::Literal::Integer] The number of non-error terms in the multiset

# File lib/sparql/algebra/operator/count.rb, line 25
def apply(enum, **options)
  RDF::Literal(enum.length)
end