Package org.apache.any23.writer
Class RDFWriterTripleHandler
- java.lang.Object
-
- org.apache.any23.writer.TripleWriterHandler
-
- org.apache.any23.writer.RDFWriterTripleHandler
-
- All Implemented Interfaces:
AutoCloseable,org.apache.any23.writer.FormatWriter,org.apache.any23.writer.TripleHandler,org.apache.any23.writer.TripleWriter
- Direct Known Subclasses:
JSONLDWriter,NQuadsWriter,NTriplesWriter,RDFXMLWriter,TriXWriter,TurtleWriter
public abstract class RDFWriterTripleHandler extends TripleWriterHandler implements org.apache.any23.writer.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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseContext(org.apache.any23.extractor.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(org.apache.any23.extractor.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)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)-
Methods inherited from class org.apache.any23.writer.TripleWriterHandler
receiveNamespace, receiveTriple, setContentLength
-
-
-
-
Method Detail
-
isAnnotated
public boolean isAnnotated()
Iftruethen the produced RDF is annotated with the extractors used to generate the specific statements.- Specified by:
isAnnotatedin interfaceorg.apache.any23.writer.FormatWriter- Returns:
- the annotation flag value.
-
setAnnotated
public void setAnnotated(boolean f)
Sets the annotation flag.- Specified by:
setAnnotatedin interfaceorg.apache.any23.writer.FormatWriter- Parameters:
f- Iftruethen the produced RDF is annotated with the extractors used to generate the specific statements.
-
startDocument
public void startDocument(org.eclipse.rdf4j.model.IRI documentIRI) throws org.apache.any23.writer.TripleHandlerExceptionDescription copied from class:TripleWriterHandlerWriters may override this method to handle a "startDocument" extraction event. The default implementation does nothing.- Specified by:
startDocumentin interfaceorg.apache.any23.writer.TripleHandler- Overrides:
startDocumentin classTripleWriterHandler- Parameters:
documentIRI- the name of the document that was started- Throws:
org.apache.any23.writer.TripleHandlerException- if an error occurred while responding to a "startDocument" extraction event.
-
openContext
public void openContext(org.apache.any23.extractor.ExtractionContext context) throws org.apache.any23.writer.TripleHandlerExceptionDescription copied from class:TripleWriterHandlerWriters may override this method to handle an "openContext" extraction event. The default implementation does nothing.- Specified by:
openContextin interfaceorg.apache.any23.writer.TripleHandler- Overrides:
openContextin classTripleWriterHandler- Parameters:
context- the context that was opened- Throws:
org.apache.any23.writer.TripleHandlerException- if an error occurred while responding to a "startDocument" extraction event.
-
writeTriple
public 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 org.apache.any23.writer.TripleHandlerException- Specified by:
writeTriplein interfaceorg.apache.any23.writer.TripleWriter- Throws:
org.apache.any23.writer.TripleHandlerException
-
writeNamespace
public void writeNamespace(String prefix, String uri) throws org.apache.any23.writer.TripleHandlerException
- Specified by:
writeNamespacein interfaceorg.apache.any23.writer.TripleWriter- Throws:
org.apache.any23.writer.TripleHandlerException
-
closeContext
public void closeContext(org.apache.any23.extractor.ExtractionContext context) throws org.apache.any23.writer.TripleHandlerExceptionDescription copied from class:TripleWriterHandlerWriters may override this method to handle a "closeContext" extraction event. The default implementation does nothing.- Specified by:
closeContextin interfaceorg.apache.any23.writer.TripleHandler- Overrides:
closeContextin classTripleWriterHandler- Parameters:
context- the context to be closed.- Throws:
org.apache.any23.writer.TripleHandlerException- if an error occurred while responding to a "closeContext" extraction event.
-
close
public void close() throws org.apache.any23.writer.TripleHandlerException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.any23.writer.TripleHandler- Specified by:
closein interfaceorg.apache.any23.writer.TripleWriter- Throws:
org.apache.any23.writer.TripleHandlerException
-
endDocument
public void endDocument(org.eclipse.rdf4j.model.IRI documentIRI) throws org.apache.any23.writer.TripleHandlerExceptionDescription copied from class:TripleWriterHandlerWriters may override this method to handle an "endDocument" extraction event. The default implementation does nothing.- Specified by:
endDocumentin interfaceorg.apache.any23.writer.TripleHandler- Overrides:
endDocumentin classTripleWriterHandler- Parameters:
documentIRI- the document IRI.- Throws:
org.apache.any23.writer.TripleHandlerException- if an error occurred while responding to a "endDocument" extraction event.
-
-