if ( modLangParse.skipOnBadTerm() )
{
// TODO skipOnBadterm
}
Lang lang = selectLang(filename, Lang.NQUADS) ;
LangHandler handler = dispatch.get(lang) ;
if ( handler == null )
throw new CmdException("Undefined language: "+lang) ;
// If multiple files, choose the overall labels.
if ( langHandlerOverall == null )
langHandlerOverall = handler ;
else
{
if ( langHandlerOverall != langHandlerAny )
{
if ( langHandlerOverall != handler )
langHandlerOverall = langHandlerAny ;
}
}
// Make a flag.
// Input and output subflags.
// If input is "label, then output using NodeToLabel.createBNodeByLabelRaw() ;
// 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(System.out, 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) ;