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 ;
// Need low level control over the parser.
LangRIOT parser = RiotReader.createParser(in, lang, baseURI, sink) ;
try
{
if ( checking )
{
if ( parser.getLang() == RDFLanguages.NTRIPLES || parser.getLang() == RDFLanguages.NQUADS )
parser.setProfile(RiotLib.profile(baseURI, false, true, errHandler)) ;
else
parser.setProfile(RiotLib.profile(baseURI, true, true, errHandler)) ;
}
else
parser.setProfile(RiotLib.profile(baseURI, false, false, errHandler)) ;
if ( labelsAsGiven )
parser.getProfile().setLabelToNode(LabelToNode.createUseLabelAsGiven()) ;
modTime.startTimer() ;
parser.parse() ;
}
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 ;