Alberto Attilio Reggiori


RDFStore::Model - An implementation of the Model RDF API using tied hashes and implementing free-text search on literals


        use RDFStore::NodeFactory;
        my $factory= new RDFStore::NodeFactory();
        my $statement = $factory->createStatement(
                                $factory->createLiteral('Cool Web site')
        my $statement1 = $factory->createStatement(
                                $factory->createLiteral("Who? :-)")

        my $statement2 = $factory->createStatement(

        use RDFStore::Model;
        my $model = new RDFStore::Model( Name => 'store', Split => 20, Compression => 1, FreeText => 1 );

        my $model1 = $model->duplicate();

        print $model1->getDigest->equals( $model1->getDigest );
        print $model1->getDigest->hashCode;

        my $found = $model->find($statement2->subject,undef,undef);
        my $found1 = $model->find(undef,undef,undef,undef,'Cool'); #free-text search on literals :)

        #get Statements
        foreach ( @{$found->elements} ) {
                print $_->getLabel(),"\n";

        #or faster
        my $fetch;
        foreach ( @{$found->elements} ) {
                my $fetch=$_;  #avoid too many fetches from RDFStore::Model::Statements
                print $fetch->getLabel(),"\n";

        for ( 0..$#{$statements} ) {
                print $statements->[$_]->getLabel(),"\n";

        #get RDFNodes
        foreach ( keys %{$found->elements}) {
                print $found->elements->{$_}->getLabel(),"\n";


An RDFStore::Stanford::Model implementation using Data::MagicTie tied arrays and hashes to store triplets. The actual store could be tied either to an in-memory, a local or remote database - see Data::MagicTie(3).

This modules implements a storage and iterator by leveraging on perltie(3) and the Data::MagicTie(3) interface. A compact indexing model is used that allows to make free-text indexing up to literals.


The following methods construct/tie RDFStore::Model storages and objects:

$model = new RDFStore::Model( %whateveryoulikeit );

Create an new RDFStore::Model object and tie up a serie of Data::MagicTie hash databases to read/write/query RDFStore::RDFNode. The %whateveryoulikeit hash contains a set of configuration options about how and where store actual data. Most of the options correspond to the Data::MagicTie ones - see Data::MagicTie(3) Possible additional options are the following:


This is a label used to identify a Persistent storage by name. It might correspond to a physical file system directory containing the indexes DBs. By default if no Name option is given the storage is assumed to be in-memory (e.g. RDFStore::Storage::find method return result sets as in-memory models by default unless specified differently). For local persistent storages a directory named liek this option is created in the current working directory with mode 0666)


Sync the RDFStore::Model with the underling Data::MagciTie GDS after each add() or remove().


Switch on Run Length Encoding (RLE) on the internal index; this option allows to save a lot of space (or memory) if you are going to manage large models. For tiny models is faster to use no compression.


Enable free text searching on literals over a model (see find)


Data::MagicTie(3) Digest(3) RDFStore::Stanford::Digest::Digestable(3) RDFStore::Stanford::Digest(3) RDFStore::RDFNode RDFStore::Resource RDFStore::FindIndex(3)


        Alberto Reggiori <>

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 1508:

'=item' outside of any '=over'

Around line 1532:

You forgot a '=back' before '=head1'

You forgot a '=back' before '=head1'