RDF4j ParsedQuery or TupleExpr to String Represenation

半腔热情 提交于 2019-12-11 07:23:57

问题


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


回答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.



来源:https://stackoverflow.com/questions/58236961/rdf4j-parsedquery-or-tupleexpr-to-string-represenation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!