Package com.complexible.common.rdf.rio
Class RDFStreamProcessor
- java.lang.Object
-
- com.complexible.common.rdf.rio.RDFStreamProcessor
-
public final class RDFStreamProcessor extends java.lang.ObjectStream processor that handles concurrent production of statements from multiple streams and passes the statements tohandlersor 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 RDFStreamProcessoradd(RDFStream theStream)Adds a new stream to process.RDFStreamProcessoradd(java.lang.Iterable<RDFStream> theStreams)java.lang.ThrowableanyException()voidcancel(java.lang.String theCause)RDFStreamProcessorcheck(CancelCheck theCheck)static RDFStreamProcessorcreate(ProcessorContext cxt)RDFStreamProcessorhandler(RDFNamespaceHandler theNamespaceHandler)Specifies the namespace handler that will be used by this process.RDFStreamProcessorhandler(RDFStatementHandler.Factory theHandler)Specifies the factory that will be used to create handlers.static StatementIteratoriteration(java.util.List<RDFStream> theStreams)static voidmain(java.lang.String[] args)RDFStreamProcessormaxHandlers(int count)RDFStreamProcessormaxParsers(int count)RDFStreamProcessormonitorOutput(ProgressReporter reporter)RDFStreamProcessormonitorOutput(java.io.OutputStream theStream)Sets the output progress if progress should be reported ornullif progress should not be reported.voidpause()Pauses processing.voidprocess()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.RDFStreamProcessorresizeHandlers(boolean value)voidresume()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 ornullif progress should not be reported. Passingnullvalue 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)
-
anyException
public java.lang.Throwable anyException()
-
process
public void process() throws InvalidRDF, java.io.IOExceptionWaits 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:
InvalidRDFjava.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)
-
-