Refactor SPARQL execution