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 ClosableIterators terminates the parsing
process and closes the involved resources.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidasyncParse(InputStream input, Lang lang, String baseURI, StreamRDF output) Function to that parses anInputStreamon a separate thread and sends the output to a StreamRDF on the callers thread.static voidasyncParse(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 voidasyncParse(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 voidasyncParseSources(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 AsyncParserBuilderof(InputStream input, Lang lang, String baseURI) Create anAsyncParserBuilderfrom an input stream.static AsyncParserBuilderCreate anAsyncParserBuilderfrom a file or URL.static AsyncParserBuilderof(RDFParserBuilder source) Create anAsyncParserBuilderfrom anRDFParserBuilder.static AsyncParserBuilderofLocations(List<String> filesOrURLs) Create anAsyncParserBuilderfrom a set of files and/or URLs.static AsyncParserBuilderofSources(List<RDFParserBuilder> sources) Create anAsyncParserBuilderfrom a set ofRDFParserBuilderinstances.
-
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 anInputStreamon 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 anAsyncParserBuilderfrom a file or URL. -
ofLocations
Create anAsyncParserBuilderfrom a set of files and/or URLs. -
of
Create anAsyncParserBuilderfrom an input stream. -
of
Create anAsyncParserBuilderfrom anRDFParserBuilder. -
ofSources
Create anAsyncParserBuilderfrom a set ofRDFParserBuilderinstances.
-