org.apache.any23.writer
Interface TripleHandler

All Known Subinterfaces:
FormatWriter
All Known Implementing Classes:
BenchmarkTripleHandler, CompositeTripleHandler, CountingTripleHandler, ExtractionContextBlocker, IgnoreAccidentalRDFa, IgnoreTitlesOfEmptyDocuments, JSONWriter, LoggingTripleHandler, NQuadsWriter, NTriplesWriter, RDFWriterTripleHandler, RDFXMLWriter, ReportingTripleHandler, RepositoryWriter, TriXWriter, TurtleWriter, URIListWriter

public interface TripleHandler

Defines a document based triple handler.


Method Summary
 void close()
          Will be called last and exactly once.
 void closeContext(ExtractionContext context)
          Informs the handler that no more triples will come from a previously opened context.
 void endDocument(org.openrdf.model.URI documentURI)
          Informs the handler that the end of the document has been reached.
 void openContext(ExtractionContext context)
          Informs the handler that a new context has been established.
 void receiveNamespace(String prefix, String uri, ExtractionContext context)
          Invoked with a currently open context, notifies the detection of a namespace.
 void receiveTriple(org.openrdf.model.Resource s, org.openrdf.model.URI p, org.openrdf.model.Value o, org.openrdf.model.URI g, ExtractionContext context)
          Invoked with a currently open context, notifies the detection of a triple.
 void setContentLength(long contentLength)
          Sets the length of the content to be processed.
 void startDocument(org.openrdf.model.URI documentURI)
           
 

Method Detail

startDocument

void startDocument(org.openrdf.model.URI documentURI)
                   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.

Throws:
TripleHandlerException

receiveTriple

void receiveTriple(org.openrdf.model.Resource s,
                   org.openrdf.model.URI p,
                   org.openrdf.model.Value o,
                   org.openrdf.model.URI g,
                   ExtractionContext context)
                   throws TripleHandlerException
Invoked with a currently open context, notifies the detection of a triple.

Parameters:
s - triple subject, cannot be null.
p - triple predicate, cannot be null.
o - triple object, cannot be null.
g - triple graph, can be null.
context - extraction context.
Throws:
TripleHandlerException

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 URI.
context - namespace context.
Throws:
TripleHandlerException

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

endDocument

void endDocument(org.openrdf.model.URI documentURI)
                 throws TripleHandlerException
Informs the handler that the end of the document has been reached.

Parameters:
documentURI - document URI.
Throws:
TripleHandlerException

setContentLength

void setContentLength(long contentLength)
Sets the length of the content to be processed.

Parameters:
contentLength -
Throws:
TripleHandlerException

close

void close()
           throws TripleHandlerException
Will be called last and exactly once.

Throws:
TripleHandlerException


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.