logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

serdi — read and write RDF syntax

Authors

serdi is a part of serd, by David Robillard ⟨d@drobilla.net⟩.

Serd 0.32.4                                     January 18, 2025                                        SERDI(1)

Description

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.

       -cprefix
            Chop prefix from matching blank node IDs.  This is typically used to revert the effects of -p.   For
            example, with prefix “doc01”, the blank node _:doc01b42 will be emitted as _:b42.

       -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   Fast and loose URI mode: preserve full URIs  (without  qualifying  or  making  relative),  and  pass
            prefixed names through as-is.

       -h   Print the command line options.

       -isyntax
            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.

       -osyntax
            Write output as syntax.  Case is ignored, valid values are: “NQuads”, “NTriples”, “TriG”, “Turtle”.

       -pprefix
            Add  prefix  to  blank  node IDs.  This can be used to avoid clashes between blank node IDs in input
            documents.  The effects can be reversed in a later run with -c.  For example, with  prefix  “doc01”,
            the blank node _:b42 will be emitted as _:doc01b42.

       -q   Suppress all output except data.

       -rroot
            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.

            For  example,  if  /home/you/file.ttl  is  written  to  the  file  /home/me/output.ttl   using   the
            destination's  base URI, then it could be written as <../you/file.ttl>.  Setting -rfile:///home/me/
            would prevent references from “escaping” like this,  so  the  above  would  instead  be  written  as
            <file:///home/you/file.ttl>, since it can't be expressed relative to the root URI.

            This is useful for keeping relative references within some directory.

       -sstring
            Parse string input instead of a file (terminates options).

       -v   Display version information and exit.

Examples

       Pretty-print a document:
            serdi-oturtlefile.ttl > out.ttl

       Print any errors:
            serdifile.ttl > /dev/null

Exit Status

serdi exits with a status of 0, or non-zero if an error occurred.

Name

       serdi — read and write RDF syntax

See Also

Standards

       W3C, RDF1.1NQuads, February 2014.  https://www.w3.org/TR/n-quads/

       W3C, RDF1.1NTriples, February 2014.  https://www.w3.org/TR/n-triples/

       W3C, RDF1.1TriG, February 2014.  https://www.w3.org/TR/trig/

       W3C, RDF1.1Turtle, February 2014.  https://www.w3.org/TR/turtle/

Synopsis

serdi [-abefhlqv] [-cprefix] [-isyntax] [-osyntax] [-pprefix] [-rroot] [-sstring] input [base_uri]

See Also