Dave Beckett

Hosted by

since 2005.


(See DOAP Project)

Redland librdf Language Bindings - Perl Interface

Installing the Redland Perl interface

This is built if --with-perl is given to the configure line, or --with-perl=perl5.8 to use a particular perl version/program. The standard 'make' at the top level will build it.

You can also compile the perl interface by hand as follows:

  cd perl

  # optional
  make check

To install it system wide do this as root (or maybe via sudo make install):

  root# make install

The Redland Perl interface is mature has been tested with the following versions (5.6.0 is the likely minimum; 5.005 is too old).

5.8.3 on Solaris/Sparc
5.8.3 on Linux/x86
5.8.2 on Linux/x86
5.8.1-RC3 on OSX/PPC
5.8.0 on Linux/x86
5.8.0 on Linux/IA64

Testing the Redland Perl interface

If you did the optional install above, run the perl example program with:

  perl ./

Otherwise, to run in the source tree do:

  perl -Iblib/arch -Iblib/lib ./

and the result should be:

  Creating storage

  Creating model

  Creating statement

  Adding statement to model

  Adding statement (new Statement(n, n, n)) to model

  Adding statement (n,n,n) to model

  Parsing URI (file) ../data/dc.rdf
  Parsing added 3 statements

  Printing all statements
  Statement: {[], [], []}
  Statement: {[], [], []}
  Statement: {[], [], "Dave Beckett's Home Page"}
  Statement: {[], [], "Dave Beckett"}
  Statement: {[], [], "Dave Beckett"}
  Statement: {[], [], "The generic home page of Dave Beckett."}

  Searching model for statements matching predicate
  Matching Statement: {[], [], "Dave Beckett"}
    Subject: []
    Predicate: []
    Object: Dave Beckett
  Matching Statement: {[], [], "Dave Beckett"}
    Subject: []
    Predicate: []
    Object: Dave Beckett

  Searching model for targets of subject predicate
  Matching Node: Dave Beckett
  Matching Node: Dave Beckett
  Querying for dc:titles:
  result 1: {
    c=Dave Beckett's Home Page

  Writing model to test-out.rdf as rdf/xml


Using the Redland Perl API

Read the Redland Perl POD documentation for full details of the classes and methods provided along with examples of use.

The Perl API is an object-based API reflecting the same structure of the Redland objects with simple mappings between them:

ConceptRedland ClassPerl ClassPurpose
Resource / Literallibrdf_nodeRDF::Redland::Node,
RDF::Redland::LiteralNode and
RDF Model & Syntax nodes
Statement / Triplelibrdf_statementRDF::Redland::Statement RDF Model & Syntax arcs (statements, triples) [isa Resource]
Modellibrdf_modelRDF::Redland::Model Set of Statements usually held in one Storage.
Storagelibrdf_storageRDF::Redland::Storage Storage for Models either persistant or in-memory.
Streamlibrdf_streamRDF::Redland::Stream Providing sequences of Statements from Parsers, queries.
Parserlibrdf_parserRDF::Redland::Parser Syntaxes parsers delivering Stream of Statements or writing to a Model
Querylibrdf_queryRDF::Redland::Query Querying of an Model delivering a QueryResults
QueryResultslibrdf_query_resultsRDF::Redland::QueryResults Results of applying an Query to a Model giving either variable bindings with Node values or Stream of Statements
Serializerlibrdf_serializerRDF::Redland::Serializer Serializes a Model into a syntax such as RDF/XML
Iteratorlibrdf_iteratorRDF::Redland::Iterator Enumerating lists (of Node) from queries.
URIlibrdf_uriRDF::Redland::URI Provides URIs for Resources, Parsers, ...
World RDF::Redland RDF wrapper class handling Redland startup/shutdown
Digestlibrdf_digest  Internal content digest class
Hashlibrdf_hash  Internal key:value maps class
  RDF::Redland::RSS Perl Module providing RSS 1.0 support.

Perl API Reference Documentation

Either use any of the RDF::Redland:: module links above or start at the main RDF::Redland module and follow the references from there.