Class TripleWriterHandler

    • Constructor Detail

      • TripleWriterHandler

        public TripleWriterHandler()
    • Method Detail

      • receiveTriple

        public 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 TripleHandlerException
        Writers may override this method to handle a "receiveTriple" extraction event. The default implementation calls:
             this.writeTriple(s, p, o, context == null || g != null ? g : context.getDocumentIRI())
         
        Specified by:
        receiveTriple in interface TripleHandler
        Parameters:
        s - the subject received
        p - the predicate received
        o - the object received
        g - the graph name received, or null
        context - the extraction context
        Throws:
        TripleHandlerException - if there was an error responding to a received triple
      • receiveNamespace

        public void receiveNamespace​(String prefix,
                                     String uri,
                                     ExtractionContext context)
                              throws TripleHandlerException
        Writers may override this method to handle a "receiveNamespace" extraction event. The default implementation calls:
             this.writeNamespace(prefix, uri)
         
        Specified by:
        receiveNamespace in interface TripleHandler
        Parameters:
        prefix - namespace prefix.
        uri - namespace IRI.
        context - the extraction context
        Throws:
        TripleHandlerException - if there was an error responding to the received namepsace.
      • startDocument

        public void startDocument​(org.eclipse.rdf4j.model.IRI documentIRI)
                           throws TripleHandlerException
        Writers may override this method to handle a "startDocument" extraction event. The default implementation does nothing.
        Specified by:
        startDocument in interface TripleHandler
        Parameters:
        documentIRI - the name of the document that was started
        Throws:
        TripleHandlerException - if an error occurred while responding to a "startDocument" extraction event.
      • openContext

        public void openContext​(ExtractionContext context)
                         throws TripleHandlerException
        Writers may override this method to handle an "openContext" extraction event. The default implementation does nothing.
        Specified by:
        openContext in interface TripleHandler
        Parameters:
        context - the context that was opened
        Throws:
        TripleHandlerException - if an error occurred while responding to a "startDocument" extraction event.
      • closeContext

        public void closeContext​(ExtractionContext context)
                          throws TripleHandlerException
        Writers may override this method to handle a "closeContext" extraction event. The default implementation does nothing.
        Specified by:
        closeContext in interface TripleHandler
        Parameters:
        context - the context to be closed.
        Throws:
        TripleHandlerException - if an error occurred while responding to a "closeContext" extraction event.
      • endDocument

        public void endDocument​(org.eclipse.rdf4j.model.IRI documentIRI)
                         throws TripleHandlerException
        Writers may override this method to handle an "endDocument" extraction event. The default implementation does nothing.
        Specified by:
        endDocument in interface TripleHandler
        Parameters:
        documentIRI - the document IRI.
        Throws:
        TripleHandlerException - if an error occurred while responding to a "endDocument" extraction event.
      • setContentLength

        public void setContentLength​(long contentLength)
        Writers may override this method to handle a "setContentLength" extraction event. The default implementation does nothing.
        Specified by:
        setContentLength in interface TripleHandler
        Parameters:
        contentLength - length of the content being processed.