| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> |
| 4 | <head> |
| 5 | <title>Redland RDF Application Framework - Perl Interface</title> |
| 6 | </head> |
| 7 | <body> |
| 8 | |
| 9 | <h1 style="text-align:center">Redland RDF Application Framework - Perl Interface</h1> |
| 10 | |
| 11 | <h2>Installing the Redland Perl interface</h2> |
| 12 | |
| 13 | <p>This is built if <tt>--with-perl</tt> is given to the configure |
| 14 | line, or <tt>--with-perl=perl5.8</tt> to use a particular perl |
| 15 | version/program. The standard 'make' at the top level will build it.</p> |
| 16 | |
| 17 | <p>You can also compile the perl interface by hand as follows:</p> |
| 18 | |
| 19 | <pre> |
| 20 | cd perl |
| 21 | make |
| 22 | |
| 23 | # optional |
| 24 | make check |
| 25 | </pre> |
| 26 | |
| 27 | <p>To install it system wide do this as <em>root</em> (or maybe via |
| 28 | sudo make install):</p> |
| 29 | |
| 30 | <pre> |
| 31 | root# make install |
| 32 | </pre> |
| 33 | |
| 34 | <p>The Redland Perl interface is mature has been tested with the |
| 35 | following versions (5.6.0 is the likely minimum; 5.005 is too |
| 36 | old).</p> |
| 37 | |
| 38 | <blockquote> |
| 39 | 5.8.3 on Solaris/Sparc<br /> |
| 40 | 5.8.3 on Linux/x86<br /> |
| 41 | 5.8.2 on Linux/x86<br /> |
| 42 | 5.8.1-RC3 on OSX/PPC<br /> |
| 43 | 5.8.0 on Linux/x86<br /> |
| 44 | 5.8.0 on Linux/IA64 |
| 45 | </blockquote> |
| 46 | |
| 47 | |
| 48 | <h2>Testing the Redland Perl interface</h2> |
| 49 | |
| 50 | <p>If you did the optional install above, run the perl example |
| 51 | program with:</p> |
| 52 | <pre> |
| 53 | perl ./example.pl |
| 54 | </pre> |
| 55 | |
| 56 | <p>Otherwise, to run in the source tree do:</p> |
| 57 | <pre> |
| 58 | perl -Iblib/arch -Iblib/lib ./example.pl |
| 59 | </pre> |
| 60 | |
| 61 | <p>and the result should be:</p> |
| 62 | <pre> |
| 63 | Creating storage |
| 64 | |
| 65 | Creating model |
| 66 | |
| 67 | Creating statement |
| 68 | |
| 69 | Adding statement to model |
| 70 | |
| 71 | Adding statement (new Statement(n, n, n)) to model |
| 72 | |
| 73 | Adding statement (n,n,n) to model |
| 74 | |
| 75 | Parsing URI (file) ../data/dc.rdf |
| 76 | Parsing added 3 statements |
| 77 | |
| 78 | Printing all statements |
| 79 | Statement: {[http://example.org/foo], [http://example.org/foo], [http://example.org/foo]} |
| 80 | Statement: {[http://example.org/foo], [http://example.org/foo], [http://example.org/foo]} |
| 81 | Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/title], "Dave Beckett's Home Page"} |
| 82 | Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} |
| 83 | Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} |
| 84 | Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/description], "The generic home page of Dave Beckett."} |
| 85 | |
| 86 | Searching model for statements matching predicate http://purl.org/dc/elements/1.1/creator |
| 87 | Matching Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} |
| 88 | Subject: [http://www.dajobe.org/] |
| 89 | Predicate: [http://purl.org/dc/elements/1.1/creator] |
| 90 | Object: Dave Beckett |
| 91 | Matching Statement: {[http://www.dajobe.org/], [http://purl.org/dc/elements/1.1/creator], "Dave Beckett"} |
| 92 | Subject: [http://www.dajobe.org/] |
| 93 | Predicate: [http://purl.org/dc/elements/1.1/creator] |
| 94 | Object: Dave Beckett |
| 95 | |
| 96 | Searching model for targets of subject http://www.dajobe.org/ predicate http://purl.org/dc/elements/1.1/creator |
| 97 | Matching Node: Dave Beckett |
| 98 | Matching Node: Dave Beckett |
| 99 | Querying for dc:titles: |
| 100 | result 1: { |
| 101 | a=[http://www.dajobe.org/] |
| 102 | c=Dave Beckett's Home Page |
| 103 | } |
| 104 | |
| 105 | Writing model to test-out.rdf as rdf/xml |
| 106 | |
| 107 | Done |
| 108 | </pre> |
| 109 | |
| 110 | |
| 111 | <h2>Using the Redland Perl API</h2> |
| 112 | |
| 113 | <p>Read the <a href="pod/RDF/Redland.html">Redland Perl POD</a> |
| 114 | documentation for full details of the classes and methods provided along with |
| 115 | examples of use.</p> |
| 116 | |
| 117 | <p>The Perl API is an object-based API reflecting the same structure |
| 118 | of the Redland objects with simple mappings between them:</p> |
| 119 | |
| 120 | <table border="1"> |
| 121 | <tr> |
| 122 | <th>Concept</th><th>Redland Class</th><th>Perl Class</th><th>Purpose</th> |
| 123 | </tr> |
| 124 | <tr> |
| 125 | <td>Resource / Literal</td><td><span class="redland_class">librdf_node</span></td><td><tt><a href="pod/RDF/Redland/Node.html">RDF::Redland::Node</a></tt>,<br /> |
| 126 | <tt><a href="pod/RDF/Redland/BlankNode.html">RDF::Redland::BlankNode</a></tt>,<br /> |
| 127 | <tt><a href="pod/RDF/Redland/URINode.html">RDF::Redland::URINode</a></tt>,<br /> |
| 128 | <tt><a href="pod/RDF/Redland/LiteralNode.html">RDF::Redland::LiteralNode</a></tt> and<br /> |
| 129 | <tt><a href="pod/RDF/Redland/XMLLiteralNode.html">RDF::Redland::XMLLiteralNode</a></tt> |
| 130 | </td> |
| 131 | <td>RDF Model & Syntax nodes</td> |
| 132 | </tr> |
| 133 | <tr> |
| 134 | <td>Statement / Triple</td><td><span class="redland_class">librdf_statement</span></td><td><tt><a href="pod/RDF/Redland/Statement.html">RDF::Redland::Statement</a></tt></td> |
| 135 | <td>RDF Model & Syntax arcs (statements, triples) [isa Resource]</td> |
| 136 | </tr> |
| 137 | <tr> |
| 138 | <td>Model</td><td><span class="redland_class">librdf_model</span></td><td><tt><a href="pod/RDF/Redland/Model.html">RDF::Redland::Model</a></tt></td> |
| 139 | <td>Set of <em>Statement</em>s usually held in one <em>Storage</em>.</td> |
| 140 | </tr> |
| 141 | <tr> |
| 142 | <td>Storage</td><td><span class="redland_class">librdf_storage</span></td><td><tt><a href="pod/RDF/Redland/Storage.html">RDF::Redland::Storage</a></tt></td> |
| 143 | <td>Storage for <em>Model</em>s either persistant or in-memory.</td> |
| 144 | </tr> |
| 145 | <tr> |
| 146 | <td>Stream</td><td><span class="redland_class">librdf_stream</span></td><td><tt><a href="pod/RDF/Redland/Stream.html">RDF::Redland::Stream</a></tt></td> |
| 147 | <td>Providing sequences of <em>Statement</em>s from <em>Parser</em>s, queries.</td> |
| 148 | </tr> |
| 149 | <tr> |
| 150 | <td>Parser</td><td><span class="redland_class">librdf_parser</span></td><td><tt><a href="pod/RDF/Redland/Parser.html">RDF::Redland::Parser</a></tt></td> |
| 151 | <td>Syntaxes parsers delivering <em>Stream</em> of <em>Statement</em>s or writing to a <em>Model</em></td> |
| 152 | </tr> |
| 153 | <tr> |
| 154 | <td>Query</td><td><span class="redland_class">librdf_query</span></td><td><tt><a href="pod/RDF/Redland/Query.html">RDF::Redland::Query</a></tt></td> |
| 155 | <td>Querying of an <em>Model</em> delivering a <em>QueryResults</em></td> |
| 156 | </tr> |
| 157 | <tr> |
| 158 | <td>QueryResults</td><td><span class="redland_class">librdf_query_results</span></td><td><tt><a href="pod/RDF/Redland/QueryResults.html">RDF::Redland::QueryResults</a></tt></td> |
| 159 | <td>Results of applying an <em>Query</em> to a <em>Model</em> giving either variable bindings with <em>Node</em> values or <em>Stream</em> of <em>Statement</em>s</td> |
| 160 | </tr> |
| 161 | <tr> |
| 162 | <td>Serializer</td><td><span class="redland_class">librdf_serializer</span></td><td><tt><a href="pod/RDF/Redland/Serializer.html">RDF::Redland::Serializer</a></tt></td> |
| 163 | <td>Serializes a <em>Model</em> into a syntax such as RDF/XML</td> |
| 164 | </tr> |
| 165 | <tr> |
| 166 | <td>Iterator</td><td><span class="redland_class">librdf_iterator</span></td><td><tt><a href="pod/RDF/Redland/Iterator.html">RDF::Redland::Iterator</a></tt></td> |
| 167 | <td>Enumerating lists (of <em>Node</em>) from queries.</td> |
| 168 | </tr> |
| 169 | <tr> |
| 170 | <td>URI</td><td><span class="redland_class">librdf_uri</span></td><td><tt><a href="pod/RDF/Redland/URI.html">RDF::Redland::URI</a></tt></td> |
| 171 | <td>Provides URIs for <em>Resource</em>s, <em>Parser</em>s, ...</td> |
| 172 | </tr> |
| 173 | <tr> |
| 174 | <td>World</td><td> </td><td><tt><a href="pod/RDF/Redland.html">RDF::Redland</a></tt></td> |
| 175 | <td>RDF wrapper class handling Redland startup/shutdown</td> |
| 176 | </tr> |
| 177 | <tr> |
| 178 | <td>Digest</td><td><span class="redland_class">librdf_digest</span></td><td> </td> |
| 179 | <td>Internal content digest class</td> |
| 180 | </tr> |
| 181 | <tr> |
| 182 | <td>Hash</td><td><span class="redland_class">librdf_hash</span></td><td> </td> |
| 183 | <td>Internal key:value maps class</td> |
| 184 | </tr> |
| 185 | <tr> |
| 186 | <td> </td><td> </td><td><tt><a href="pod/RDF/Redland/RSS.html">RDF::Redland::RSS</a></tt></td> |
| 187 | <td>Perl Module providing <a href="http://purl.org/rss/1.0/">RSS 1.0</a> support.</td> |
| 188 | </tr> |
| 189 | </table> |
| 190 | |
| 191 | <h2>Perl API Reference Documentation</h2> |
| 192 | |
| 193 | <p>Either use any of the <tt>RDF::Redland::</tt> module links above or start |
| 194 | at the <a href="pod/RDF/Redland.html">main RDF::Redland module</a> |
| 195 | and follow the references from there.</p> |
| 196 | |
| 197 | <hr /> |
| 198 | |
| 199 | <p>Copyright (C) 2000-2007 <a href="http://www.dajobe.org/">Dave Beckett</a>, Copyright (C) 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 200 | |
| 201 | </body> |
| 202 | </html> |