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 -
Method Summary
Modifier and TypeMethodDescriptionSpecify which contexts should be exported.context(Collection<Resource> theNamedGraphs) Specify which contexts should be exported.Specify the RDF format the export should use.obfuscated(File theObfuscationConfig) Export the RDF using the specified obfuscation configuration, orDEFAULT_OBFUSCATIONto use the default configuration.voidto(OutputStream theOutput) Export the data back to the client and write it to the provided output.toServer()Export the RDF to a file on the server.
-
Field Details
-
DEFAULT_OBFUSCATION
-
-
Method Details
-
context
Specify which contexts should be exported.- Parameters:
theNG- the context to exporttheOtherNamedGraphs- other contexts to export- Returns:
- this exporter
-
context
Specify which contexts should be exported. If an empty list is provided,Contexts.LOCALwill be assumed.- Parameters:
theNamedGraphs- the named graphs to export- Returns:
- this exporter
-
format
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
Export the RDF using the specified obfuscation configuration, orDEFAULT_OBFUSCATIONto use the default configuration. When a file other than thedefaultis used, it must exist on the client.- Parameters:
theObfuscationConfig- the file to the configuration- Returns:
- this exporter
-
toServer
Export the RDF to a file on the server. Server side exports are saved to theexport.diras specified in the Stardog configuration file. This defaults to the.exportsdirectory in$STARDOG_HOME. The name of exported file is$DB_NAME-$DATEwith 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 exportIllegalArgumentException- if the file does not exist, cannot be written to, etc.IllegalStateException- if aformatisspecifiedwhich does not support contexts and named graphs have beenspecifiedfor the export or the entire database is to be exported and it contains one or more named graphs.
-
to
Export the data back to the client and write it to the provided output.
The
OutputStreamprovided 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 exportIllegalStateException- if aformatisspecifiedwhich does not support contexts and named graphs have beenspecifiedfor the export or the entire database is to be exported and it contains one or more named graphs.
-