The parser runs on a separate thread. It's output is sent to a StreamRDF on the
callers thread. The parser output is batched into blocks and placed on a
finite-sized concurrent BlockingQueue
.
There are overheads, so this is only beneficial in some situations. Delivery to
the StreamRDF has an initial latency while the first batch of work is accumulated.
Using the AsyncParserBuilder
gives control over the chunk size such that initial latency
can be reduced at the cost of possibly decreasing the overall throughput.
Closing the returned ClosableIterator
s terminates the parsing
process and closes the involved resources.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
asyncParse
(InputStream input, Lang lang, String baseURI, StreamRDF output) Function to that parses anInputStream
on a separate thread and sends the output to a StreamRDF on the callers thread.static void
asyncParse
(String fileOrURL, StreamRDF output) Function that reads a file or GETs a URL, parses the content on a separate thread and sends the output to a StreamRDF on the callers thread.static void
asyncParse
(List<String> filesOrURLs, StreamRDF output) Function that parses content from a list of files or URLs on a separate thread and sends the output to a StreamRDF on the callers thread.static org.apache.jena.atlas.iterator.IteratorCloseable<Quad>
asyncParseQuads
(InputStream input, Lang lang, String baseURI) Pull parser - quads.static org.apache.jena.atlas.iterator.IteratorCloseable<Quad>
asyncParseQuads
(String fileOrURL) Pull parser - quadsstatic org.apache.jena.atlas.iterator.IteratorCloseable<Quad>
asyncParseQuads
(List<String> filesOrURLs) Pull parser - quadsstatic void
asyncParseSources
(List<RDFParserBuilder> sources, StreamRDF output) Parse a number of sources (RDFParserBuilders
) on a separate thread and send the output to a StreamRDF on the callers thread.static org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple>
asyncParseTriples
(InputStream input, Lang lang, String baseURI) Pull parser - triples.static org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple>
asyncParseTriples
(String fileOrURL) Pull parser - triplesstatic org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple>
asyncParseTriples
(List<String> filesOrURLs) Pull parser - triplesstatic AsyncParserBuilder
of
(InputStream input, Lang lang, String baseURI) Create anAsyncParserBuilder
from an input stream.static AsyncParserBuilder
Create anAsyncParserBuilder
from a file or URL.static AsyncParserBuilder
of
(RDFParserBuilder source) Create anAsyncParserBuilder
from anRDFParserBuilder
.static AsyncParserBuilder
ofLocations
(List<String> filesOrURLs) Create anAsyncParserBuilder
from a set of files and/or URLs.static AsyncParserBuilder
ofSources
(List<RDFParserBuilder> sources) Create anAsyncParserBuilder
from a set ofRDFParserBuilder
instances.
-
Method Details
-
asyncParse
Function that reads a file or GETs a URL, parses the content on a separate thread and sends the output to a StreamRDF on the callers thread. -
asyncParse
Function that parses content from a list of files or URLs on a separate thread and sends the output to a StreamRDF on the callers thread. -
asyncParse
Function to that parses anInputStream
on a separate thread and sends the output to a StreamRDF on the callers thread. -
asyncParseSources
Parse a number of sources (RDFParserBuilders
) on a separate thread and send the output to a StreamRDF on the callers thread. -
asyncParseTriples
public static org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple> asyncParseTriples(String fileOrURL) Pull parser - triples -
asyncParseTriples
public static org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple> asyncParseTriples(List<String> filesOrURLs) Pull parser - triples -
asyncParseTriples
public static org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple> asyncParseTriples(InputStream input, Lang lang, String baseURI) Pull parser - triples.See also
IteratorParsers.createIteratorNTriples(java.io.InputStream)
. -
asyncParseQuads
public static org.apache.jena.atlas.iterator.IteratorCloseable<Quad> asyncParseQuads(String fileOrURL) Pull parser - quads -
asyncParseQuads
public static org.apache.jena.atlas.iterator.IteratorCloseable<Quad> asyncParseQuads(List<String> filesOrURLs) Pull parser - quads -
asyncParseQuads
public static org.apache.jena.atlas.iterator.IteratorCloseable<Quad> asyncParseQuads(InputStream input, Lang lang, String baseURI) Pull parser - quads.See also
IteratorParsers.createIteratorNQuads(java.io.InputStream)
. -
of
Create anAsyncParserBuilder
from a file or URL. -
ofLocations
Create anAsyncParserBuilder
from a set of files and/or URLs. -
of
Create anAsyncParserBuilder
from an input stream. -
of
Create anAsyncParserBuilder
from anRDFParserBuilder
. -
ofSources
Create anAsyncParserBuilder
from a set ofRDFParserBuilder
instances.
-