Thanks Andy. Yes, I need to handle warnings because part of my use case is to exit on malformed subjects, even if that doesn't mean a malformed TTL.
I'll try it out. I was hoping I don't have to use a low-level API :) Cheers Praveen On Mon, May 16, 2016, 10:08 AM Andy Seaborne <[email protected]> wrote: > On 16/05/16 15:02, Praveen Balaji wrote: > > Hi all > > I'm trying to read from Turtle file using Jena Riot API. My input had a > > malformed subject URI and the application exited without an exception. I > > configured log4j and I was able to then see an error message. > > > > Is there a way to configure an error handler on the parser so I am > notified > > of errors and can handle them as needed? > > > > Thanks > > > > Is the logging output saying its warning? > > A Turtle syntax error causes the parser to throw an exception. A warning > is note that a URI is not good as per the RFCs but it is not a syntax > error so the parser continues. > > If you really want warnings passed out - set the error handler via the > low level APIs: > > InputStream in = .... ; > StreamRDF dest = StreamRDFLib.graph(model.getGraph()) ; > ReaderRIOT r = RDFDataMgr.createReader(Lang.TTL) ; > r.setErrorHandler(null) ; > r.read(in, null, null, dest, null) ; > // data in the model. > > Andy > >
