use of org.apache.jena.riot.lang.PipedQuadsStream in project jena by apache.
the class RDFDataMgr method createIteratorQuads.
/**
* Creates an iterator over parsing of quads
* @param input Input Stream
* @param lang Language
* @param baseIRI Base IRI
* @return Iterator over the quads
*/
public static Iterator<Quad> createIteratorQuads(InputStream input, Lang lang, String baseIRI) {
// Special case N-Quads, because the RIOT reader has a pull interface
if (RDFLanguages.sameLang(RDFLanguages.NQUADS, lang)) {
return new IteratorResourceClosing<>(RiotParsers.createIteratorNQuads(input, null, RiotLib.dftProfile()), input);
}
// Otherwise, we have to spin up a thread to deal with it
final PipedRDFIterator<Quad> it = new PipedRDFIterator<>();
final PipedQuadsStream out = new PipedQuadsStream(it);
Thread t = new Thread(() -> parseFromInputStream(out, input, baseIRI, lang, null));
t.start();
return it;
}
Aggregations