Aggregates and Grouping (SPARQL 1.1)

SPARQL 1.1 includes a facility for specifying aggregate functions of data. Specifically, it provides aggregate functions COUNT, MIN, MAX, AVG, and SUM. These aggregates can be used alongside any graph pattern, computing a result for all matches for the pattern.

For example, we could find out how many movies James Dean has played in:

image

The syntax of SPARQL3 aggregates appears in the SELECT clause—the aggregate expression appears in parentheses, starting with the aggregate word, followed by the variable to be aggregated (also in parentheses), then the keyword AS followed by a new variable, which will be bound ...

Get Semantic Web for the Working Ontologist, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.