| SERD-PIPE(1) | General Commands Manual | SERD-PIPE(1) |
serd-pipe —
serd-pipe |
[-ChV] [-B
base] [-I
syntax] [-O
syntax] [-R
root] [-b
bytes] [-k
bytes] [-o
filename] [-s
string] input ... |
serd-pipe is a fast command-line utility for streaming
RDF data. It reads one or more files and writes the data again, possibly in a
different form. By default, the input syntax is guessed from the file
extension, and line-based output is written to standard output.
serd-pipe writes statements as they are
read, in the same order. It uses very little memory and can process
arbitrarily large files, either directly or as part of a pipeline. It is
useful for things like checking syntax, converting to a different syntax,
pretty-printing documents, merging files, expanding URIs, and so on.
The simplest way to use serd-pipe is by
giving files for both input and output. This way, reasonable options are
chosen by default based on the filename. For example, most common tasks can
be accomplished with simple commands like
$ serd-pipe -o pretty.ttl
input.ntStandard input can be read by using - instead of a filename, and giving the input syntax explicitly:
$ cat file.ttl | serd-pipe -I turtle
-The options are as follows:
-B
baserebase to use the output path.
This is used to resolve any relative URI references in the input.
If the input is a file, its URI is used as the base by
default. This causes relative references to be written just as they are
in the input. Note, however, that this may not be desired if the output
is in a different directory. For example,
<file.ttl> would not point to the same
file from the new location.
The special rebase argument will
instead use the output filename set by the -o
option. This will write references relative to the output file, so that
parsing it will produce the same absolute URIs as the original input.
For example, the above may be written as
<../file.ttl> if the output is written to
some sibling directory.
Generally, the default is best when copying data along with
other bundled files, while rebase is best for
writing data in a new location which still refers to the original
paths.
These options are intended to make the most common tasks as simple as possible. An arbitrary base URI can also be given explicitly.
-C-I
syntaxNQuads, NTriples,
TriG, Turtle, or one of
the following options:
laxvariables?name or
$name.
relativeglobalf1 is added to blank node labels when reading
multiple files, to prevent labels in different files from clashing.
This option disables that, so blank node labels will be passed through
without any added prefix. Note that this may corrupt the output by
merging distinct blank nodes.
generatedb123
are adapted to avoid potential clashes with generated ones. This flag
disables that, so such labels will be passed through exactly as they
are in the input. Note that this may corrupt the output by merging
distinct blank nodes.-O
syntaxempty, NQuads,
NTriples, TriG,
Turtle, or one of the following options:
ascii\U00B7 or
\U0001F600.
contextualexpandedverbatimterselaxThe empty syntax suppresses the
output, so that only warnings and errors will be printed.
-R
rootFor example, if /home/you/file.ttl is
written to the file /home/me/output.ttl using
-B rebase, then it will
be written as <../you/file.ttl>. Setting
-R /home/me/ would
prevent references from “escaping” like this, so the above
would instead be written as
<file:///home/you/file.ttl>.
This is useful for making relocatable “bundles” of resources, since it can keep all relative references within the bundle, while still allowing up-references to be used.
-V-b
bytes-h-k
bytes-o
filename-s
stringNO_COLORCLICOLORCLICOLOR_FORCESee http://no-color.org/ and https://bixense.com/clicolors/ for details.
serd-pipe exits with a status of 0, or non-zero if an
error occured.
$ serd-pipe -O turtle
input.ntTo print only errors and discard the output:
$ serd-pipe -O empty
input.ttlTo pretty-print a file:
$ serd-pipe -o pretty.ttl
input.ttlTo expand all prefixed names into full URIs:
$ serd-pipe -O expanded -o
expanded.ttl input.ttlTo merge two files:
$ serd-pipe -o merged.ttl header.ttl
body.ttlserd-pipe is a part of serd, by David
Robillard
d@drobilla.net.
| August 12, 2021 | Serd 0.30.11 |