moving string template code into SparqlTemplate to fix a thread-safety issue. fixes #8