This is built if --with-ocaml is given to the configure line, or --with-ocaml=ocamlfind to use a particular ocamlfind program. The standard 'make' at the top level will build it.
You can also compile the ocaml interface by hand as follows:
cd ocaml make # optional - runs the tests make check
To install it system wide do this as root (or maybe via sudo make install):
root# make install
The ocaml interface for Redland is experimental and requires OCaml 3.12 or newer. It has been tested with the following versions:
3.12 on OSX/x86
3.12 on Linux/x86
If you did the install above, run the ocaml example program with:
ocamlfind ocamlopt -package camlrdf -o example.opt example.ml -linkpkg ./example.opt
and the result should be:
found statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} Parsing URI (file) ../data/dc.rdf Parsing added 3 statements Printing all statements Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/description], "The generic home page of Dave Beckett."} Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/title], "Dave Beckett's Home Page"} Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} querying for dc:titles: { a = http://www.dajobe.org/ (RESOURCE) c = Dave Beckett's Home Page (LITERAL) } Writing model to test-out.rdf as rdf/xml
Read the pydoc Redland OCaml API for full details of the classes and methods provided along with examples of use.
The OCaml API is an object-based API reflecting the same structure of the Redland objects with simple mappings between them:
Concept | Redland Class | OCaml Module | Purpose |
---|---|---|---|
Resource / Literal | librdf_node | Rdf.Node | RDF Model & Syntax nodes |
Statement / Triple | librdf_statement | Rdf.Statement | RDF Model & Syntax arcs (statements, triples) [isa Resource] |
Model | librdf_model | Rdf.Model | Set of Statement s usually held in one Storage |
Storage | librdf_storage | Rdf.Storage | Storage for Model s either persistant or in-memory |
Stream | librdf_stream | Rdf.Stream | Providing sequences of Statement s from Parser s, queries |
Parser | librdf_parser | Rdf.Parser | Parsing to deliver Stream of Statement s or writing to a Model |
Query | librdf_query | Rdf.Query | Querying a Model to deliver QueryResults |
QueryResults | librdf_query_results | Rdf.QueryResults | Results of applying a Query to a Model giving either variable bindings with Node values or Stream of Statement s |
Serializer | librdf_serializer | Rdf.Serializer | Serializing a Model in a format such as RDF/XML |
Iterator | librdf_iterator | Rdf.Iterator | Enumerating Node s from queries. |
URI | librdf_uri | Rdf.Uri | Providing URIs for Resource s, Parser s, ... |
World | librdf_world | RDF wrapper class handling Redland startup/shutdown | |
Digest | librdf_digest | Internal content digest class | |
Hash | librdf_hash | Internal key:value maps class |
Copyright (C) 2012 Codinuum Software Lab, Copyright (C) 2000-2007 Dave Beckett, Copyright (C) 2000-2005 University of Bristol