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.
Modifier and Type | Field and Description |
---|---|
static File |
DEFAULT_OBFUSCATION |
Modifier and Type | Method and Description |
---|---|
Exporter |
context(Collection<Resource> theNamedGraphs)
Specify which contexts should be exported.
|
Exporter |
context(Resource theNG,
Resource... theOtherNamedGraphs)
Specify which contexts should be exported.
|
Exporter |
format(RDFFormat theFormat)
Specify the RDF format the export should use.
|
Exporter |
obfuscated(File theObfuscationConfig)
Export the RDF using the specified obfuscation configuration, or
DEFAULT_OBFUSCATION to use the default
configuration. |
void |
to(OutputStream theOutput)
Export the data back to the client and write it to the provided output.
|
String |
toServer()
Export the RDF to a file on the server.
|
static final File DEFAULT_OBFUSCATION
Exporter context(Resource theNG, Resource... theOtherNamedGraphs)
theNG
- the context to exporttheOtherNamedGraphs
- other contexts to exportExporter context(Collection<Resource> theNamedGraphs)
Contexts.LOCAL
will be assumed.theNamedGraphs
- the named graphs to exportExporter format(RDFFormat theFormat)
theFormat
- the formatExporter obfuscated(File theObfuscationConfig)
DEFAULT_OBFUSCATION
to use the default
configuration. When a file other than the default
is used, it must exist on the client.theObfuscationConfig
- the file to the configurationString toServer() throws StardogException
export.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.StardogException
- if an error occurred while performing the exportIllegalArgumentException
- if the file does not exist, cannot be written to, etc.IllegalStateException
- if a format
is specified
which
does not support contexts and named graphs have been specified
for the export or the entire database is to be exported and it contains one
or more named graphs.void to(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 as System.out
, you can wrap the stream with
UncloseableOutputStream
.
theOutput
- the stream to send the export toStardogException
- if an error occurred while performing the exportIllegalStateException
- if a format
is specified
which
does not support contexts and named graphs have been specified
for the export or the entire database is to be exported and it contains one
or more named graphs.Copyright © 2010-2016 Stardog Union. All Rights Reserved.