This can be built two ways - using the configure program or using Perl's CPAN style perl Makefile.PL
Run ./configure optionally with --with-perl=/path/to/perl to use a particular perl version/program. The standard 'make' at the top level will then compile the binding against Redland. If Redland is not already installed, an internal copy will be configured and built.
Run perl Makefile.PL and a top-level Makefile will be created that is suitable for using in a CPAN or perl MakeMaker style. It will invoke configure and the makefile it generates internally.
$ makeand optionally
$ make check
If you did the install below, run the perl example program with:
perl ./example.pl
Otherwise, to run in the source tree do:
perl -Iblib/arch -Iblib/lib ./example.pl
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: {[http://example.org/foo], [http://example.org/foo], [http://example.org/foo]} Statement: {[http://example.org/foo], [http://example.org/foo], [http://example.org/foo]} Statement: {[http://purl.org/net/dajobe/], [http://purl.org/dc/elements/1.1/title], "Dave Beckett's Home Page"} Statement: {[http://purl.org/net/dajobe/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} Statement: {[http://purl.org/net/dajobe/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} Statement: {[http://purl.org/net/dajobe/], [http://purl.org/dc/elements/1.1/description], "The generic home page of Dave Beckett."} Searching model for statements matching predicate http://purl.org/dc/elements/1.1/creator Matching Statement: {[http://purl.org/net/dajobe/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} Subject: [http://purl.org/net/dajobe/] Predicate: [http://purl.org/dc/elements/1.1/creator] Object: Dave Beckett Matching Statement: {[http://purl.org/net/dajobe/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} Subject: [http://purl.org/net/dajobe/] Predicate: [http://purl.org/dc/elements/1.1/creator] Object: Dave Beckett Searching model for targets of subject http://purl.org/net/dajobe/ predicate http://purl.org/dc/elements/1.1/creator Matching Node: Dave Beckett Matching Node: Dave Beckett Querying for dc:titles: result 1: { a=[http://purl.org/net/dajobe/] c=Dave Beckett's Home Page } Writing model to test-out.rdf as rdf/xml Done
To install the binding 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
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:
Concept | Redland Class | Perl Class | Purpose |
---|---|---|---|
Resource / Literal | librdf_node | RDF::Redland::Node, RDF::Redland::BlankNode, RDF::Redland::URINode, RDF::Redland::LiteralNode and RDF::Redland::XMLLiteralNode |
RDF Model & Syntax nodes |
Statement / Triple | librdf_statement | RDF::Redland::Statement | RDF Model & Syntax arcs (statements, triples) [isa Resource] |
Model | librdf_model | RDF::Redland::Model | Set of Statements usually held in one Storage. |
Storage | librdf_storage | RDF::Redland::Storage | Storage for Models either persistant or in-memory. |
Stream | librdf_stream | RDF::Redland::Stream | Providing sequences of Statements from Parsers, queries. |
Parser | librdf_parser | RDF::Redland::Parser | Syntaxes parsers delivering Stream of Statements or writing to a Model |
Query | librdf_query | RDF::Redland::Query | Querying of an Model delivering a QueryResults |
QueryResults | librdf_query_results | RDF::Redland::QueryResults | Results of applying an Query to a Model giving either variable bindings with Node values or Stream of Statements |
Serializer | librdf_serializer | RDF::Redland::Serializer | Serializes a Model into a syntax such as RDF/XML |
Iterator | librdf_iterator | RDF::Redland::Iterator | Enumerating lists (of Node) from queries. |
URI | librdf_uri | RDF::Redland::URI | Provides URIs for Resources, Parsers, ... |
World | RDF::Redland | RDF wrapper class handling Redland startup/shutdown | |
Digest | librdf_digest | Internal content digest class | |
Hash | librdf_hash | Internal key:value maps class | |
RDF::Redland::RSS | Perl Module providing RSS 1.0 support. |
Either use any of the RDF::Redland:: module links above or start at the main RDF::Redland module and follow the references from there.
Copyright (C) 2000-2006 Dave Beckett, Copyright (C) 2000-2005 University of Bristol