Class AsyncParserBuilder

java.lang.Object
org.apache.jena.riot.system.AsyncParserBuilder

public class AsyncParserBuilder extends Object
  • Constructor Details

    • AsyncParserBuilder

      public AsyncParserBuilder()
    • AsyncParserBuilder

      public AsyncParserBuilder(List<RDFParserBuilder> sources)
  • Method Details

    • getChunkSize

      public int getChunkSize()
    • setChunkSize

      public AsyncParserBuilder setChunkSize(int chunkSize)
      The chunk size controls the maxmimum number of elements the parser thread transfers at once to the client iterator's queue. The default value (100000) is optimized for throughput however it introduces a delay until the first item arrives. Data can be dispatched prematurely by setting setPrematureDispatch(Predicate).
    • getQueueSize

      public int getQueueSize()
    • setQueueSize

      public AsyncParserBuilder setQueueSize(int queueSize)
      The queue size controls the number of chunks the parser thread can read ahead. A full queue blocks that thread. The default value is 10.
    • isDaemonMode

      public boolean isDaemonMode()
    • setDaemonMode

      public AsyncParserBuilder setDaemonMode(boolean daemonMode)
      Whether the parser thread should run as a daemon thread. A JVM will terminate as soon as there are no more non-daemon threads.
    • setPrematureDispatch

      public AsyncParserBuilder setPrematureDispatch(Predicate<EltStreamRDF> prematureDispatch)
      Set a custom dispatch (flush) policy: When the predicate returns true for an element then that element and any gathered data is dispatched immediately. Before dispatch a check is made whether parsing has been (concurrently) aborted.
    • getPrematureDispatch

      public Predicate<EltStreamRDF> getPrematureDispatch()
    • getSources

      public List<RDFParserBuilder> getSources()
    • setSources

      public AsyncParserBuilder setSources(List<RDFParserBuilder> sources)
    • mutateSources

      public AsyncParserBuilder mutateSources(Consumer<RDFParserBuilder> mutator)
      Run an operation on all RDFParserBuilder sources in this builder. Allows for e.g. configuring prefixes, the error handler or the label-to-node strategy
    • asyncParseTriples

      public org.apache.jena.atlas.iterator.IteratorCloseable<org.apache.jena.graph.Triple> asyncParseTriples()
    • asyncParseQuads

      public org.apache.jena.atlas.iterator.IteratorCloseable<Quad> asyncParseQuads()
    • streamElements

      public Stream<EltStreamRDF> streamElements()
    • streamTriples

      public Stream<org.apache.jena.graph.Triple> streamTriples()
    • streamQuads

      public Stream<Quad> streamQuads()
    • asyncParseSources

      public Runnable asyncParseSources(StreamRDF output)
      Calling the returned runnable stops parsing. The sink will see no further data.