Skip to main content

Aggregate Function Reference

Aggregates are used in Projection Expressions to summarize or operate over groups whithin your data.

This page describes the Aggregates that are supported by GeneTegra.
Some Aggregates may not appear in all situations, depending on the context.

SPARQL Aggregates

GeneTegra is designed to support all SPARQL 1.1 aggregates.

Details: https://www.w3.org/TR/sparql11-query/#aggregates | https://www.w3.org/TR/sparql11-query/#aggregateAlgebra

Count

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. Returns the number of items. Null values are not counted.

Sum

Sum is a SPARQL set function that will return the numeric value obtained by summing the values within the aggregate group. Type promotion happens as per the op:numeric-add function, applied transitively, (see definition below) so the value of SUM(?x), in an aggregate group where ?x has values 1 (integer), 2.0e0 (float), and 3.0 (decimal) will be 6.0 (float).

Returns the sum of all values in the expression. Null values are ignored. SUM can only be used with numeric fields.

Avg

The Avg set function calculates the average value for an expression over a group. It is defined in terms of Sum and Count. Returns the average of all the values in the expression. Null values are ignored.

Min

Min is a SPARQL set functions that returns the minimum value from a group respectively.

It makes use of the SPARQL ORDER BY ordering definition, to allow ordering over arbitrarily typed expressions.

Returns the minimum of the two arguments, which must be of the same data type.

MIN can also be applied to a single field as an aggregation.

Max

Max is a SPARQL set function that return the maximum value from a group respectively.

It makes use of the SPARQL ORDER BY ordering definition, to allow ordering over arbitrarily typed expressions.

Returns the maximum of the two arguments, which must be of the same data type.

MAX can also be applied to a single field as an aggregation.

GroupConcat

GroupConcat is a set function which performs a string concatenation across the values of an expression with a group. The order of the strings is not specified. The separator character used in the concatenation may be given with the scalar argument SEPARATOR.

Sample

Sample is a set function which returns an arbitrary value from the multiset passed to it.

boolean  sample(Expression expr)

Returns an arbitrary value from the expr multiset passed to it.

Example: sample(?date) # false
Details: https://www.w3.org/TR/sparql11-query/#