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
ATripleHandler
that 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 void
close()
void
closeContext(org.apache.any23.extractor.ExtractionContext context)
Writers may override this method to handle a "closeContext" extraction event.void
endDocument(org.eclipse.rdf4j.model.IRI documentIRI)
Writers may override this method to handle an "endDocument" extraction event.boolean
isAnnotated()
Iftrue
then the produced RDF is annotated with the extractors used to generate the specific statements.void
openContext(org.apache.any23.extractor.ExtractionContext context)
Writers may override this method to handle an "openContext" extraction event.void
setAnnotated(boolean f)
Sets the annotation flag.void
startDocument(org.eclipse.rdf4j.model.IRI documentIRI)
Writers may override this method to handle a "startDocument" extraction event.void
writeNamespace(String prefix, String uri)
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)
-
Methods inherited from class org.apache.any23.writer.TripleWriterHandler
receiveNamespace, receiveTriple, setContentLength
-
-
-
-
Method Detail
-
isAnnotated
public boolean isAnnotated()
Iftrue
then the produced RDF is annotated with the extractors used to generate the specific statements.- Specified by:
isAnnotated
in interfaceorg.apache.any23.writer.FormatWriter
- Returns:
- the annotation flag value.
-
setAnnotated
public void setAnnotated(boolean f)
Sets the annotation flag.- Specified by:
setAnnotated
in interfaceorg.apache.any23.writer.FormatWriter
- Parameters:
f
- Iftrue
then 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.TripleHandlerException
Description copied from class:TripleWriterHandler
Writers may override this method to handle a "startDocument" extraction event. The default implementation does nothing.- Specified by:
startDocument
in interfaceorg.apache.any23.writer.TripleHandler
- Overrides:
startDocument
in 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.TripleHandlerException
Description copied from class:TripleWriterHandler
Writers may override this method to handle an "openContext" extraction event. The default implementation does nothing.- Specified by:
openContext
in interfaceorg.apache.any23.writer.TripleHandler
- Overrides:
openContext
in 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:
writeTriple
in 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:
writeNamespace
in 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.TripleHandlerException
Description copied from class:TripleWriterHandler
Writers may override this method to handle a "closeContext" extraction event. The default implementation does nothing.- Specified by:
closeContext
in interfaceorg.apache.any23.writer.TripleHandler
- Overrides:
closeContext
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceorg.apache.any23.writer.TripleHandler
- Specified by:
close
in 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.TripleHandlerException
Description copied from class:TripleWriterHandler
Writers may override this method to handle an "endDocument" extraction event. The default implementation does nothing.- Specified by:
endDocument
in interfaceorg.apache.any23.writer.TripleHandler
- Overrides:
endDocument
in classTripleWriterHandler
- Parameters:
documentIRI
- the document IRI.- Throws:
org.apache.any23.writer.TripleHandlerException
- if an error occurred while responding to a "endDocument" extraction event.
-
-