aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-10-21 15:38:10 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commitb404312686874e539b617d1f27ccbaa5a82936af (patch)
treec2fdb2cc046e6da53071629cd1750dcc327e6cd9 /doc
parentd4aec28ba8ad24d5aef3ee12beeb1b805148eab1 (diff)
downloadserd-b404312686874e539b617d1f27ccbaa5a82936af.tar.gz
serd-b404312686874e539b617d1f27ccbaa5a82936af.tar.bz2
serd-b404312686874e539b617d1f27ccbaa5a82936af.zip
Replace serdi with more fine-grained tools
Especially with the new functionality, the complexity of the command-line interface alone was really becoming unmanageable. The serdi implementation also had the highest cyclomatic complexity of the entire codebase by a huge margin. So, take a page from the Unix philosophy and split serdi into several more finely-honed tools that can be freely composed. Though there is still unfortunately quite a bit of option overlap between them due to the common details of reading RDF, I think the resulting tools are a lot easier to understand, both from a user and a developer perspective.
Diffstat (limited to 'doc')
-rw-r--r--doc/serd-filter.1185
-rw-r--r--doc/serd-pipe.1349
-rw-r--r--doc/serd-sort.1194
-rw-r--r--doc/serdi.1265
4 files changed, 728 insertions, 265 deletions
diff --git a/doc/serd-filter.1 b/doc/serd-filter.1
new file mode 100644
index 00000000..44b3f861
--- /dev/null
+++ b/doc/serd-filter.1
@@ -0,0 +1,185 @@
+.Dd October 21, 2021
+.Dt SERD-FILTER 1
+.Os Serd
+.Sh NAME
+.Nm serd-filter
+.Nd print RDF statements that match a pattern
+.Sh SYNOPSIS
+.Nm serd-filter
+.Op Fl hVv
+.Op Fl B Ar base
+.Op Fl I Ar syntax
+.Op Fl O Ar syntax
+.Op Fl b Ar bytes
+.Op Fl f Ar pattern_file
+.Op Fl k Ar bytes
+.Op Fl o Ar filename
+.Ar pattern
+.Ar input ...
+.Sh DESCRIPTION
+.Nm
+scans for statements in RDF data.
+Its interface is similar to
+.Xr grep 1 ,
+except patterns are structural:
+instead of matching characters within a line,
+.Nm
+matches nodes within a statement.
+.Pp
+Data is read from files or standard input,
+and only those statements that match the pattern
+(or do not match the pattern, if
+.Fl v
+is given) are written.
+By default,
+the input syntax is guessed from the file extension,
+and line-based output is written to standard output.
+.Pp
+Patterns are written in NTriples or NQuads with an extension that allows variables like
+.Li ?some
+or
+.Li $thing .
+.Pp
+The
+.Ar input
+operands are processed in command-line order.
+If
+.Ar input
+is
+.Ar -
+or absent,
+.Nm
+reads from standard input.
+.Pp
+The options are as follows:
+.Pp
+.Bl -tag -compact -width 3n
+.It Fl B Ar base
+Base URI, path, or
+.Cm rebase
+to use the output path.
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl I Ar syntax
+Input syntax or option:
+.Cm NQuads ,
+.Cm NTriples ,
+.Cm TriG ,
+.Cm Turtle ,
+.Cm lax ,
+.Cm variables ,
+.Cm relative ,
+or
+.Cm labels .
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl O Ar syntax
+Output syntax or option:
+.Cm empty ,
+.Cm NQuads ,
+.Cm NTriples ,
+.Cm TriG ,
+.Cm Turtle ,
+.Cm ascii ,
+.Cm expanded ,
+.Cm verbatim ,
+.Cm terse ,
+or
+.Cm lax .
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl V
+Display version information and exit.
+.Pp
+.It Fl b Ar bytes
+I/O block size.
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl f Ar pattern_file
+Load pattern from
+.Ar pattern_file
+instead of the first positional argument.
+.Pp
+.It Fl h
+Print the command line options.
+.Pp
+.It Fl k Ar bytes
+Parser stack size.
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl o Ar filename
+Write output to the given
+.Ar filename
+instead of stdout.
+.Pp
+.It Fl v
+Invert filter to only emit statements that do
+.Em not
+match the pattern.
+.El
+.Sh EXIT STATUS
+.Nm
+exits with a status of 0, or non-zero if an error occured.
+.Sh EXAMPLES
+To print all type statements:
+.Pp
+.Dl $ serd-filter '?subject a ?type .' input.ttl
+.Pp
+To print every statement about http://example.org/subject:
+.Pp
+.Dl $ serd-filter '<http://example.org/subject> ?p ?o .' input.ttl
+.Sh SEE ALSO
+.Bl -item -compact
+.It
+.Xr serd-pipe 1
+.It
+.Xr serd-sort 1
+.It
+.Lk http://drobilla.net/software/serd/
+.El
+.Sh STANDARDS
+.Bl -item -compact
+.It
+.Rs
+.%A W3C
+.%T RDF 1.1 NQuads
+.%D February 2014
+.Re
+.Lk https://www.w3.org/TR/n-quads/
+.It
+.Rs
+.%A W3C
+.%D February 2014
+.%T RDF 1.1 NTriples
+.Re
+.Lk https://www.w3.org/TR/n-triples/
+.It
+.Rs
+.%A W3C
+.%T RDF 1.1 TriG
+.%D February 2014
+.Re
+.Lk https://www.w3.org/TR/trig/
+.It
+.Rs
+.%A W3C
+.%D February 2014
+.%T RDF 1.1 Turtle
+.Re
+.Lk https://www.w3.org/TR/turtle/
+.El
+.Sh AUTHORS
+.Nm
+is a part of serd, by
+.An David Robillard
+.Mt d@drobilla.net .
diff --git a/doc/serd-pipe.1 b/doc/serd-pipe.1
new file mode 100644
index 00000000..c7f77c9e
--- /dev/null
+++ b/doc/serd-pipe.1
@@ -0,0 +1,349 @@
+.Dd October 21, 2021
+.Dt SERD-PIPE 1
+.Os Serd
+.Sh NAME
+.Nm serd-pipe
+.Nd read and write RDF data
+.Sh SYNOPSIS
+.Nm serd-pipe
+.Op Fl ChV
+.Op Fl B Ar base
+.Op Fl I Ar syntax
+.Op Fl O Ar syntax
+.Op Fl R Ar root
+.Op Fl b Ar bytes
+.Op Fl k Ar bytes
+.Op Fl o Ar filename
+.Op Fl s Ar string
+.Op Ar input ...
+.Sh DESCRIPTION
+.Nm
+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.
+.Pp
+.Nm
+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.
+.Pp
+The simplest usage is to use 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:
+.Pp
+.Dl $ serd-pipe -o pretty.ttl input.nt
+.Pp
+The
+.Ar input
+operands are processed in command-line order.
+If
+.Ar input
+is
+.Ar -
+or absent,
+.Nm
+reads from standard input.
+.Pp
+The options are as follows:
+.Pp
+.Bl -tag -compact -width 3n
+.It Fl B Ar base
+Base URI, path, or
+.Cm rebase
+to use the output path.
+This is used to resolve any relative URI references in the input.
+.Pp
+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,
+.Li <file.ttl>
+would not point to the same file from the new location.
+.Pp
+The special
+.Cm rebase
+argument will instead use the output filename set by the
+.Fl 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
+.Li <../file.ttl>
+if the output is written to some sibling directory.
+.Pp
+Generally, the default is best when copying data along with other bundled files,
+while
+.Cm rebase
+is best for writing data in a new location which still refers to the original paths.
+.Pp
+These options are intended to make the most common tasks as simple as possible.
+An arbitrary base URI can also be given explicitly.
+.Pp
+.It Fl C
+Convert literals to canonical form.
+Literals with supported XSD datatypes will be parsed and rewritten canonically.
+Invalid literals will cause an error.
+All numeric datatypes are supported, as well as
+.Vt boolean ,
+.Vt duration ,
+.Vt datetime ,
+.Vt time ,
+.Vt hexBinary ,
+and
+.Vt base64Binary .
+.Pp
+.It Fl I Ar syntax
+Set an input syntax or option.
+May be given multiple times.
+The case-insensitive
+.Ar syntax
+can be
+.Cm NQuads ,
+.Cm NTriples ,
+.Cm TriG ,
+.Cm Turtle ,
+or one of the following options:
+.Pp
+.Bl -tag -width "QvariablesQ" -compact -offset indent
+.It Cm lax
+Tolerate invalid input where possible.
+Warnings will be printed for syntax errors,
+but parsing will attempt to continue.
+Note that data may be lost when using this option!
+.Pp
+.It Cm variables
+Support parsing variable nodes.
+Variables can be written in SPARQL style, for example
+.Li ?name
+or
+.Li $name .
+.Pp
+.It Cm relative
+Read relative URI references exactly without resolving them.
+Normally, all relative URIs are expanded against the base URI when reading.
+This flag disables that,
+so URI references will be passed through exactly as they are in the input.
+.Pp
+.It Cm global
+Assume a clean global namespace for blank node labels,
+and do not automatically add prefixes.
+Normally,
+a prefix like
+.Li f1
+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.
+.Pp
+.It Cm generated
+Read seemingly generated blank node labels exactly without adjusting them.
+Normally, blank node labels like
+.Li b123
+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.
+.El
+.Pp
+.It Fl O Ar syntax
+Set an output syntax or option.
+May be given multiple times.
+The case-insensitive
+.Ar syntax
+can be
+.Cm empty ,
+.Cm NQuads ,
+.Cm NTriples ,
+.Cm TriG ,
+.Cm Turtle ,
+or one of the following options:
+.Pp
+.Bl -tag -width "QverbatimQ" -compact -offset indent
+.It Cm ascii
+Escape all non-ASCII characters.
+Normally, text is written in UTF-8.
+This flag will escape non-ASCII characters in text as Unicode code points like
+.Li \eU00B7 or
+.Li \eU0001F600 .
+.Pp
+.It Cm expanded
+Write expanded URIs instead of prefixed names.
+.Pp
+.It Cm verbatim
+Write URI references exactly as they are in the input.
+This avoids resolving URIs and making them relative to the output base URI.
+.Pp
+.It Cm terse
+Write terser output without newlines.
+This can be useful for writing a line-based description of suitably structured data.
+.Pp
+.It Cm lax
+Tolerate invalid UTF-8 by writing the replacement character when necessary.
+Note that data may be lost when using this option!
+.El
+.Pp
+The
+.Cm empty
+syntax suppresses the output,
+so that only warnings and errors will be printed.
+.Pp
+.It Fl R Ar root
+Keep relative URIs within a
+.Ar root
+URI.
+This will avoid creating any relative URI references with leading path segments like
+.Pa ../
+that enter a parent of
+.Ar root .
+.Pp
+For example,
+if
+.Pa /home/you/file.ttl
+is written to the file
+.Pa /home/me/output.ttl
+using
+.Fl B Cm rebase ,
+then it will be written as
+.Li <../you/file.ttl> .
+Setting
+.Fl R Pa /home/me/
+would prevent references from
+.Dq escaping
+like this,
+so the above would instead be written as
+.Li <file:///home/you/file.ttl> .
+.Pp
+This is useful for making relocatable
+.Dq bundles
+of resources,
+since it can keep all relative references within the bundle,
+while still allowing up-references to be used.
+.Pp
+.It Fl V
+Display version information and exit.
+.Pp
+.It Fl b Ar bytes
+I/O block size.
+This is the number of bytes in a file that will be read or written at once.
+The default is 4096, which should perform well in most cases.
+Note that this only applies to files, standard input and output are always processed one byte at a time.
+.Pp
+.It Fl h
+Print the command line options.
+.Pp
+.It Fl k Ar bytes
+Parser stack size.
+For performance and security reasons, parsing is performed with a fixed-size stack.
+This option sets a hard limit on the total amount of space used for parsing.
+The default is 1 megabyte, which should be more than enough for most data.
+This option can be used to reduce memory consumption,
+or to enable parsing documents with extremely deep nesting or extremely large literal values.
+.Pp
+.It Fl o Ar filename
+Write output to the given
+.Ar filename
+instead of stdout.
+.Pp
+.It Fl s Ar string
+Parse
+.Ar string
+as input.
+.El
+.Sh ENVIRONMENT
+Error messages and warnings are printed in color by default if the output is a terminal.
+This can be controlled by common environment variables:
+.Pp
+.Bl -tag -compact -width 14n
+.It Ev NO_COLOR
+If present (regardless of value), color is disabled.
+.It Ev CLICOLOR
+If set to 0, color is disabled.
+.It Ev CLICOLOR_FORCE
+If set to anything other than 0, color is forced on.
+.El
+.Pp
+See
+.Lk http://no-color.org/
+and
+.Lk https://bixense.com/clicolors/
+for details.
+.Sh EXIT STATUS
+.Nm
+exits with a status of 0, or non-zero if an error occured.
+.Sh EXAMPLES
+To print an NTriples file as Turtle:
+.Pp
+.Dl $ serd-pipe -O turtle input.nt
+.Pp
+To print only errors and discard the output:
+.Pp
+.Dl $ serd-pipe -O empty input.ttl
+.Pp
+To pretty-print a file:
+.Pp
+.Dl $ serd-pipe -o pretty.ttl input.ttl
+.Pp
+To expand all prefixed names into full URIs:
+.Pp
+.Dl $ serd-pipe -O expanded -o expanded.ttl input.ttl
+.Pp
+To merge two files:
+.Pp
+.Dl $ serd-pipe -o merged.ttl header.ttl body.ttl
+.Sh SEE ALSO
+.Bl -item -compact
+.It
+.Xr serd-filter 1
+.It
+.Xr serd-sort 1
+.It
+.Lk http://drobilla.net/software/serd/
+.El
+.Sh STANDARDS
+.Bl -item -compact
+.It
+.Rs
+.%A W3C
+.%T RDF 1.1 NQuads
+.%D February 2014
+.Re
+.Lk https://www.w3.org/TR/n-quads/
+.It
+.Rs
+.%A W3C
+.%D February 2014
+.%T RDF 1.1 NTriples
+.Re
+.Lk https://www.w3.org/TR/n-triples/
+.It
+.Rs
+.%A W3C
+.%T RDF 1.1 TriG
+.%D February 2014
+.Re
+.Lk https://www.w3.org/TR/trig/
+.It
+.Rs
+.%A W3C
+.%D February 2014
+.%T RDF 1.1 Turtle
+.Re
+.Lk https://www.w3.org/TR/turtle/
+.El
+.Sh AUTHORS
+.Nm
+is a part of serd, by
+.An David Robillard
+.Mt d@drobilla.net .
diff --git a/doc/serd-sort.1 b/doc/serd-sort.1
new file mode 100644
index 00000000..2d019ae3
--- /dev/null
+++ b/doc/serd-sort.1
@@ -0,0 +1,194 @@
+.Dd October 21, 2021
+.Dt SERD-SORT 1
+.Os Serd
+.Sh NAME
+.Nm serd-sort
+.Nd reorder RDF statements
+.Sh SYNOPSIS
+.Nm serd-sort
+.Op Fl htV
+.Op Fl B Ar base
+.Op Fl I Ar syntax
+.Op Fl O Ar syntax
+.Op Fl b Ar bytes
+.Op Fl c Ar collation
+.Op Fl f Ar pattern_file
+.Op Fl k Ar bytes
+.Op Fl o Ar filename
+.Ar pattern
+.Ar input ...
+.Sh DESCRIPTION
+.Nm
+reorders statements in RDF data by loading everything into memory then rewriting it.
+By default,
+a
+.Dq pretty
+ordering is used which is ideal for pretty-printing to Turtle or TriG.
+The
+.Fl c
+option can be used to request a specific ordering,
+which is mainly useful when emitting a line-based syntax like NTriples or NQuads in a pipeline.
+.Pp
+The
+.Ar input
+operands are processed in command-line order.
+If
+.Ar input
+is
+.Ar -
+or absent,
+.Nm
+reads from standard input.
+.Pp
+The options are as follows:
+.Pp
+.Bl -tag -compact -width 3n
+.It Fl B Ar base
+Base URI, path, or
+.Cm rebase
+to use the output path.
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl I Ar syntax
+Input syntax or option:
+.Cm NQuads ,
+.Cm NTriples ,
+.Cm TriG ,
+.Cm Turtle ,
+.Cm lax ,
+.Cm variables ,
+.Cm relative ,
+or
+.Cm labels .
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl O Ar syntax
+Output syntax or option:
+.Cm empty ,
+.Cm NQuads ,
+.Cm NTriples ,
+.Cm TriG ,
+.Cm Turtle ,
+.Cm ascii ,
+.Cm expanded ,
+.Cm verbatim ,
+.Cm terse ,
+or
+.Cm lax .
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl V
+Display version information and exit.
+.Pp
+.It Fl b Ar bytes
+I/O block size.
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl c Ar collation
+A specific collation (statement ordering) to use.
+This can be any ordering of the characters
+.Dq SPO ,
+which stand for the subject, predicate, and object of statements.
+Optionally,
+.Dq G
+can be added as the first character,
+which will sort graph-first.
+Concretely, the valid values are:
+.Cm SPO ,
+.Cm SOP ,
+.Cm OPS ,
+.Cm OSP ,
+.Cm PSO ,
+.Cm POS ,
+.Cm GSPO ,
+.Cm GSOP ,
+.Cm GOPS ,
+.Cm GOSP ,
+.Cm GPSO ,
+and
+.Cm GPOS .
+.Pp
+.It Fl h
+Print the command line options.
+.Pp
+.It Fl k Ar bytes
+Parser stack size.
+See
+.Xr serd-pipe 1
+for details.
+.Pp
+.It Fl o Ar filename
+Write output to the given
+.Ar filename
+instead of stdout.
+.Pp
+.It Fl t
+Do not write type as
+.Dq a
+before other properties.
+Instead, rdf:type will be written in order like any other property.
+.El
+.Sh EXIT STATUS
+.Nm
+exits with a status of 0, or non-zero if an error occured.
+.Sh EXAMPLES
+To pretty-print a file:
+.Pp
+.Dl $ serd-sort -o pretty.ttl input.ttl
+.Pp
+To print statements ordered by predicate, subject, then object:
+.Pp
+.Dl $ serd-sort -c PSO input.ttl
+.Sh SEE ALSO
+.Bl -item -compact
+.It
+.Xr serd-pipe 1
+.It
+.Xr serd-filter 1
+.It
+.Lk http://drobilla.net/software/serd/
+.El
+.Sh STANDARDS
+.Bl -item -compact
+.It
+.Rs
+.%A W3C
+.%T RDF 1.1 NQuads
+.%D February 2014
+.Re
+.Lk https://www.w3.org/TR/n-quads/
+.It
+.Rs
+.%A W3C
+.%D February 2014
+.%T RDF 1.1 NTriples
+.Re
+.Lk https://www.w3.org/TR/n-triples/
+.It
+.Rs
+.%A W3C
+.%T RDF 1.1 TriG
+.%D February 2014
+.Re
+.Lk https://www.w3.org/TR/trig/
+.It
+.Rs
+.%A W3C
+.%D February 2014
+.%T RDF 1.1 Turtle
+.Re
+.Lk https://www.w3.org/TR/turtle/
+.El
+.Sh AUTHORS
+.Nm
+is a part of serd, by
+.An David Robillard
+.Mt d@drobilla.net .
diff --git a/doc/serdi.1 b/doc/serdi.1
deleted file mode 100644
index c6356953..00000000
--- a/doc/serdi.1
+++ /dev/null
@@ -1,265 +0,0 @@
-.Dd April 14, 2021
-.Dt SERDI 1
-.Os Serd 0.30.11
-.Sh NAME
-.Nm serdi
-.Nd read, filter, transform, and write RDF data
-.Sh SYNOPSIS
-.Nm serdi
-.Op Fl Cfhmqv
-.Op Fl F Ar pattern | Fl G Ar pattern
-.Op Fl I Ar base
-.Op Fl b Ar bytes
-.Op Fl i Ar syntax
-.Op Fl k Ar bytes
-.Op Fl o Ar syntax
-.Op Fl r Ar root
-.Op Fl s Ar string
-.Op Fl w Ar filename
-.Ar input ...
-.Sh DESCRIPTION
-.Nm
-is a fast command-line utility for processing RDF data.
-It reads one or more documents and writes the data again,
-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.
-.Pp
-.Nm
-can be used to check for syntax errors,
-convert from one syntax to another,
-pretty-print documents,
-or transform URIs and blank node IDs.
-.Pp
-The options are as follows:
-.Pp
-.Bl -tag -compact -width 3n
-.It Fl C
-Convert literals to canonical form.
-Literals with supported XSD datatypes will be parsed and rewritten canonically.
-All numeric datatypes are supported, as well as
-.Vt boolean ,
-.Vt duration ,
-.Vt datetime ,
-.Vt time ,
-.Vt hexBinary ,
-and
-.Vt base64Binary .
-.Pp
-.It Fl F Ar pattern
-Filter out statements that match
-.Ar pattern .
-The pattern must be a single statement written in NTriples or NQuads,
-with variables like
-.Dq ?name
-for wildcards.
-The names of variables in the pattern are insignificant.
-.Pp
-.It Fl G Ar pattern
-Only include statements that match
-.Ar pattern .
-This option is like
-.Fl p
-but inverted,
-so that only matching statements are included, like grep.
-.Pp
-.It Fl I Ar base
-Input base URI.
-Relative URI references in the input will be resolved against this.
-When the input is a file,
-the URI of the file is automatically used as the base URI.
-This option can be used to override that,
-or to provide a base URI for input from stdin or a string.
-.Pp
-.It Fl b Ar bytes
-I/O block size.
-This is the number of bytes in a file that will be read or written at once.
-The default is 4096, which should perform well in most cases.
-Note that this only applies to files, standard input and output are always processed one byte at a time.
-.Pp
-.It Fl f
-Fast and loose mode.
-This disables shortening URIs into prefixed names or relative URI references.
-If the model is enabled, then this writes the model quickly in sorted order.
-Note that doing so with TriG or Turtle may make the output ugly,
-since blank nodes will not be inlined.
-.Pp
-.It Fl h
-Print the command line options.
-.Pp
-.It Fl i Ar syntax
-Set an input syntax option.
-May be given multiple times.
-The case-insensitive
-.Ar syntax
-can be either a syntax name or an input syntax option.
-The supported syntaxes are
-.Dq NQuads ,
-.Dq NTriples ,
-.Dq TriG ,
-and
-.Dq Turtle .
-.Pp
-The supported input options are:
-.Pp
-.Bl -tag -width "QvariablesQ" -compact -offset indent
-.It Dq lax
-Tolerate invalid input where possible.
-Warnings will be printed on syntax errors,
-but parsing will attempt to continue.
-Note that data may be lost when using this option!
-.Pp
-.It Dq variables
-Support parsing variable nodes.
-Variables can be written in SPARQL style, for example
-.Dq ?var
-or
-.Dq $var .
-.Pp
-.It Dq verbatim
-Normally, the reader expands all relative URIs,
-and may adjust blank node labels to avoid clashing with generated ones.
-This flag disables all of this processing,
-so that URI references and blank nodes are passed to the sink exactly as they are in the input.
-Note that this does not apply to CURIEs, since serd deliberately does not
-have a way to represent CURIE nodes. A bad namespace prefix is considered
-a syntax error.
-.El
-.Pp
-.It Fl k Ar bytes
-Parser stack size.
-For performance and security reasons, parsing is performed with a fixed-size stack.
-By default, the stack is 4096 bytes, which should be sufficient for most data.
-If some data has very deep nesting or very large literal values,
-it may exceed the default amount of space,
-and this option can be used to increase it and allow the document to be parsed successfully.
-.Pp
-.It Fl m
-Build a model in memory.
-This loads all of the input into memory before writing the output.
-This will reorder statements and eliminate duplicates, at the cost of performance and memory consumption.
-When writing TriG or Turtle, this may enable better pretty-printing with more inline descriptions.
-.Pp
-.It Fl o Ar syntax
-Set an output syntax option.
-May be given multiple times.
-The case-insensitive
-.Ar syntax
-can be either a syntax name or an output syntax option.
-The supported syntaxes are
-.Dq empty ,
-.Dq NQuads ,
-.Dq NTriples ,
-.Dq TriG ,
-and
-.Dq Turtle .
-.Pp
-The supported output options are:
-.Pp
-.Bl -tag -width "QverbatimQ" -compact -offset indent
-.It Dq ascii
-Escape all non-ASCII characters.
-.Pp
-.It Dq expanded
-Write expanded URIs instead of prefixed names.
-.Pp
-.It Dq verbatim
-Write URI references exactly as they are in the input.
-This avoids resolving URIs and making them relative to the output base URI.
-.Pp
-.It Dq terse
-Write terser output without newlines.
-.Pp
-.It Dq lax
-Tolerate invalid UTF-8 by writing the replacement character when necessary.
-Note that data may be lost when using this option!
-.El
-.Pp
-.It Fl q
-Suppress all output except data.
-.Pp
-.It Fl r Ar root
-Keep relative URIs within a
-.Ar root
-URI.
-This will avoid creating any relative URI references with leading path segments like
-.Dq ../
-that enter a parent of
-.Ar root .
-.Pp
-.It Fl s Ar string
-Parse
-.Ar string
-as input.
-.Pp
-.It Fl v
-Display version information and exit.
-.Pp
-.It Fl w Ar filename
-Write output to the given
-.Ar filename
-instead of stdout.
-.El
-.Sh EXIT STATUS
-.Nm
-exits with a status of 0, or non-zero if an error occured.
-.Sh EXAMPLES
-To pretty-print a document:
-.Pp
-.Dl $ serdi -o turtle file.ttl > out.ttl
-.Pp
-To print any errors:
-.Pp
-.Dl $ serdi file.ttl > /dev/null
-.Pp
-To remove any rdf:type properties:
-.Pp
-.Dl $ serdi -F \(dq?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o .\(dq file.ttl
-.Pp
-To include only rdf:type properties:
-.Pp
-.Dl $ serdi -G \(dq?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o .\(dq file.ttl
-.Sh SEE ALSO
-.Bl -item -compact
-.It
-.Lk http://drobilla.net/software/serd/
-.It
-.Lk http://gitlab.com/drobilla/serd/
-.El
-.Sh STANDARDS
-.Bl -item
-.It
-.Rs
-.%A W3C
-.%T RDF 1.1 NQuads
-.%D February 2014
-.Re
-.Lk https://www.w3.org/TR/n-quads/
-.It
-.Rs
-.%A W3C
-.%D February 2014
-.%T RDF 1.1 NTriples
-.Re
-.Lk https://www.w3.org/TR/n-triples/
-.It
-.Rs
-.%A W3C
-.%T RDF 1.1 TriG
-.%D February 2014
-.Re
-.Lk https://www.w3.org/TR/trig/
-.It
-.Rs
-.%A W3C
-.%D February 2014
-.%T RDF 1.1 Turtle
-.Re
-.Lk https://www.w3.org/TR/turtle/
-.El
-.Sh AUTHORS
-.Nm
-is a part of serd, by
-.An David Robillard
-.Mt d@drobilla.net .