| 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 - Ruby Interface</title> |
| 6 | </head> |
| 7 | <body> |
| 8 | |
| 9 | <h1 style="text-align:center">Redland RDF Application Framework - Ruby Interface</h1> |
| 10 | |
| 11 | <h2>Installing the Redland Ruby interface</h2> |
| 12 | |
| 13 | <p>This is built if <tt>--with-ruby</tt> is given to the configure |
| 14 | line, or <tt>--with-ruby=ruby1.8</tt> to use a particular Ruby |
| 15 | version/program. The standard 'make' at the top level will build it.</p> |
| 16 | |
| 17 | <p>You can also compile the Ruby interface by hand as follows:</p> |
| 18 | |
| 19 | <pre> |
| 20 | cd ruby |
| 21 | make |
| 22 | |
| 23 | # optional (some tests require test/unit.rb - ships with ruby 1.8.0+) |
| 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 Ruby interface was originally written by Dominic Sisneros at the |
| 35 | <a href="http://rubyforge.org/projects/rdf-redland/">rdf-redland</a> |
| 36 | project on <a href="http://rubyforge.org/">RubyForge</a>. The interface |
| 37 | here is an update of that with some fixes. |
| 38 | </p> |
| 39 | |
| 40 | <p>The Ruby interface has been tested with Ruby 1.8.3, 1.8.2, 1.8.1, 1.8. |
| 41 | The minimum version is likely 1.8 although older ones may work. </p> |
| 42 | |
| 43 | |
| 44 | <h2>Testing the Redland Ruby interface</h2> |
| 45 | |
| 46 | <p>The example program provided parses an RDF/XML source file into a |
| 47 | model. It should be run with two arguments - the URI of the content |
| 48 | (as <tt>file:</tt><em>/path/to/content</em>) and the syntax name |
| 49 | (say, rdfxml):</p> |
| 50 | <pre> |
| 51 | # If installed |
| 52 | ruby example.ruby file:../data/dc.rdf rdfxml |
| 53 | |
| 54 | # In source tree |
| 55 | ruby -I. -Ilib example.ruby file:../data/dc.rdf rdfxml |
| 56 | </pre> |
| 57 | |
| 58 | |
| 59 | <h2>Using the Redland Ruby API</h2> |
| 60 | |
| 61 | <p>Read the Ruby Doc <a href="rdoc/index.html">Redland Ruby Doc API</a> |
| 62 | for details of the classes and methods provided wrapping the C API.</p> |
| 63 | |
| 64 | <p>The Ruby API is an object-based API reflecting the same structure |
| 65 | of the Redland objects with simple mappings between them:</p> |
| 66 | |
| 67 | <table border="1"> |
| 68 | <tr> |
| 69 | <th>Concept</th><th>Redland Class</th><th>Ruby Class</th><th>Purpose</th> |
| 70 | </tr> |
| 71 | <tr> |
| 72 | <td>Resource / Literal</td><td><span class="redland_class">librdf_node</span></td><td><a href="rdoc/classes/Redland/Node.html"><tt>Redland::Node</tt></a><br /><a href="rdoc/classes/Redland/BNode.html"><tt>Redland::BNode</tt></a><br /><a href="rdoc/classes/Redland/Literal.html"><tt>Redland::Literal</tt></a></td> |
| 73 | <td>RDF Model & Syntax nodes</td> |
| 74 | </tr> |
| 75 | <tr> |
| 76 | <td>Statement / Triple</td><td><span class="redland_class">librdf_statement</span></td><td><a href="rdoc/classes/Redland/Statement.html"><tt>Redland::Statement</tt></a></td> |
| 77 | <td>RDF Model & Syntax arcs (statements, triples) [isa Resource]</td> |
| 78 | </tr> |
| 79 | <tr> |
| 80 | <td>Model</td><td><span class="redland_class">librdf_model</span></td><td><a href="rdoc/classes/Redland/Model.html"><tt>Redland::Model</tt></a></td> |
| 81 | <td>Set of <em>Statement</em>s usually held in one <em>Storage</em>.</td> |
| 82 | </tr> |
| 83 | <tr> |
| 84 | <td>Storage</td><td><span class="redland_class">librdf_storage</span></td><td><a href="rdoc/classes/Redland/TripleStore.html"><tt>Redland::TripleStore</tt></a><br /><a href="rdoc/classes/Redland/FileStore.html"><tt>Redland::FileStore</tt></a><br /><a href="rdoc/classes/Redland/HashStore.html"><tt>Redland::HashStore</tt></a><br /><a href="rdoc/classes/Redland/MemoryStore.html"><tt>Redland::MemoryStore</tt></a></td> |
| 85 | <td>Storage for <em>Model</em>s either persistant or in-memory.</td> |
| 86 | </tr> |
| 87 | <tr> |
| 88 | <td>Stream</td><td><span class="redland_class">librdf_stream</span></td><td><a href="rdoc/classes/Redland/Stream.html"><tt>Redland::Stream</tt></a></td> |
| 89 | <td>Providing sequences of <em>Statement</em>s from <em>Parser</em>s, queries.</td> |
| 90 | </tr> |
| 91 | <tr> |
| 92 | <td>Parser</td><td><span class="redland_class">librdf_parser</span></td><td><a href="rdoc/classes/Redland/Parser.html"><tt>Redland::Parser</tt></a></td> |
| 93 | <td>Syntaxes parsers delivering <em>Stream</em> of <em>Statement</em>s or writing to a <em>Model</em></td> |
| 94 | </tr> |
| 95 | <tr> |
| 96 | <td>Query</td><td><span class="redland_class">librdf_query</span></td><td><a href="rdoc/classes/Redland/Query.html"><tt>Redland::Query</tt></a></td> |
| 97 | <td>Querying of an <em>Model</em> delivering a <em>QueryResults</em></td> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td>QueryResults</td><td><span class="redland_class">librdf_query_results</span></td><td><a href="rdoc/classes/Redland/QueryResults.html"><tt>Redland::QueryResults</tt></a></td> |
| 101 | <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> |
| 102 | </tr> |
| 103 | <tr> |
| 104 | <td>Serializer</td><td><span class="redland_class">librdf_serializer</span></td><td><a href="rdoc/classes/Redland/Serializer.html"><tt>Redland::Serializer</tt></a></td> |
| 105 | <td>Serializes a <em>Model</em> into a syntax such as RDF/XML</td> |
| 106 | </tr> |
| 107 | <tr> |
| 108 | <td>Iterator</td><td><span class="redland_class">librdf_iterator</span></td><td> </td> |
| 109 | <td>Enumerating lists (of <em>Node</em>) from queries.</td> |
| 110 | </tr> |
| 111 | <tr> |
| 112 | <td>URI</td><td><span class="redland_class">librdf_uri</span></td><td><a href="rdoc/classes/Redland/Uri.html"><tt>Redland::Uri</tt></a></td> |
| 113 | <td>Provides URIs for <em>Resource</em>s, <em>Parser</em>s, ...</td> |
| 114 | </tr> |
| 115 | <tr> |
| 116 | <td>World</td><td> </td><td><a href="rdoc/classes/Redland/World.html"><tt>Redland::World</tt></a></td> |
| 117 | <td>RDF wrapper class handling Redland startup/shutdown</td> |
| 118 | </tr> |
| 119 | <tr> |
| 120 | <td>Digest</td><td><span class="redland_class">librdf_digest</span></td><td> </td> |
| 121 | <td>Internal content digest class</td> |
| 122 | </tr> |
| 123 | <tr> |
| 124 | <td>Hash</td><td><span class="redland_class">librdf_hash</span></td><td> </td> |
| 125 | <td>Internal key:value maps class</td> |
| 126 | </tr> |
| 127 | </table> |
| 128 | |
| 129 | <hr /> |
| 130 | |
| 131 | <p>Copyright (C) 2002-2007 <a href="http://www.dajobe.org/">Dave Beckett</a>, Copyright (C) 2002-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 132 | |
| 133 | </body> |
| 134 | </html> |