SERD-FILTER(1) General Commands Manual SERD-FILTER(1)

serd-filter
print RDF statements that match a pattern

serd-filter [-hVv] [-B base] [-I syntax] [-O syntax] [-b bytes] [-f pattern_file] [-k bytes] [-o filename] pattern input ...

serd-filter scans for statements in RDF data. Its interface is similar to grep(1), except patterns are structural: instead of matching characters within a line, serd-filter matches nodes within a statement.

Data is read from files or standard input, and only those statements that match the pattern (or do not match the pattern, if -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.

Patterns are written in NTriples or NQuads with an extension that allows variables like ?some or $thing.

The options are as follows:

base
Base URI, path, or rebase to use the output path. See serd-pipe(1) for details.

syntax
Input syntax or option: NQuads, NTriples, TriG, Turtle, lax, variables, relative, or labels. See serd-pipe(1) for details.

syntax
Output syntax or option: empty, NQuads, NTriples, TriG, Turtle, ascii, contextual, expanded, verbatim, terse, or lax. See serd-pipe(1) for details.

Display version information and exit.

bytes
I/O block size. See serd-pipe(1) for details.

pattern_file
Load pattern from pattern_file instead of the first positional argument.

Print the command line options.

bytes
Parser stack size. See serd-pipe(1) for details.

filename
Write output to the given filename instead of stdout.

Invert filter to only emit statements that do not match the pattern.

serd-filter exits with a status of 0, or non-zero if an error occured.

To print all type statements:

$ serd-filter '?subject a ?type .' input.ttl

To print every statement about http://example.org/subject:

$ serd-filter '<http://example.org/subject> ?p ?o .' input.ttl

serd-filter is a part of serd, by David Robillard d@drobilla.net.
August 12, 2021 Serd 0.30.11