ASTBaseDecl baseDecl = qc.getBaseDecl();
if (baseDecl != null) {
parsedBaseURI = new ParsedURI(baseDecl.getIRI());
if (!parsedBaseURI.isAbsolute()) {
throw new MalformedQueryException("BASE IRI is not an absolute IRI: " + externalBaseURI);
}
}
else if (externalBaseURI != null) {
// Use external base URI if the query doesn't contain one itself
parsedBaseURI = new ParsedURI(externalBaseURI);
if (!parsedBaseURI.isAbsolute()) {
throw new IllegalArgumentException("Supplied base URI is not an absolute IRI: " + externalBaseURI);
}
}
else {
// FIXME: use the "Default Base URI"?
}
if (parsedBaseURI != null) {
RelativeIRIResolver visitor = new RelativeIRIResolver(parsedBaseURI);
try {
qc.jjtAccept(visitor, null);
}
catch (VisitorException e) {
throw new MalformedQueryException(e);
}
}
}