serdi
— read and
write RDF syntax
serdi |
[-abefhlqv ] [-c
prefix] [-i
syntax] [-o
syntax] [-p
prefix] [-r
root] [-s
string] input
[base_uri] |
serdi
is a fast command-line utility for
streaming and processing RDF data. It reads an RDF document and writes the
data to stdout, possibly transformed and/or in a different syntax. By
default, the input syntax is guessed from the file extension, and output is
written in NTriples or NQuads.
serdi
can be used to check for syntax
errors, convert from one syntax to another, pretty-print documents, or
transform URIs and blank node IDs.
The options are as follows:
-a
- Write ASCII output. If this is enabled, all non-ASCII characters will be
escaped, even if the output syntax allows them to be written in UTF-8.
-b
- Bulk output writing. If this is enabled, output will be written a page at
a time, rather than a byte at a time.
-c
prefix
- Chop prefix from matching blank node IDs. This is
the inverse of
-p
.
-e
- Eat input one character at a time, rather than a page at a time which is
the default. This is useful when reading from a pipe since output will be
generated immediately as input arrives, rather than waiting until an
entire page of input has arrived. With this option serdi uses one page
less memory, but will likely be significantly slower.
-f
- Keep full URIs in input (don't qualify with namespace prefixes or make
URIs relative).
-h
- Print the command line options.
-i
syntax
- Read input as syntax. Case is ignored, valid values
are: “NQuads”, “NTriples”,
“TriG”, “Turtle”.
-l
- Lax (non-strict) parsing. If this is enabled, recoverable syntax errors
will print a warning, but parsing will proceed starting at the next
statement if possible. Note that data may be lost when using this option.
-o
syntax
- Write output as syntax. Case is ignored, valid
values are: “NQuads”, “NTriples”,
“TriG”, “Turtle”.
-p
prefix
- Add prefix to blank node IDs. This can be used to
avoid clashes between blank node IDs in input documents.
-q
- Suppress all output except data.
-r
root
- Keep relative URIs within a root URI. This will
avoid creating any relative URI references with leading path segments like
“../” that enter a parent of root.
-s
string
- Parse string input instead of a file (terminates
options).
-v
- Display version information and exit.
serdi
exits with a status of 0, or
non-zero if an error occurred.
To pretty-print a document:
$ serdi -o turtle file.ttl >
out.ttl
To print any errors:
$ serdi file.ttl >
/dev/null