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:
Format | Parameters |
---|---|
csv | Comma-separated values. |
dsv | Delimited separated values. (Like csv , but allows specifying different delimiters e.g. delimiter=";" ) |
tsv | Tab-separated values. |
rdf | Generic RDF format. The actual format will be guessed using the file name. |
nquads | RDF NQuads format. |
trig | RDF TriG format. |
ntriples | RDF Ntriples format |
rdfxml | RDF/XML format. |
turtle | RDF Turtle format. |
Available parameters
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
ignore_headers if true , the first record (containing the column headers) is ignored Accepted type(s): Boolean |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
delimiter The delimiter to use. Accepted type(s): Character |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
ignore_headers if true , the first record (containing the column headers) is ignored Accepted type(s): Boolean |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
ignore_headers if true , the first record (containing the column headers) is ignored Accepted type(s): Boolean |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
base Specify the base IRI to be used when importing RDF data; if given, relative IRIs will be made absolute based on this base; otherwise, relative IRIs remain relative in Nemo Accepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
base Specify the base IRI to be used when importing RDF data; if given, relative IRIs will be made absolute based on this base; otherwise, relative IRIs remain relative in Nemo Accepted type(s): String |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
base Specify the base IRI to be used when importing RDF data; if given, relative IRIs will be made absolute based on this base; otherwise, relative IRIs remain relative in Nemo Accepted type(s): String |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
base Specify the base IRI to be used when importing RDF data; if given, relative IRIs will be made absolute based on this base; otherwise, relative IRIs remain relative in Nemo Accepted type(s): String |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
base Specify the base IRI to be used when importing RDF data; if given, relative IRIs will be made absolute based on this base; otherwise, relative IRIs remain relative in Nemo Accepted type(s): String |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
resource The 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 read from stdin .
This is restricted to one stdin resource per program. If omitted, this is set based on the predicate name,
file format and compression type <predicate-name>.<format>.<compression> .Accepted type(s): IRI, String |
format The input-format of the imported data. Might be int , double , string , rdf or skip .Accepted type(s): Tuple of Nemo type names, Nemo type name |
compression The compression to use. Currently only gzip or none is supported. '
This will normally be guessed correctly from the file extension,
but can be useful for non-standard file names or URLs.Accepted type(s): String |
limit The maximum number of tuples to import. (great for testing when working with large files) Accepted type(s): Unsigned integer |
base Specify the base IRI to be used when importing RDF data; if given, relative IRIs will be made absolute based on this base; otherwise, relative IRIs remain relative in Nemo Accepted type(s): String |
http_headers Each pair is added as HTTP headers when making an HTTP request Accepted type(s): Map with key-value pairs that can be of type: String, Constant or Number Example: http_headers=("Accept-Language"="en-US","Accept-Charset="utf-8") |
http_get_parameters The map will be flattened into pairs that are appended to the IRI before making an HTTP request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_get_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
http_post_parameters The map will be flattened into pairs that are sent as the body of an HTTP POST request Accepted type(s): Map where each key is of type String, Constant or Number and each value is a (possibly unary) tuple containing Strings, Numbers and Constants. Example: http_post_parameters={name="John Doe", age=42, parent=("Johanna Doe", "Josh Doe")} |
iri_fragment A fragment that is appended to a resource or endpoint IRIAccepted type(s): String |
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.
The parameters in export directives can also make use of format strings, e.g.,
@export table :- csv{resource = f"file-{?x}-{?y}.csv"}, ?x = "name", ?y = 42 .