Caucho Resin PHP bridge showing renewed promise for Speed Improvements

Looks like I'll be using a hybrid approach of the HTTP client, and a custom class running on JAVA to do the aggregation emulation.

Here's a recap of the consequences.
The first points of failure are (since the HTTP client for Sesame works great):

* SPARQL/Sesame not having Aggregate functions
* Sesame not having ORDER BY

This produces large amounts of results and/or queries, which then need to be parsed by JSON, leading to the second point of failure

* Zend JSON and native php 5.2 JSON are not fast enough (perhaps they should not be expected to be for 6000 results)

The workarounds are that this execution must happen on the server by either using an RDF store that has aggregate functions, or doing the aggregation emulation in the native language, JAVA. This means either writing that in Java - OR PHP. PHP can instantiate Java in a couple of ways. The first is to compile PHP with the --with-java option. The other was to use the Caucho product, which will run PHP at version 5.2 using a JAVA interpreter. I chose the latter since it would mean less development now, and when Sesame/Sparql do get Aggregate functions I can use the HTTP client already built.

In the next 24 I'll know if I can squeeze the speed out of this that I hoped for.