ARQ supports custom aggregate functions as allowed by the SPARQL 1.1 specification. See jena-examples:arq/examples/aggregates.