Introduction

The AllegroGraph Exporter (agtool export) is a command-line utility for exporting data from a repository. It can use multiple CPU cores to export in parallel.

The agtool program is the general program for AllegroGraph command-line operations. (In earlier releases, there was a separate agexport program.)

Usage

agtool export [OPTIONS] REPO-SPEC FILE 

where REPO-SPEC identifies an AllegroGraph repository, along with the catalog, the host, and so on, see the REPO SPECs section of the agtool document for details. FILE is a file name.

For example, this command exports the triples from the lesmis repository into a file named lesmis.rdf using the RDF/XML format:

% agtool export --output rdfxml http://user1:my-pw@agmachine/repositories/lesmis lesmis.rdf 

The FILE argument

Note that if you use a dash (-) for the FILE argument, then agtool export will send the data to standard output. Parallel export is not possible in this case.

If exporting in parallel, then the FILE argument is used as a template for the output file names. For example, if exporting with 5 workers to /data/output/lubm.nt, then agtool export will send data to:

Options

The following options may be used with agtool export:

Repository options

In earlier releases, information now encoded in the REPO-SPEC argument was provided by the individual options --catalog, --server, --port, --user, and --password. These options are deprecated but are kept for backward compatibility. Using them signals a warning. If any is specified, the value must be the same as specified by the REPO-SPEC argument.

Main options

--save-metadata FILENAME
Save attribute definitions and the static filter to FILENAME. See Triple Attributes for information on attributes.
--blank-node-handling STYLE
Determine how blank nodes are treated when exporting in parallel.

This can be together or distribute. The first places all triples with blank nodes into the same export file whereas the second allows blank nodes to be distributed to multiple files. Note that if blank nodes are distributed, then the import process must be told to treat them as if they all come from the same context (cf. agtool load's job based bulk node strategy). The default is together.

-i IF-EXISTS, --if-exists IF-EXISTS
Controls how agtool export behaves when output files already exist. append If an export file exists, then append the new data to it. overwrite If an export file exists, then delete it and write the new data. fail If an export file exists, then do not export any data.

The default is to fail if any export files exist. Note that when exporting in parallel all of the output files are checked and the if-exists behavior applies to them as a group. I.e., if if-exists is fail then the export will fail if any of the output files already exists.

-o FORMAT, --output FORMAT
Set the output format. This can be one of:

Other options:

--compress
If specified, then the output file or files will be compressed using gzip. The default is to have no compression.
-n, --namespaces
Use namespace abbreviations when exporting (for Turtle and RDF/XML). The default is to not use namespaces.
--parallel
Use multiple output files and export workers (see --workers for greater control). The default is to export to a single file.
--workers COUNT
Specify the number of workers to use when exporting in parallel. The default value depends on the number of CPU cores in the machine doing the export.

Notes and examples:

example 1: Export the lubm-50 repository in turtle format in parallel with 15 workers. Several files will be written with names derived from the specified name l50.ttl, such as l50-1.ttl, l50-2.ttl, and so on. Any triples with a blank node will be written to the same file:

agtool export --output turtle --workers 15 http://user1:u1pw@localhost:9002/repositories/lubm-50 /disk1/mydir/DATA/l50.ttl 

example 2: Export the lubm-50 repository in the root catalog on www.example.com:10035 in parallel with blank nodes distributed across multiple files. Because the number of workers is not specified, agtool export will make its own determination based on the number of CPU cores. Any existing output files will be overwritten. The output type is not specified so will be NTriples. Output data will be compressed.

agtool export --if-exists overwrite \  
   --parallel \  
   --blank-node-handling distribute \  
   --compress \  
   http://test:[email protected]/repositories/lubm-50 \  
   /disk1/mydir/DATA/l50.nt.gz  

Footnotes