[ANN] OCaml-RDF 0.15.0


A new release of OCaml-RDF is available:
OCaml-RDF : OCaml-RDF 0.15.0

This release includes new modules:

  • Rdf.Activitystreams defining the activitystreams/activitypub vocabularies,
  • Rdf.Nq to read and writes N-quads format.

A new package, rdf_json_ld implements part of the JSON-LD API: context processing, expansion, deserialization to RDF and serialization to Json-ld. Note that serialization produces a flat Json-ld rather than implementing the algorithm from the recommandation. It’s worth noting that the specification seems to have been written by javascript developers with little notion of typing. Moreover, JSON-LD format is far more complicated (and undoubtedly more energy-consuming) than simpler formats such as XML, Turtle or N-quads. I therefore advise against its use (but several activitypub servers seem to communicate only with this format…).

Packages rdf, rdf_ppx, rdf_json_ld, rdf_mysql, rdf_postgresql, and rdf_lwt are avalable in opam.


I fear that was the innovation from ActivityStreams 2.0 over 1.0. Syntactic and operational complication (ssl cert expiry plagues ActivityPub itself) without semantic gains but broken tooling. Before we had raptor, roqet, xmllint, xslt, trang and could even cat turtle.

@pukkamustard is doing rdf via xmpp, right?

1 Like

Yes, exactly because JSON-LD is a royal pita (see openEngiadina: From ActivityPub to XMPP — inqlab). RDF (also ActivityStreams) as RDF/XML over XMPP works surprisingly well.

Congratulations to @Zoggy for implementing JSON-LD! Having read the specification of JSON-LD I hope it didn’t cost you too much sanity! :slight_smile:

Apropos: For the RDF over XMPP stuff we use another OCaml RDF library for some technical reasons. But @Zoggy’s implementation was a major influence and is very much appreciated.


About the technical reasons which prevented you to use OCaml-RDF: the library is not really tied to Cryptokit or Pcre, since there is a hook system to set the corresponding required functions (sha1, sha256, pcre_match, pcre_regexp). See lib/stubs.ml. The default rdf library should not require Cryptokit and Pcre (as it does from the package description by now), and I realize that a package rdf_impls, which initializes the required functions, is not installed. This will be fixed in a next release. So you should be able to use rdf with js_of_ocaml.

I understand the other reasons, no problem.

Regarding my post-JSON-LD sanity, it slowly recovers :crazy_face:. There have been difficult moments, for example when my code failed on some provided test cases, until I realize that the reference implementation gave the same results as my code :rofl: