Serd

Serd is a lightweight C library for RDF syntax which supports reading and writing Turtle and NTriples.

Serd is not intended to be a swiss-army knife of RDF syntax, but rather is suited to resource limited or performance critical applications (e.g. converting many gigabytes of NTriples to Turtle), or situations where a simple reader/writer with minimal dependencies is ideal (e.g. in LV2 implementations or embedded applications).

Features

Performance

Command Memory HDD Time HDD Throughput SSD Time SSD Throughput
serdi -b -f -i ntriples -o turtle input.nt 3.22 MiB 0:35 64.2 MiB/s 0:27 83.2 MiB/s
grep 'dbpedia' input.nt 3.6 MiB 0:35 64.2 MiB/s 0:21 107.0 MiB/s
sed 's/dbpedia/example/' input.nt 3.7 MiB 0:37 60.7 MiB/s 0:22 102.1 MiB/s
rapper -i ntriples -o turtle input.nt 11124.2 MiB 3:02 12.3 MiB/s 3:03 12.3 MiB/s
rapper -i ntriples -o ntriples input.nt 10.6 MiB 1:26 26.1 MiB/s 1:08 33.0 MiB/s

Input is mappingbased_properties_en.nt from DBPedia fetched on 2011-12-12 (~17.5M triples, 2247 MiB uncompressed). System is Debian 7 on an Intel Core i7-2620M. File system cache was flushed before each run with echo 3 > /proc/sys/vm/drop_caches. The variance between identical runs was less than 2 MiB/s, the best of 3 is shown. Output was redirected to a file on the same disk. Measurements by /usr/bin/time -v.

These results show that Serdi is capable of converting NTriples to abbreviated Turtle using a small constant amount of memory. Serd is fast enough that the process is I/O bound when reading from the hard disk. Notice in particular that Serd can write abbreviated Turtle much faster than rapper can perform the much simpler task of reading and writing ntriples.

Download

Documentation

Contribute

Notes

1. Stripped of comments etc., as calculated by David A. Wheeler's SLOCCount

2. According to valgrind