Skip to content

Export Directives

Export directives are used to write computation results to files.

Syntax

The syntax of an export directive is as follows:

@export <predicate> :- <format>{<parameter>=<value>, ...} .

For example, the following export writes a CSV file that contains two columns, with the first formatted as plain string and the second as an integer. The third parameter of the exported predicate result is skipped and will not be in the file:

@export result :- csv{resource="out.csv.gz", format=(string,int,skip)} .

The output will be gzipped (guessed from file name). Tuples that contain anything other than a string in the first component and an integer in the second will not be exported and ignored silently.

Formats

Currently the following formats are supported:

FormatDescription
csvComma-separated values.
dsvDelimited separated values. (Like csv, but allows specifying different delimiters)
rdfGeneric RDF format. This chooses either ntriples or nquads based on the arity of the predicate.
ntriplesRDF Ntriples format.
nquadsRDF NQuads format.
trigRDF TriG format.
rdfxmlRDF/XML format.
turtleRDF Turtle format.

Parameters

The following parameters are available for all formats:

ParameterDescription
resourceThe file name to write to. If it contains an extension, this is used to automatically set the compression parameter. If set to the empty string "", the tuples are directed to the standard output. If omitted, this is set based on the predicate name, file format and compression type: <predicate-name>.<format>.<compression>.
compressionThe compression to use. Currently only gzip or none is supported.
limitThe maximum number of tuples to export.

Besides the above, there are format-specific parameters:

ParameterFormatsDescription
delimiterdsvThe delimiter to use.
formatcsv, dsvThe output-format of the exported data. Might be int, double, string, rdf or skip.

When using the Nemo command-line client, some cli options are available to override the export directives in the program, to set the output (base) directory, and to control if existing files should be overwritten.