Package org.apache.any23.writer
Class RDFWriterTripleHandler
- java.lang.Object
- 
- org.apache.any23.writer.TripleWriterHandler
- 
- org.apache.any23.writer.RDFWriterTripleHandler
 
 
- 
- All Implemented Interfaces:
- AutoCloseable,- FormatWriter,- TripleHandler,- TripleWriter
 - Direct Known Subclasses:
- JSONLDWriter,- NQuadsWriter,- NTriplesWriter,- RDFXMLWriter,- TriXWriter,- TurtleWriter
 
 public abstract class RDFWriterTripleHandler extends TripleWriterHandler implements FormatWriter ATripleHandlerthat writes triples to a SesameRDFWriter, eg for serialization using one of Sesame's writers.- Author:
- Richard Cyganiak (richard@cyganiak.de), Michele Mostarda (mostarda@fbk.eu), Hans Brende (hansbrende@apache.org)
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Will be called last and exactly once.voidcloseContext(ExtractionContext context)Writers may override this method to handle a "closeContext" extraction event.voidendDocument(org.eclipse.rdf4j.model.IRI documentIRI)Writers may override this method to handle an "endDocument" extraction event.booleanisAnnotated()Iftruethen the produced RDF is annotated with the extractors used to generate the specific statements.voidopenContext(ExtractionContext context)Writers may override this method to handle an "openContext" extraction event.voidsetAnnotated(boolean f)Sets the annotation flag.voidstartDocument(org.eclipse.rdf4j.model.IRI documentIRI)Writers may override this method to handle a "startDocument" extraction event.voidwriteNamespace(String prefix, String uri)Writes a prefix-namespace mapping.voidwriteTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.Resource g)Writes a triple and, optionally, a graph resource name.- 
Methods inherited from class org.apache.any23.writer.TripleWriterHandlerreceiveNamespace, receiveTriple, setContentLength
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.any23.writer.TripleHandlerreceiveNamespace, receiveTriple, setContentLength
 
- 
 
- 
- 
- 
Method Detail- 
isAnnotatedpublic boolean isAnnotated() Iftruethen the produced RDF is annotated with the extractors used to generate the specific statements.- Specified by:
- isAnnotatedin interface- FormatWriter
- Returns:
- the annotation flag value.
 
 - 
setAnnotatedpublic void setAnnotated(boolean f) Sets the annotation flag.- Specified by:
- setAnnotatedin interface- FormatWriter
- Parameters:
- f- If- truethen the produced RDF is annotated with the extractors used to generate the specific statements.
 
 - 
startDocumentpublic void startDocument(org.eclipse.rdf4j.model.IRI documentIRI) throws TripleHandlerExceptionDescription copied from class:TripleWriterHandlerWriters may override this method to handle a "startDocument" extraction event. The default implementation does nothing.- Specified by:
- startDocumentin interface- TripleHandler
- Overrides:
- startDocumentin class- TripleWriterHandler
- Parameters:
- documentIRI- the name of the document that was started
- Throws:
- TripleHandlerException- if an error occurred while responding to a "startDocument" extraction event.
 
 - 
openContextpublic void openContext(ExtractionContext context) throws TripleHandlerException Description copied from class:TripleWriterHandlerWriters may override this method to handle an "openContext" extraction event. The default implementation does nothing.- Specified by:
- openContextin interface- TripleHandler
- Overrides:
- openContextin class- TripleWriterHandler
- Parameters:
- context- the context that was opened
- Throws:
- TripleHandlerException- if an error occurred while responding to a "startDocument" extraction event.
 
 - 
writeTriplepublic void writeTriple(org.eclipse.rdf4j.model.Resource s, org.eclipse.rdf4j.model.IRI p, org.eclipse.rdf4j.model.Value o, org.eclipse.rdf4j.model.Resource g) throws TripleHandlerExceptionDescription copied from interface:TripleWriterWrites a triple and, optionally, a graph resource name.- Specified by:
- writeTriplein interface- TripleWriter
- Parameters:
- s- the subject to write
- p- the predicate to write
- o- the object to write
- g- the graph name to write, or null
- Throws:
- TripleHandlerException- if there is an error writing the triple
 
 - 
writeNamespacepublic void writeNamespace(String prefix, String uri) throws TripleHandlerException Description copied from interface:TripleWriterWrites a prefix-namespace mapping.
 NOTE: this method should be called before writing out any triples. Calling this method after writing out a triple may result in the prefix-namespace mapping being ignored.- Specified by:
- writeNamespacein interface- TripleWriter
- Parameters:
- prefix- the namespace prefix
- uri- the namespace uri
- Throws:
- TripleHandlerException- if there was an error writing out the prefix-namespace mapping
 
 - 
closeContextpublic void closeContext(ExtractionContext context) throws TripleHandlerException Description copied from class:TripleWriterHandlerWriters may override this method to handle a "closeContext" extraction event. The default implementation does nothing.- Specified by:
- closeContextin interface- TripleHandler
- Overrides:
- closeContextin class- TripleWriterHandler
- Parameters:
- context- the context to be closed.
- Throws:
- TripleHandlerException- if an error occurred while responding to a "closeContext" extraction event.
 
 - 
closepublic void close() throws TripleHandlerExceptionDescription copied from interface:TripleHandlerWill be called last and exactly once.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- TripleHandler
- Specified by:
- closein interface- TripleWriter
- Throws:
- TripleHandlerException- if there is an error closing the- TripleHandlerimplementation.
 
 - 
endDocumentpublic void endDocument(org.eclipse.rdf4j.model.IRI documentIRI) throws TripleHandlerExceptionDescription copied from class:TripleWriterHandlerWriters may override this method to handle an "endDocument" extraction event. The default implementation does nothing.- Specified by:
- endDocumentin interface- TripleHandler
- Overrides:
- endDocumentin class- TripleWriterHandler
- Parameters:
- documentIRI- the document IRI.
- Throws:
- TripleHandlerException- if an error occurred while responding to a "endDocument" extraction event.
 
 
- 
 
-