StreamRDF s = StreamRDFLib.sinkNull() ;
if ( ! modLangParse.toBitBucket() )
s = StreamRDFLib.writer(output) ;
if ( setup != null )
s = InfFactory.inf(s, setup) ;
StreamRDFCounting sink = StreamRDFLib.count(s) ;
s = null ;
ReaderRIOT reader = RDFDataMgr.createReader(lang) ;
try {
if ( checking ) {
if ( lang == RDFLanguages.NTRIPLES || lang == RDFLanguages.NQUADS )
reader.setParserProfile(RiotLib.profile(baseURI, false, true, errHandler)) ;
else
reader.setParserProfile(RiotLib.profile(baseURI, true, true, errHandler)) ;
} else
reader.setParserProfile(RiotLib.profile(baseURI, false, false, errHandler)) ;
if ( labelsAsGiven )
reader.getParserProfile().setLabelToNode(LabelToNode.createUseLabelAsGiven()) ;
modTime.startTimer() ;
reader.read(in, baseURI, ct, sink, null) ;
} catch (RiotException ex) {
// Should have handled the exception and logged a message by now.
// System.err.println("++++"+ex.getMessage());
if ( modLangParse.stopOnBadTerm() )
return ;
} finally {
// Not close - we may write again to the underlying output stream in another call to parse a file.
sink.finish() ;
IO.close(in) ;
}
long x = modTime.endTimer() ;
long n = sink.countTriples()+sink.countQuads() ;
if ( modTime.timingEnabled() )
output(filename, n, x, handler) ;
totalMillis += x ;