if ( syntaxURI == null )
syntaxURI = query.getSyntax() ;
else
query.setSyntax(syntaxURI) ;
SPARQLParser parser = SPARQLParser.createParser(syntaxURI) ;
if ( parser == null )
throw new UnsupportedOperationException("Unrecognized syntax for parsing: "+syntaxURI) ;
if ( query.getResolver() == null )
{
IRIResolver resolver = null ;
try {
if ( baseURI != null ) {
// Sort out the baseURI - if that fails, dump in a dummy one and continue.
resolver = IRIResolver.create(baseURI) ;
}
else {
resolver = IRIResolver.create() ;
}
}
catch (Exception ex) {}
if ( resolver == null )
resolver = IRIResolver.create("http://localhost/query/defaultBase#") ;
query.setResolver(resolver) ;
}
return parser.parse(query, queryString) ;
}