Updated to align with stable version of GTWSPARQLEngine and implemented simple query planning optimizations.