Package org.apache.any23.writer
Interface TripleWriter
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
JSONLDWriter
,JSONWriter
,NQuadsWriter
,NTriplesWriter
,RDFWriterTripleHandler
,RDFXMLWriter
,TripleWriterHandler
,TriXWriter
,TurtleWriter
,URIListWriter
public interface TripleWriter extends AutoCloseable
Base interface for triple writers that don't need an extraction context to write triples- Author:
- Hans Brende (hansbrende@apache.org)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Releases resources associated with thisTripleWriter
, and flushes (but by default does not close) any underlyingOutputStream
s.void
writeNamespace(String prefix, String uri)
Writes a prefix-namespace mapping.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)
Writes a triple and, optionally, a graph resource name.
-
-
-
Method Detail
-
writeTriple
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 TripleHandlerException
Writes a triple and, optionally, a graph resource name.- Parameters:
s
- the subject to writep
- the predicate to writeo
- the object to writeg
- the graph name to write, or null- Throws:
TripleHandlerException
- if there is an error writing the triple
-
writeNamespace
void writeNamespace(String prefix, String uri) throws TripleHandlerException
Writes 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.- Parameters:
prefix
- the namespace prefixuri
- the namespace uri- Throws:
TripleHandlerException
- if there was an error writing out the prefix-namespace mapping
-
close
void close() throws TripleHandlerException
Releases resources associated with thisTripleWriter
, and flushes (but by default does not close) any underlyingOutputStream
s. Future invocations of methods of this writer produce undefined behavior after this method has been called.- Specified by:
close
in interfaceAutoCloseable
- Throws:
TripleHandlerException
- if there was an error closing thisTripleWriter
-
-