// 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>
// That would change a lot (Triples came several years before Quads).
if ( lang.isTriples() )
{
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) ;
if ( lang.equals(Lang.RDFXML) )
// Adapter round ARP RDF/XML reader.
parser = LangRDFXML.create(in, baseURI, filename, errHandler, sink2) ;
else
parser = RiotReader.createParserTriples(in, lang, baseURI, sink2) ;
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) ;
parser = RiotReader.createParserQuads(in, lang, baseURI, sink2) ;
sink = sink2 ;
}
// Pending log message having he filename in them.
// output(filename) ;
try
{
// Default behaviour is "check":
if ( checking )
{
if ( parser.getLang() == Lang.NTRIPLES || parser.getLang() == Lang.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());