Redland

Dave Beckett

Redland RDF API Redland RDF Language Bindings Raptor RDF Syntax Library Rasqal RDF Query Library
Hosted by
Dreamhost

since 2005.

Data

Redland librdf Language Bindings - Ruby Interface

Installing the Redland Ruby interface

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

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

 cd ruby
 make
 # optional (some tests require test/unit.rb - ships with ruby 1.8.0+)
 make check

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

 root# make install

The Ruby interface was originally written by Dominic Sisneros at the rdf-redland project on RubyForge. The interface here is an update of that with some fixes.

The Ruby interface has been tested with Ruby 1.8.3, 1.8.2, 1.8.1, 1.8. The minimum version is likely 1.8 although older ones may work.

Testing the Redland Ruby interface

The example program provided parses an RDF/XML source file into a model. It should be run with two arguments - the URI of the content (as file:/path/to/content) and the syntax name (say, rdfxml):

 # If installed
 ruby example.ruby file:../data/dc.rdf rdfxml
 # In source tree
 ruby -I. -Ilib example.ruby file:../data/dc.rdf rdfxml

Using the Redland Ruby API

Read the Ruby Doc Redland Ruby Doc API for details of the classes and methods provided wrapping the C API.

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

ConceptRedland ClassRuby ClassPurpose
Resource / Literallibrdf_node Redland::Node
Redland::BNode
Redland::Literal
RDF Model & Syntax nodes
Statement / Triplelibrdf_statement Redland::Statement RDF Model & Syntax arcs (statements, triples) [isa Resource]
Modellibrdf_model Redland::Model Set of Statements usually held in one Storage.
Storagelibrdf_storage Redland::TripleStore
Redland::FileStore
Redland::HashStore
Redland::MemoryStore
Storage for Models either persistant or in-memory.
Streamlibrdf_stream Redland::Stream Providing sequences of Statements from Parsers, queries.
Parserlibrdf_parser Redland::Parser Syntaxes parsers delivering Stream of Statements or writing to a Model
Querylibrdf_query Redland::Query Querying of an Model delivering a QueryResults
QueryResultslibrdf_query_results Redland::QueryResults Results of applying an Query to a Model giving either variable bindings with Node values or Stream of Statements
Serializerlibrdf_serializer Redland::Serializer Serializes a Model into a syntax such as RDF/XML
Iteratorlibrdf_iterator Enumerating lists (of Node) from queries.
URIlibrdf_uri Redland::Uri Provides URIs for Resources, Parsers, ...
WorldRedland::World RDF wrapper class handling Redland startup/shutdown
Digestlibrdf_digest Internal content digest class
Hashlibrdf_hash Internal key:value maps class

Copyright (C) 2000-2023

Copyright (C) 2002-2007

AltStyle によって変換されたページ (->オリジナル) /