The RDFQ (RDF-Query) package contains classes to assist in constucting SPARQL terms, triples, and queries. It could perhaps be replaced by using ARQs syntax trees but that would have pervasive effects through the code.