Search in sources :

Example 1 with TokenMgrError

use of org.apache.jena.n3.turtle.parser.TokenMgrError in project jena by apache.

the class ParserTurtle method parse.

public void parse(Graph graph, String baseURI, Reader reader) {
    // Nasty things happen if the reader is not UTF-8.
    try {
        TurtleParser parser = new TurtleParser(reader);
        parser.setEventHandler(new TurtleRDFGraphInserter(graph));
        parser.setBaseURI(baseURI);
        parser.parse();
    } catch (ParseException | TokenMgrError ex) {
        throw new TurtleParseException(ex.getMessage());
    } catch (TurtleParseException ex) {
        throw ex;
    } catch (Throwable th) {
        throw new TurtleParseException(th.getMessage(), th);
    }
}
Also used : TurtleParser(org.apache.jena.n3.turtle.parser.TurtleParser) TokenMgrError(org.apache.jena.n3.turtle.parser.TokenMgrError) ParseException(org.apache.jena.n3.turtle.parser.ParseException)

Aggregations

ParseException (org.apache.jena.n3.turtle.parser.ParseException)1 TokenMgrError (org.apache.jena.n3.turtle.parser.TokenMgrError)1 TurtleParser (org.apache.jena.n3.turtle.parser.TurtleParser)1