The University of Maryland, home of DAML and James Hendler and a lot of the Semantic Web efforts has a good algorithm for doing aggregate functions. Very academic paper, showing some of the challenges, but also showing it is not impossible for Sparql to have aggregate functions.