Package com.complexible.common.rdf.rio
Class RDFStreamProcessor
- java.lang.Object
-
- com.complexible.common.rdf.rio.RDFStreamProcessor
-
public final class RDFStreamProcessor extends java.lang.Object
Stream processor that handles concurrent production of statements from multiple streams and passes the statements tohandlers
or provides the results as aniteration(List)
.- Since:
- 0.1
- Author:
- Michael Grove, Evren Sirin, Fernando Hernandez
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RDFStreamProcessor
add(RDFStream theStream)
Adds a new stream to process.RDFStreamProcessor
add(java.lang.Iterable<RDFStream> theStreams)
void
cancel(java.lang.String theCause)
RDFStreamProcessor
check(CancelCheck theCheck)
static RDFStreamProcessor
create(ProcessorContext cxt)
java.lang.Throwable
getException(RDFStream theStream)
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(java.util.List<RDFStream> theStreams)
static void
main(java.lang.String[] args)
RDFStreamProcessor
maxHandlers(int count)
RDFStreamProcessor
maxParsers(int count)
RDFStreamProcessor
monitorOutput(ProgressReporter reporter)
RDFStreamProcessor
monitorOutput(java.io.OutputStream theStream)
Sets the output progress if progress should be reported ornull
if progress should not be reported.void
pause()
Pauses processing.void
process()
Waits for the processing of streams to finish.java.util.Map<RDFStream,java.lang.Exception>
processSilently()
Waits for the processing of streams to finish and returns a mapping from the streams to exceptions.RDFStreamProcessor
resizeHandlers(boolean value)
void
resume()
Resumes processing as soon as possible.
-
-
-
Method Detail
-
create
public static RDFStreamProcessor create(ProcessorContext cxt)
-
iteration
public static StatementIterator iteration(java.util.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(java.io.OutputStream theStream)
Sets the output progress if progress should be reported ornull
if progress should not be reported. Passingnull
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(java.lang.Iterable<RDFStream> theStreams)
-
getException
public java.lang.Throwable getException(RDFStream theStream)
-
process
public void process() throws InvalidRDF, java.io.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
java.io.IOException
-
processSilently
public java.util.Map<RDFStream,java.lang.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.
-
pause
public void pause()
Pauses processing. All parsing and processing tasks will block untilresume()
is called.
-
resume
public void resume()
Resumes processing as soon as possible.
-
cancel
public void cancel(java.lang.String theCause)
-
main
public static void main(java.lang.String[] args)
-
-