Package com.complexible.common.rdf.rio

# Class RDFStreamProcessor

java.lang.Object
com.complexible.common.rdf.rio.RDFStreamProcessor

public final class RDFStreamProcessor extends Object
Stream processor that handles concurrent production of statements from multiple streams and passes the statements to `handlers` or provides the results as an `iteration(List)`.

Since:
  0.1
Author:
  Michael Grove, Evren Sirin, Fernando Hernandez

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RDFStreamProcessor`
  `add(RDFStream theStream)`
  Adds a new stream to process.
  `RDFStreamProcessor`
  `add(Iterable<RDFStream> theStreams)`
  `Throwable`
  `anyException()`
  `void`
  `cancel(String theCause)`
  `RDFStreamProcessor`
  `check(CancelCheck theCheck)`
  `static RDFStreamProcessor`
  `create(ProcessorContext cxt)`
  `RDFStreamProcessor`
  `handler(RDFNamespaceHandler theNamespaceHandler)`
  Specifies the namespace handler that will be used by this process.
  `RDFStreamProcessor`
  `handler(RDFStatementHandler.Factory theHandler)`
  Specifies the factory that will be used to create handlers.
  `static StatementIterator`
  `iteration(List<RDFStream> theStreams)`
  `static void`
  `main(String[] args)`
  `RDFStreamProcessor`
  `maxHandlers(int count)`
  `RDFStreamProcessor`
  `maxParsers(int count)`
  `RDFStreamProcessor`
  `monitorOutput(ProgressReporter reporter)`
  `RDFStreamProcessor`
  `monitorOutput(OutputStream theStream, String theDBName)`
  Sets the output progress if progress should be reported or `null` if progress should not be reported.
  `void`
  `process()`
  Waits for the processing of streams to finish.
  `Map<RDFStream,Exception>`
  `processSilently()`
  Waits for the processing of streams to finish and returns a mapping from the streams to exceptions.
  `RDFStreamProcessor`
  `resizeHandlers(boolean value)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### create

    public static RDFStreamProcessor create(ProcessorContext cxt)

  - ### iteration

    public static StatementIterator iteration(List<RDFStream> theStreams)

  - ### handler

    public RDFStreamProcessor handler(RDFStatementHandler.Factory theHandler)
    Specifies the factory that will be used to create handlers. Multiple handlers may be created depending on the number of streams processed, number of available processors, etc.

  - ### handler

    public RDFStreamProcessor handler(RDFNamespaceHandler theNamespaceHandler)
    Specifies the namespace handler that will be used by this process. A single namespace handler is used for all the streams processed.

  - ### check

    public RDFStreamProcessor check(CancelCheck theCheck)

  - ### monitorOutput

    public RDFStreamProcessor monitorOutput(OutputStream theStream, String theDBName)
    Sets the output progress if progress should be reported or `null` if progress should not be reported. Passing `null` value is preferred compared to passing an output stream that ignores its output so that we will avoid keeping track of progress completely.

  - ### monitorOutput

    public RDFStreamProcessor monitorOutput(ProgressReporter reporter)

  - ### maxParsers

    public RDFStreamProcessor maxParsers(int count)

  - ### maxHandlers

    public RDFStreamProcessor maxHandlers(int count)

  - ### resizeHandlers

    public RDFStreamProcessor resizeHandlers(boolean value)

  - ### add

    public RDFStreamProcessor add(RDFStream theStream)
    Adds a new stream to process. Processing might start immediately

  - ### add

    public RDFStreamProcessor add(Iterable<RDFStream> theStreams)

  - ### anyException

    public Throwable anyException()

  - ### process

    public void process() throws InvalidRDF, IOException
    Waits for the processing of streams to finish. No more streams may be added to the processor after this function is called. An exception is thrown at the very end if there was an error processing any one of the streams.
    Throws:
      `InvalidRDF`
      `IOException`

  - ### processSilently

    public Map<RDFStream,Exception> processSilently()
    Waits for the processing of streams to finish and returns a mapping from the streams to exceptions. The map will be empty if there were no exceptions during processing. No more streams may be added to the processor after this function is called.

  - ### cancel

    public void cancel(String theCause)

  - ### main

    public static void main(String[] args)