Interface Exporter
-
public interface Exporter
API for exporting RDF data in bulk from the server. By default this will export the entire database in TriG format, but specific contexts for export can be provided as well as where and how the export is done.
Care should be taken when constructing an export action. You can export the contents of a single named graph in a format that does not support contexts, such as Turtle, but you cannot export multiple named graphs, or similarly a database which has one or more named graphs, to Turtle or any other format which does not support named graphs.
- Since:
- 2.1.2
- Version:
- 6.0
- Author:
- Michael Grove
-
-
Field Summary
Fields Modifier and Type Field Description static java.io.File
DEFAULT_OBFUSCATION
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Exporter
context(Resource theNG, Resource... theOtherNamedGraphs)
Specify which contexts should be exported.Exporter
context(java.util.Collection<Resource> theNamedGraphs)
Specify which contexts should be exported.Exporter
format(RDFFormat theFormat)
Specify the RDF format the export should use.Exporter
obfuscated(java.io.File theObfuscationConfig)
Export the RDF using the specified obfuscation configuration, orDEFAULT_OBFUSCATION
to use the default configuration.void
to(java.io.OutputStream theOutput)
Export the data back to the client and write it to the provided output.java.lang.String
toServer()
Export the RDF to a file on the server.
-
-
-
Method Detail
-
context
Exporter context(Resource theNG, Resource... theOtherNamedGraphs)
Specify which contexts should be exported.- Parameters:
theNG
- the context to exporttheOtherNamedGraphs
- other contexts to export- Returns:
- this exporter
-
context
Exporter context(java.util.Collection<Resource> theNamedGraphs)
Specify which contexts should be exported. If an empty list is provided,Contexts.LOCAL
will be assumed.- Parameters:
theNamedGraphs
- the named graphs to export- Returns:
- this exporter
-
format
Exporter format(RDFFormat theFormat)
Specify the RDF format the export should use. When no format is specified, TriG will be used- Parameters:
theFormat
- the format- Returns:
- this exporter
-
obfuscated
Exporter obfuscated(java.io.File theObfuscationConfig)
Export the RDF using the specified obfuscation configuration, orDEFAULT_OBFUSCATION
to use the default configuration. When a file other than thedefault
is used, it must exist on the client.- Parameters:
theObfuscationConfig
- the file to the configuration- Returns:
- this exporter
-
toServer
java.lang.String toServer() throws StardogException
Export the RDF to a file on the server. Server side exports are saved to theexport.dir
as specified in the Stardog configuration file. This defaults to the.exports
directory in$STARDOG_HOME
. The name of exported file is$DB_NAME-$DATE
with an optional numeric postfix, such as .1, if there are multiple exports of a database in the same day.- Returns:
- the informational output from the server
- Throws:
StardogException
- if an error occurred while performing the exportjava.lang.IllegalArgumentException
- if the file does not exist, cannot be written to, etc.java.lang.IllegalStateException
- if aformat
isspecified
which does not support contexts and named graphs have beenspecified
for the export or the entire database is to be exported and it contains one or more named graphs.
-
to
void to(java.io.OutputStream theOutput) throws StardogException
Export the data back to the client and write it to the provided output.
The
OutputStream
provided to this method will be closed once the export is complete. If you are using a stream that you do not want closed, such asSystem.out
, you can wrap the stream withUncloseableOutputStream
.- Parameters:
theOutput
- the stream to send the export to- Throws:
StardogException
- if an error occurred while performing the exportjava.lang.IllegalStateException
- if aformat
isspecified
which does not support contexts and named graphs have beenspecified
for the export or the entire database is to be exported and it contains one or more named graphs.
-
-