Class: SPARQL::Algebra::Operator::Count

Inherits:
SPARQL::Algebra::Operator show all
Includes:
Aggregate
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sparql-bb59900f675b/lib/sparql/algebra/operator/count.rb

Overview

The SPARQL count set function.

Examples:

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

See Also:

Constant Summary

NAME =
:count

Constants inherited from SPARQL::Algebra::Operator

ARITY, IsURI, URI

Instance Attribute Summary

Attributes inherited from SPARQL::Algebra::Operator

#operands

Instance Method Summary collapse

Methods included from Aggregate

#aggregate, #replace_aggregate!, #replace_vars!

Methods inherited from SPARQL::Algebra::Operator

#aggregate?, arity, #base_uri, base_uri, base_uri=, #boolean, #constant?, #each_descendant, #eql?, #evaluatable?, evaluate, #executable?, #first_ancestor, for, #initialize, #inspect, #ndvars, #node?, #operand, #optimize, #parent, #parent=, prefixes, #prefixes, prefixes=, #rewrite, #to_binary, #to_sxp, #to_sxp_bin, #validate!, #variable?, #vars

Methods included from Expression

cast, #constant?, #evaluate, extension, extensions, for, #invalid?, new, #node?, open, #optimize, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?

Constructor Details

This class inherits a constructor from SPARQL::Algebra::Operator

Instance Method Details

#apply(enum) ⇒ RDF::Literal::Integer

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.

Parameters:

Returns:



25
26
27
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-bb59900f675b/lib/sparql/algebra/operator/count.rb', line 25

def apply(enum)
  RDF::Literal(enum.length)
end