// else use NodeToLabel.createBNodeByLabel() ;
// Also, as URI.
final boolean labelsAsGiven = false ;
SinkCounting<?> sink ;
LangRIOT parser ;
NodeToLabel labels = SyntaxLabels.createNodeToLabel() ;
if ( labelsAsGiven )
labels = NodeToLabel.createBNodeByLabelEncoded() ;
// Uglyness because quads and triples aren't subtype of some Tuple<Node>
// Replace with StreamRDF all the way through.
if ( RDFLanguages.isTriples(lang) )
{
Sink<Triple> s = SinkNull.create() ;
if ( ! modLangParse.toBitBucket() )
s = new SinkTripleOutput(output, null, labels) ;
if ( setup != null )
s = InfFactory.infTriples(s, setup) ;
SinkCounting<Triple> sink2 = new SinkCounting<Triple>(s) ;
StreamRDF dest = StreamRDFLib.sinkTriples(sink2) ;
parser = RiotReader.createParser(in, lang, baseURI, dest) ;
sink = sink2 ;
}
else
{
Sink <Quad> s = SinkNull.create() ;
if ( ! modLangParse.toBitBucket() )
s = new SinkQuadOutput(output, null, labels) ;
if ( setup != null )
s = InfFactory.infQuads(s, setup) ;
SinkCounting<Quad> sink2 = new SinkCounting<Quad>(s) ;
StreamRDF dest = StreamRDFLib.sinkQuads(sink2) ;
parser = RiotReader.createParser(in, lang, baseURI, dest) ;
sink = sink2 ;
}
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());