RDF::R...Storage(3pm)

πŸ’– RDF::Redland::Storage β€” the manual, but make it slay ✨

okay so bestie, buckle up, we're looking at RDF::Redland::Storage(3pm), which lives in the User Contributed Perl Documentation section of the manual (3pm, for my perl girlies πŸͺ). It's the Redland RDF Storage Class and honestly? iconic. Let's get into it πŸ’…


✨ NAME ✨

RDF::Redland::Storage β€” the Redland RDF Storage Class, periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

use RDF::Redland;
my $storage=new RDF::Redland::Storage("hashes", "test", "new='yes',hash-type='memory'");
...

that's it, that's the vibe check ✨


🌸 DESCRIPTION 🌸

You make these objects to hold your RDF::Redland::Model objects β€” either persistently (like, they survive, main character energy) or in memory (fleeting, a moment, gone). Your call, babe 🫢


πŸŽ€ CONSTRUCTORS πŸŽ€

new STORAGE_NAME [NAME [OPTIONS_STRING]]

Make a brand new RDF::Redland::Storage object, no cap. You're building it with the storage factory named STORAGE_NAME, the storage itself named NAME, and the storage options OPTIONS_STRING β€” and those options are specific to the storage factory type, so like, know your factory bestie πŸ’…

The storage options can come in either of two forms, and both are valid:

  • A Perl hash πŸ“ β€” follows normal Perl conventions, and the boolean options use normal Perl concepts of truth.
  • A string πŸŽ€ β€” formatted like key1='value1',key2='value2', and the single quotes are required. Do not skip them. I see you trying to skip them.

currently defined storage options πŸ’–

  • new='yes' β€” Create a new storage, erasing any existing one. Boolean, and it's the default. bye bye old data πŸ‘‹
  • write='yes' β€” Provide write access to the store. Boolean, default. If you don't, it's read only, so no touching πŸ”’
  • dir='DIR' β€” Work in DIR directory when creating files.
  • mode='MODE' β€” File creation mode; the default is (octal) 0644. It takes decimal (123), hex (0x123) or octal (0123).
  • contexts='yes' β€” Enable statement contexts. Every statement can be stored with an optional context Node, and the context gets retrieved after queries. Boolean. very demure, very mindful ✨
  • hash-type='TYPE' β€” (hashes storage only) Use the TYPE hash-type for hashes storage. Currently defined types are 'memory' and 'bdb', but it's dependent on the hash factories available.
  • index-predicates='yes' β€” (hashes storage only) Enable indexing from predicates to (subject,object), which can in particular be useful for rdf:type relations. Boolean. lowkey a game changer πŸ”₯
  • bulk='no' β€” (mysql storage only) Whether the model/storage-method add_statements should be optimized, until a model/storage sync operation. Boolean.
  • merge='no' β€” (mysql storage only) Whether to maintain a table with merged models. Boolean.

example, string form πŸ¦‹

$storage=new RDF::Redland::Storage("hashes", "test",
                            "new='yes',hash-type='bdb',dir='.'");

example, Perl hash form πŸ’œ

$storage=new RDF::Redland::Storage("hashes", "test",
                            {new=>1,hash-type=>'bdb',dir=>'.'});

okay so that one creates a new storage of the hashes type (that's indexed hashes btw) named test β€” and heads up, these will be file names or URIs if the storage is persistent β€” with options new='yes',hash-type='bdb',dir='.'. So a new storage gets created with BerkeleyDB (BDB) key:value hashes, i.e. persistent and sitting pretty in the current directory. obsessed πŸ₯°

example, Perl hash form (the sequel) πŸ“

$storage=new RDF::Redland::Storage("mysql", "test", {host=>'localhost',database=>'testdb',user=>'testuser',new=>0,password=>'',contexts=>1});

this one uses an existing storage of the mysql type, named test on localhost, with database name testdb, using a user testuser and no password. and Contexts are enabled ✨

new_from_storage STORAGE

Make a new RDF::Redland::Storage object from the RDF::Redland::Storage STORAGE β€” this is the copy constructor, bestie. 🫢 Just know the new storage may have a new name chosen by the storage factory, so don't come for me if the name changed, that's just how she is.


πŸ‘‘ SEE ALSO πŸ‘‘

RDF::Redland::Model β€” go read that one next, iykyk πŸ’…


πŸ’œ AUTHOR πŸ’œ

Dave Beckett β€” http://www.dajobe.org/ πŸ‘‘


and that's the whole page, no crumbs left 🧚 this beauty is from perl v5.42.3, dated 2026-08-20, and it's the RDF::R...Storage(3pm) page β€” so go forth, make your storages, and remember: single quotes are required. mwah πŸ’‹ slay

πŸ“¦ where this page comes from