1

I have a SPARQL query and I want to replace some of the URIs it contains based on a dictionary. I constructed a AbstractQueryModelVisitor that does that, i.e., it substitutes the URIs I want. But once they are substituted, I'm not sure how to get back the string representation of the SPARQL query. I only have the ParsedQuery or TupleExpr of it. Is it possible to convert these representations back to a String representation?

Thank you

TallTed
  • 9,069
  • 2
  • 22
  • 37
D063520
  • 113
  • 6

1 Answers1

1

There is a SPARQLQueryRenderer class which can convert a ParsedQuery back to a SPARQL query string, however it has not been updated past SPARQL 1.0. It may serve your purposes, depending on how complex your query is, but for anything involving 1.1 features such as subqueries or aggregates, it's unlikely to work.

TallTed
  • 9,069
  • 2
  • 22
  • 37
Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73