Package org.apache.any23.writer
Interface TripleHandler
-
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
FormatWriter
- All Known Implementing Classes:
BenchmarkTripleHandler,CompositeTripleHandler,CountingTripleHandler,ExtractionContextBlocker,IgnoreAccidentalRDFa,IgnoreTitlesOfEmptyDocuments,JSONLDWriter,JSONWriter,LoggingTripleHandler,NQuadsWriter,NTriplesWriter,RDFWriterTripleHandler,RDFXMLWriter,ReportingTripleHandler,RepositoryWriter,TripleWriterHandler,TriXWriter,TurtleWriter,URIListWriter
public interface TripleHandler extends AutoCloseable
Defines a document based triple handler.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Will be called last and exactly once.voidcloseContext(ExtractionContext context)Informs the handler that no more triples will come from a previously opened context.voidendDocument(org.eclipse.rdf4j.model.IRI documentIRI)Informs the handler that the end of the document has been reached.voidopenContext(ExtractionContext context)Informs the handler that a new context has been established.voidreceiveNamespace(String prefix, String uri, ExtractionContext context)Invoked with a currently open context, notifies the detection of a namespace.voidreceiveTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.IRI g, ExtractionContext context)Invoked with a currently open context, notifies the detection of a triple.voidsetContentLength(long contentLength)Sets the length of the content to be processed.voidstartDocument(org.eclipse.rdf4j.model.IRI documentIRI)
-
-
-
Method Detail
-
startDocument
void startDocument(org.eclipse.rdf4j.model.IRI documentIRI) throws TripleHandlerException- Throws:
TripleHandlerException
-
openContext
void openContext(ExtractionContext context) throws TripleHandlerException
Informs the handler that a new context has been established. Contexts are not guaranteed to receive any triples, so they might be closed without any triple.- Parameters:
context- an instantiatedExtractionContext- Throws:
TripleHandlerException- if there is an errr opening theExtractionContext
-
receiveTriple
void receiveTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.IRI g, ExtractionContext context) throws TripleHandlerExceptionInvoked with a currently open context, notifies the detection of a triple.- Parameters:
s- triple subject, cannot benull.p- triple predicate, cannot benull.o- triple object, cannot benull.g- triple graph, can benull.context- extraction context.- Throws:
TripleHandlerException- if there is an error receiving the triple.
-
receiveNamespace
void receiveNamespace(String prefix, String uri, ExtractionContext context) throws TripleHandlerException
Invoked with a currently open context, notifies the detection of a namespace.- Parameters:
prefix- namespace prefix.uri- namespace IRI.context- namespace context.- Throws:
TripleHandlerException- if there is an error receiving the namespace.
-
closeContext
void closeContext(ExtractionContext context) throws TripleHandlerException
Informs the handler that no more triples will come from a previously opened context. All contexts are guaranteed to be closed before the final close(). The document context for each document is guaranteed to be closed after all local contexts of that document.- Parameters:
context- the context to be closed.- Throws:
TripleHandlerException- if there is an error closing theExtractionContext.
-
endDocument
void endDocument(org.eclipse.rdf4j.model.IRI documentIRI) throws TripleHandlerExceptionInforms the handler that the end of the document has been reached.- Parameters:
documentIRI- document IRI.- Throws:
TripleHandlerException- if there is an error ending the document.
-
setContentLength
void setContentLength(long contentLength)
Sets the length of the content to be processed.- Parameters:
contentLength- length of the content being processed.
-
close
void close() throws TripleHandlerExceptionWill be called last and exactly once.- Specified by:
closein interfaceAutoCloseable- Throws:
TripleHandlerException- if there is an error closing theTripleHandlerimplementation.
-
-