.Dd March 6, 2021 .Dt SERDI 1 .Os Serd 0.30.11 .Sh NAME .Nm serdi .Nd read and write RDF syntax .Sh SYNOPSIS .Nm serdi .Op Fl Cabefhlqv .Op Fl I Ar base .Op Fl c Ar prefix .Op Fl g Ar pattern .Op Fl i Ar syntax .Op Fl k Ar bytes .Op Fl o Ar syntax .Op Fl p Ar prefix .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 streaming and processing RDF data. It reads an RDF document 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 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 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 S Stream model quickly without inlining. This only has an effect when a model is used, and disables searching and statement reordering for pretty printing. Statements will be written in simple sorted order, which is faster, but may result in less readable output in Turtle or TriG. .Pp .It Fl V Validate inputs. All necessary data, including schemas, must be passed as inputs. Output will only be written if validation succeeds. Combine with .Fl o Ar empty to suppress output and only show validation errors. .Pp .It Fl 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. .Pp .It Fl b Bulk output writing. If this is enabled, output will be written a page at a time, rather than a byte at a time. .Pp .It Fl c Ar prefix Chop .Ar prefix from matching blank node IDs. This is the inverse of .Fl p . .Pp .It Fl 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. .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 g Ar pattern Filter statements that match .Ar pattern (like grep). .Ar pattern should be a single statement written in NTriples or NQuads. .Pp .It Fl h Print the command line options. .Pp .It Fl i Ar syntax Read input as .Ar syntax . Case is ignored, valid values are: .Dq NQuads , .Dq NTriples , .Dq TriG , and .Dq Turtle . .Pp .It Fl k Ar bytes Parser stack size. For performance reasons, parsing is performed with a fixed-size stack. By default, the stack is one page (4096 bytes), which should be sufficient for parsing most documents. This option can be used to increase or decrease the amount of memory available for parsing. It must be large enough to fit one statement, with some extra space for internal records. Something around twice the length of the longest statement in text (as if it were written in NTriples or NQuads) is a reasonable value. .Pp .It Fl 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. .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 Write output as .Ar syntax . Case is ignored, valid values are: .Dq empty , .Dq NQuads , .Dq NTriples , .Dq TriG , and .Dq Turtle . When .Dq empty is given, output is suppressed, so only errors will be printed. .Pp .It Fl p Ar prefix Add .Ar prefix to blank node IDs. This can be used to avoid clashes between blank node IDs in input documents. .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 input instead of a file. .Pp .It Fl t Write terser output without newlines. .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. .Pp .It Fl x Support parsing variable nodes. Variables can be written in SPARQL style, for example .Dq ?var or .Dq $var . .El .Sh EXIT STATUS .Nm exits with a status of 0, or non-zero if an error occured. .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 .