* @throws ParseException
*/
public Set<UriRef> getReferredGraphs(String queryString, UriRef defaultGraph) throws ParseException {
Set<UriRef> referredGraphs;
JavaCCGeneratedSparqlPreParser parser = new JavaCCGeneratedSparqlPreParser(new StringReader(queryString));
SparqlUnit sparqlUnit;
sparqlUnit = parser.parse();
if (sparqlUnit.isQuery()) {
Query q = sparqlUnit.getQuery();
DataSet dataSet = q.getDataSet();
if (dataSet != null) {
referredGraphs = dataSet.getDefaultGraphs();
referredGraphs.addAll(dataSet.getNamedGraphs());
} else {
referredGraphs = new HashSet<UriRef>();
}
} else {
Update u = sparqlUnit.getUpdate();
referredGraphs = u.getReferredGraphs(defaultGraph, tcProvider);
}
if (referredGraphs.isEmpty()) {
return null;
// referredGraphs.add(defaultGraph);