Monthly Downloads: 85
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: RDF     Filetypes    
Add another 'RDF' Package


rdf4h - An RDF library for Haskell

Available on Hackage License BSD3 Build Status

rdf4h is a library for working with RDF in Haskell.

For details see the GitHub project page:


Supports GHC versions from 8.0.2 (stackage lts-9) to 8.8.3 (stackage lts-16.0).

RDF formats

The coverage of the W3C RDF standards are:

Format Parsing Serialising
NTriples complete complete
Turtle complete complete
RDF/XML complete not supported

These results are produced with version 4.0 of this library.

These tests are run on the W3C unit tests for RDF formats: https://github.com/w3c/rdf-tests.

Feature requests

  1. The parsers in this library parse large files/strings contents entirely before generating RDF triples. This doesn't scale for very large files. Implementing stream based RDF parsers would overcome this problem, e.g. by creating input streams enabling output streams in the io-streams library to consume triples on-the-fly during parsing. This is discussed here: https://github.com/robstewart57/rdf4h/issues/56#issuecomment-497892024 and https://github.com/robstewart57/rdf4h/issues/44#issuecomment-426054978

  2. RDF/XML serialisation of RDF graphs.

Running tests

To run all the tests (parsers and the library API):

$ git submodule update --init --recursive
$ git submodule foreach git pull origin gh-pages
$ stack test --test-arguments="--quickcheck-tests 1000"

To run specific parser tests when bug fixing:

$ stack test --test-arguments="--pattern /parser-w3c-tests-ntriples/"
$ stack test --test-arguments="--pattern /parser-w3c-tests-turtle/"
$ stack test --test-arguments="--pattern /parser-w3c-tests-xml/"

Running benchmarks

To run the bencharks:

$ wget https://www.dropbox.com/s/z1it340emcreowj/bills.099.actions.rdf
$ gzip -d bills.099.actions.rdf.gz
$ stack bench

*Note that all licence references and agreements mentioned in the rdf4h README section above are relevant to that project's source code only.