aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.reuse/dep54
-rw-r--r--NEWS1
-rw-r--r--README.md20
-rw-r--r--doc/man/meson.build4
-rw-r--r--doc/man/serd-pipe.1 (renamed from doc/man/serdi.1)14
-rw-r--r--doc/serd-memory.svg (renamed from doc/serdi-memory.svg)0
-rw-r--r--doc/serd-memory.txt (renamed from doc/serdi-memory.txt)2
-rw-r--r--doc/serd-throughput.svg (renamed from doc/serdi-throughput.svg)0
-rw-r--r--doc/serd-throughput.txt (renamed from doc/serdi-throughput.txt)2
-rw-r--r--doc/serd-time.svg (renamed from doc/serdi-time.svg)0
-rw-r--r--doc/serd-time.txt (renamed from doc/serdi-time.txt)2
-rw-r--r--meson.build2
-rwxr-xr-xscripts/serd_bench.py22
-rw-r--r--serd.ttl2
-rw-r--r--test/meson.build51
-rwxr-xr-xtest/run_suite.py6
-rw-r--r--test/serd_test_util/__init__.py4
-rwxr-xr-xtest/test_empty.py2
-rwxr-xr-xtest/test_quiet.py4
-rwxr-xr-xtest/test_stdin.py4
-rwxr-xr-xtest/test_write_error.py2
-rw-r--r--tools/meson.build13
-rw-r--r--tools/serd-pipe.c (renamed from tools/serdi.c)6
23 files changed, 86 insertions, 81 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5
index 3173226a..1c237f2b 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -23,7 +23,7 @@ Copyright: 2022 David Robillard <d@drobilla.net>
Comment: Contributed to the Commons as a tool configuration
License: 0BSD OR ISC
-Files: doc/_static/serd.svg doc/serdi-*.svg doc/serdi-*.txt
-Copyright: 2011-2022 David Robillard <d@drobilla.net>
+Files: doc/_static/serd*.svg doc/serd*.svg doc/serd*.txt
+Copyright: 2011-2023 David Robillard <d@drobilla.net>
Comment: Documentation
License: ISC
diff --git a/NEWS b/NEWS
index de5fe0fd..d7f5b5e9 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ serd (1.1.1) unstable; urgency=medium
* Remove support for reading Turtle named inline nodes extension
* Remove useless character counting from API
* Rename SerdChunk to SerdStringView
+ * Replace serdi with more focused tools
* Simplify statement flags
* Simplify writer style options and write UTF-8 by default
* Strengthen handling of corrupt UTF-8 input
diff --git a/README.md b/README.md
index 3e26e300..350a0e05 100644
--- a/README.md
+++ b/README.md
@@ -8,8 +8,8 @@ Serd is a lightweight C library for working with RDF data.
Serd can be used by high-performance or resource-limited applications to read
or write [Turtle][], [TriG][], [NTriples][], and [NQuads][]. The included
-`serdi` tool can be used to efficiently process RDF documents in scripts or on
-the command-line.
+command line tools can be used to efficiently process RDF documents in scripts
+or on the command-line.
Features
--------
@@ -42,14 +42,14 @@ Features
Performance
-----------
-The benchmarks below compare `serdi`, [rapper][], and [riot][] re-serialising
-Turtle data generated by [sp2b][] on an AMD 1950x. Of the three, `serdi` is
-the fastest by a wide margin, and the only one that uses a constant amount of
-memory for all input sizes.
+The benchmarks below compare `serd-pipe`, [rapper][], and [riot][]
+re-serialising Turtle data generated by [sp2b][] on an AMD 1950x. Of the
+three, `serd-pipe` is the fastest by a wide margin, and the only one that uses
+a constant amount of memory for all input sizes.
-![Throughput](doc/serdi-throughput.svg)
-![Time](doc/serdi-time.svg)
-![Memory](doc/serdi-memory.svg)
+![Throughput](doc/serd-throughput.svg)
+![Time](doc/serd-time.svg)
+![Memory](doc/serd-memory.svg)
Documentation
-------------
@@ -57,7 +57,7 @@ Documentation
* [Installation instructions](INSTALL.md)
* [Single-page API reference](https://drobilla.gitlab.io/serd/doc/singlehtml/)
* [Paginated API reference](https://drobilla.gitlab.io/serd/doc/html/)
- * [`serdi` man page](https://drobilla.gitlab.io/serd/man/serdi.html)
+ * [`serd-pipe` man page](https://drobilla.gitlab.io/serd/man/serd-pipe.html)
Versioning
----------
diff --git a/doc/man/meson.build b/doc/man/meson.build
index 323a8c4d..ae0c1c51 100644
--- a/doc/man/meson.build
+++ b/doc/man/meson.build
@@ -21,7 +21,7 @@ if not get_option('tools').disabled()
)
endif
- install_man(files('serdi.1'))
+ install_man(files('serd-pipe.1'))
endif
# Build/install HTML man pages if mandoc is present
@@ -44,7 +44,7 @@ if not get_option('tools').disabled()
]
page_names = [
- 'serdi',
+ 'serd-pipe',
]
html_mandir = docdir / versioned_name / 'man'
diff --git a/doc/man/serdi.1 b/doc/man/serd-pipe.1
index 7822832a..32482c73 100644
--- a/doc/man/serdi.1
+++ b/doc/man/serd-pipe.1
@@ -1,13 +1,13 @@
-.\" Copyright 2011-2022 David Robillard <d@drobilla.net>
+.\" Copyright 2011-2023 David Robillard <d@drobilla.net>
.\" SPDX-License-Identifier: ISC
-.Dd April 30, 2023
-.Dt SERDI 1
+.Dd May 04, 2023
+.Dt SERD-PIPE 1
.Os Serd 1.1.1
.Sh NAME
-.Nm serdi
-.Nd read and write RDF syntax
+.Nm serd-pipe
+.Nd read and write RDF data
.Sh SYNOPSIS
-.Nm serdi
+.Nm serd-pipe
.Op Fl abefhlqtv
.Op Fl c Ar prefix
.Op Fl i Ar syntax
@@ -57,7 +57,7 @@ will be emitted as
.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.
+With this option one less page of memory is used, but likely with a performance penalty.
.It Fl f
Fast and loose URI mode:
preserve full URIs (without qualifying or making relative),
diff --git a/doc/serdi-memory.svg b/doc/serd-memory.svg
index db837a07..db837a07 100644
--- a/doc/serdi-memory.svg
+++ b/doc/serd-memory.svg
diff --git a/doc/serdi-memory.txt b/doc/serd-memory.txt
index 82cac3a4..6749642a 100644
--- a/doc/serdi-memory.txt
+++ b/doc/serd-memory.txt
@@ -1,4 +1,4 @@
-n serdi rapper riot
+n serd-pipe rapper riot
1000000 1634304.0 492728320.0 589537280.0
2000000 1523712.0 972505088.0 750370816.0
3000000 1409024.0 1450397696.0 905318400.0
diff --git a/doc/serdi-throughput.svg b/doc/serd-throughput.svg
index e32c3355..e32c3355 100644
--- a/doc/serdi-throughput.svg
+++ b/doc/serd-throughput.svg
diff --git a/doc/serdi-throughput.txt b/doc/serd-throughput.txt
index cb0d2678..547c1f51 100644
--- a/doc/serdi-throughput.txt
+++ b/doc/serd-throughput.txt
@@ -1,4 +1,4 @@
-n serdi rapper riot
+n serd-pipe rapper riot
1000000 833333 121654 87796
2000000 843881 119189 130804
3000000 835654 115651 150602
diff --git a/doc/serdi-time.svg b/doc/serd-time.svg
index 3b8e5523..3b8e5523 100644
--- a/doc/serdi-time.svg
+++ b/doc/serd-time.svg
diff --git a/doc/serdi-time.txt b/doc/serd-time.txt
index dd0022bd..3482ef6f 100644
--- a/doc/serdi-time.txt
+++ b/doc/serd-time.txt
@@ -1,4 +1,4 @@
-n serdi rapper riot
+n serd-pipe rapper riot
1000000 1.2000000 8.2200000 11.3900000
2000000 2.3700000 16.7800000 15.2900000
3000000 3.5900000 25.9400000 19.9200000
diff --git a/meson.build b/meson.build
index 2c440224..642da5a9 100644
--- a/meson.build
+++ b/meson.build
@@ -232,7 +232,7 @@ install_headers(c_headers, subdir: versioned_name / 'serd')
# Tools #
#########
-# Build serdi command line utility
+# Build serd-pipe command line utility
if not get_option('tools').disabled()
subdir('tools')
endif
diff --git a/scripts/serd_bench.py b/scripts/serd_bench.py
index e342976b..1bd61855 100755
--- a/scripts/serd_bench.py
+++ b/scripts/serd_bench.py
@@ -171,9 +171,9 @@ def run(progs, n_min, n_max, step):
"Benchmark each program with n_min ... n_max statements"
with WorkingDirectory("build"):
results = {
- "time": open("serdi-time.txt", "w"),
- "throughput": open("serdi-throughput.txt", "w"),
- "memory": open("serdi-memory.txt", "w"),
+ "time": open("serd-time.txt", "w"),
+ "throughput": open("serd-throughput.txt", "w"),
+ "memory": open("serd-memory.txt", "w"),
}
# Write TSV header for all output files
@@ -205,7 +205,7 @@ def run(progs, n_min, n_max, step):
f.write("\t".join(rows[name]) + "\n")
for name, f in results.items():
- tsv_filename = "serdi-%s.txt" % name
+ tsv_filename = "serd-pipe-%s.txt" % name
sys.stderr.write("wrote %s\n" % tsv_filename)
@@ -213,20 +213,20 @@ def plot_results():
"Plot all benchmark results"
with WorkingDirectory("build"):
plot(
- open("serdi-time.txt", "r"),
- "serdi-time.svg",
+ open("serd-time.txt", "r"),
+ "serd-time.svg",
"Statements",
"Time (s)",
)
plot(
- open("serdi-throughput.txt", "r"),
- "serdi-throughput.svg",
+ open("serd-throughput.txt", "r"),
+ "serd-throughput.svg",
"Statements",
"Statements / s",
)
plot(
- open("serdi-memory.txt", "r"),
- "serdi-memory.svg",
+ open("serd-memory.txt", "r"),
+ "serd-memory.svg",
"Statements",
"Bytes",
)
@@ -271,7 +271,7 @@ example:
args = ap.parse_args(sys.argv[1:])
- progs = ["serdi -b -f -i turtle -o turtle"] + args.run
+ progs = ["serd-pipe -b -f -i turtle -o turtle"] + args.run
min_n = int(args.max / args.steps)
max_n = args.max
step = min_n
diff --git a/serd.ttl b/serd.ttl
index d3255be6..eea87c29 100644
--- a/serd.ttl
+++ b/serd.ttl
@@ -16,7 +16,7 @@
doap:homepage <https://drobilla.net/software/serd> ;
doap:license <http://opensource.org/licenses/isc> ;
doap:shortdesc "Lightweight C library for working with RDF data" ;
- doap:description "Serd is a lightweight C library for working with RDF data. Serd can be used by high-performance or resource-limited applications to read or write Turtle, TriG, NTriples, and NQuads. The included `serdi` tool can be used to efficiently process RDF documents in scripts or on the command-line." ;
+ doap:description "Serd is a fast and lightweight C library for reading and writing RDF in Turtle, NTriples, TriG, and NQuads." ;
doap:created "2011-09-28"^^xsd:date ;
doap:programming-language "C" ;
doap:implements <http://www.w3.org/TR/n-quads/> ,
diff --git a/test/meson.build b/test/meson.build
index 496296c1..2178ce1f 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -99,12 +99,12 @@ if get_option('lint')
test('pylint', pylint, args: pylint_args + pylint_scripts, suite: 'scripts')
endif
- # Check Turtle formatting with serdi
+ # Check Turtle formatting with serd-pipe
foreach ttl_file_path : ttl_metadata_file_paths
test(
ttl_file_path.underscorify(),
check_formatting_py,
- args: [files(ttl_file_path), serdi, '-o', 'turtle'],
+ args: [files(ttl_file_path), serd_pipe, '-o', 'turtle'],
suite: 'data',
)
endforeach
@@ -170,7 +170,7 @@ if wrapper != ''
endif
simple_command_tests = {
- 'serdi': {
+ 'pipe': {
'bad': [
['-c'],
['-fi'],
@@ -197,22 +197,22 @@ simple_command_tests = {
},
}
-if is_variable('serdi')
- script_args = common_script_args + ['--serdi', serdi]
+if is_variable('serd_pipe')
+ pipe_script_args = common_script_args + ['--tool', serd_pipe]
serd_ttl = files('../serd.ttl')[0]
bad_input_file = files('extra/bad/bad-base.ttl')
- test('serd_ttl', serdi, args: [serd_ttl], env: test_env, suite: 'data')
+ test('serd_ttl', serd_pipe, args: [serd_ttl], env: test_env, suite: 'data')
# Command line options
- cmd_suite = ['serdi', 'options']
+ cmd_suite = ['tools', 'pipe', 'options']
- foreach kind, cases : simple_command_tests['serdi']
+ foreach kind, cases : simple_command_tests['pipe']
foreach args : cases
test(
' '.join(args).substring(1).underscorify(),
- serdi,
+ serd_pipe,
args: args,
env: test_env,
should_fail: kind == 'bad',
@@ -221,19 +221,19 @@ if is_variable('serdi')
endforeach
endforeach
- test('none', serdi, env: test_env, should_fail: true, suite: cmd_suite)
+ test('none', serd_pipe, env: test_env, should_fail: true, suite: cmd_suite)
test(
'quiet',
files('test_quiet.py'),
- args: script_args + [bad_input_file],
+ args: pipe_script_args + [bad_input_file],
env: test_env,
suite: cmd_suite,
)
# Inputs
- input_suite = ['serdi', 'input']
+ input_suite = ['tools', 'pipe', 'input']
bad_input_tests = {
'string': ['-s', '<foo> a <Bar> .'],
@@ -244,7 +244,7 @@ if is_variable('serdi')
foreach name, args : bad_input_tests
test(
name,
- serdi,
+ serd_pipe,
args: args,
env: test_env,
should_fail: true,
@@ -255,7 +255,7 @@ if is_variable('serdi')
test(
'stdin',
files('test_stdin.py'),
- args: script_args,
+ args: pipe_script_args,
env: test_env,
suite: input_suite,
)
@@ -265,7 +265,7 @@ if is_variable('serdi')
test(
'empty',
files('test_empty.py'),
- args: script_args + [serd_ttl],
+ args: pipe_script_args + [serd_ttl],
env: test_env,
suite: 'output',
)
@@ -279,13 +279,20 @@ if is_variable('serdi')
}
foreach name, args : io_error_tests
- test(name, serdi, args: args, env: test_env, should_fail: true, suite: 'io')
+ test(
+ name,
+ serd_pipe,
+ args: args,
+ env: test_env,
+ should_fail: true,
+ suite: 'io',
+ )
endforeach
test(
'write_error',
files('test_write_error.py'),
- args: script_args + [serd_ttl],
+ args: pipe_script_args + [serd_ttl],
env: test_env,
suite: 'io',
)
@@ -293,7 +300,7 @@ if is_variable('serdi')
if host_machine.system() == 'linux'
test(
'unreadable',
- serdi,
+ serd_pipe,
args: ['/sys/bus/pci/rescan'],
env: test_env,
should_fail: true,
@@ -441,15 +448,15 @@ test_suites = {
],
}
-# Run every test suite with serdi
-if is_variable('serdi')
- script_args = common_script_args + ['--serdi', serdi]
+# Run every test suite with serd-pipe
+if is_variable('serd_pipe')
+ script_args = common_script_args + ['--tool', serd_pipe]
foreach name, args : test_suites
test(
name,
run_suite,
- args: script_args + args,
+ args: pipe_script_args + args,
env: test_env,
suite: ['suite'],
timeout: 240,
diff --git a/test/run_suite.py b/test/run_suite.py
index b44808b7..fdda0625 100755
--- a/test/run_suite.py
+++ b/test/run_suite.py
@@ -154,14 +154,14 @@ def main():
parser.add_argument("--lax", action="store_true", help="tolerate errors")
parser.add_argument("--report", help="path to write result report to")
parser.add_argument("--reverse", action="store_true", help="reverse test")
- parser.add_argument("--serdi", default="tools/serdi", help="path to serdi")
+ parser.add_argument("--tool", default="tools/serd-pipe", help="executable")
parser.add_argument("--wrapper", default="", help="executable wrapper")
parser.add_argument("manifest", help="test suite manifest.ttl file")
parser.add_argument("base_uri", help="base URI for tests")
- parser.add_argument("arg", nargs=argparse.REMAINDER, help="serdi argument")
+ parser.add_argument("arg", nargs=argparse.REMAINDER, help="tool argument")
args = parser.parse_args(sys.argv[1:])
- command = shlex.split(args.wrapper) + [args.serdi]
+ command = shlex.split(args.wrapper) + [args.tool]
with tempfile.TemporaryDirectory() as temp:
return run_suite(args, command, temp)
diff --git a/test/serd_test_util/__init__.py b/test/serd_test_util/__init__.py
index 4f426009..ac831054 100644
--- a/test/serd_test_util/__init__.py
+++ b/test/serd_test_util/__init__.py
@@ -57,7 +57,7 @@ def wrapper_args(description, with_input=False):
"""Return the command line arguments for a wrapped test."""
parser = argparse.ArgumentParser(description)
- parser.add_argument("--serdi", default="tools/serdi", help="executable")
+ parser.add_argument("--tool", default="tools/serd-pipe", help="executable")
parser.add_argument("--wrapper", default="", help="executable wrapper")
if with_input:
parser.add_argument("input", help="input file")
@@ -149,7 +149,7 @@ def earl_assertion(test, passed, asserter):
def load_rdf(filename, base_uri, command_prefix):
- """Load an RDF file as dictionaries via serdi (only supports URIs)."""
+ """Load an RDF file as dictionaries via serd-pipe (only supports URIs)."""
rdf_type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
model = {}
diff --git a/test/test_empty.py b/test/test_empty.py
index 3cd5517b..0ee641d5 100755
--- a/test/test_empty.py
+++ b/test/test_empty.py
@@ -14,7 +14,7 @@ import tempfile
import serd_test_util as util
args = util.wrapper_args(__doc__, True)
-command = shlex.split(args.wrapper) + [args.serdi, "-o", "empty", args.input]
+command = shlex.split(args.wrapper) + [args.tool, "-o", "empty", args.input]
with tempfile.TemporaryFile() as out:
proc = subprocess.run(command, check=False, stdout=out)
diff --git a/test/test_quiet.py b/test/test_quiet.py
index 676284bb..a58779ea 100755
--- a/test/test_quiet.py
+++ b/test/test_quiet.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2022 David Robillard <d@drobilla.net>
+# Copyright 2022-2023 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: ISC
"""Test quiet command-line option."""
@@ -11,7 +11,7 @@ import subprocess
import serd_test_util as util
args = util.wrapper_args(__doc__, True)
-command = shlex.split(args.wrapper) + [args.serdi, "-q", args.input]
+command = shlex.split(args.wrapper) + [args.tool, "-q", args.input]
proc = subprocess.run(
command, check=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
diff --git a/test/test_stdin.py b/test/test_stdin.py
index fb01f4ee..9975c547 100755
--- a/test/test_stdin.py
+++ b/test/test_stdin.py
@@ -3,14 +3,14 @@
# Copyright 2022-2023 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: ISC
-"""Test reading from stdin with serdi."""
+"""Test reading from stdin with serd-pipe."""
# pylint: disable=consider-using-f-string
import serd_test_util as util
args = util.wrapper_args(__doc__)
-command = [args.serdi, "-i", "ntriples", "-", "http://example.org"]
+command = [args.tool, "-i", "ntriples", "-", "http://example.org"]
DOC = "<{0}s> <{0}p> <{0}o> .".format("http://example.org/")
diff --git a/test/test_write_error.py b/test/test_write_error.py
index b62f981a..7d165a6a 100755
--- a/test/test_write_error.py
+++ b/test/test_write_error.py
@@ -13,7 +13,7 @@ import os
import serd_test_util as util
args = util.wrapper_args(__doc__, True)
-command = shlex.split(args.wrapper) + [args.serdi, args.input]
+command = shlex.split(args.wrapper) + [args.tool, args.input]
if os.path.exists("/dev/full"):
with open("/dev/full", "w", encoding="utf-8") as out:
diff --git a/tools/meson.build b/tools/meson.build
index 49fa32c7..ce82b212 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,4 +1,4 @@
-# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# Copyright 2021-2023 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: 0BSD OR ISC
tool_c_args = c_suppressions + platform_c_args
@@ -8,16 +8,13 @@ if get_option('static') and cc.get_id() != 'msvc'
tool_link_args += ['-static']
endif
-serdi = executable(
- 'serdi',
- files(
- 'console.c',
- 'serdi.c',
- ),
+serd_pipe = executable(
+ 'serd-pipe',
+ files('console.c', 'serd-pipe.c'),
c_args: tool_c_args,
dependencies: [serd_dep, zix_dep],
install: true,
link_args: tool_link_args,
)
-meson.override_find_program('serdi', serdi)
+meson.override_find_program('serd-pipe', serd_pipe)
diff --git a/tools/serdi.c b/tools/serd-pipe.c
index fd7fdb15..26a4a26a 100644
--- a/tools/serdi.c
+++ b/tools/serd-pipe.c
@@ -22,8 +22,8 @@
#include <stdlib.h>
#include <string.h>
-#define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg)
-#define SERDI_ERRORF(fmt, ...) fprintf(stderr, "serdi: " fmt, __VA_ARGS__)
+#define SERDI_ERROR(msg) fprintf(stderr, "serd-pipe: " msg)
+#define SERDI_ERRORF(fmt, ...) fprintf(stderr, "serd-pipe: " fmt, __VA_ARGS__)
#define MAX_DEPTH 128U
@@ -282,7 +282,7 @@ main(int argc, char** argv)
serd_world_free(world);
if (fclose(stdout)) {
- perror("serdi: write error");
+ perror("serd-pipe: write error");
st = SERD_BAD_STREAM;
}