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();