NAME

MOBY::RDF::Ontologies::Cache::ObjectCache - Module for creating a cache of datatypes for use when generating RDF


SYNOPSIS

        use MOBY::RDF::Ontologies::Cache::ObjectCache;
        # required
        my $cachedir = "/tmp/";
        # optional - gets default values from MOBY::Client::Central
        my $url = "http://moby.ucalgary.ca/moby/MOBY-Central.pl";;
        my $uri = "http://moby.ucalgary.ca/MOBY/Central";;
        my $x = MOBY::RDF::Ontologies::Cache::ObjectCache->new(
                endpoint        => $url, 
                namespace       => $uri,
                cache           => $cachedir,
        );
        # create the object cache
        $x->create_object_cache();
        # update the cache
        $x->update_object_cache();
        # obtain the RDF in a thread safe manner
        my $rdf = $x->get_rdf


DESCRIPTION

        This module aids in the creation and maintainence of a datatype cache for use in generating datatype RDF


AUTHORS

 Edward Kawas (edward.kawas [at] gmail [dot] com)


SUBROUTINES

new

Instantiate a ObjectCache object.

Parameters:
* A Hash with keys:
-> endpoint=> the BioMOBY registry endpoint to use <optional>
-> namespace=> the BioMOBY registry namespace to use <optional>
-> cache=> the directory to store the cache <REQUIRED>

This subroutine attempts to create the cache directories right away and if any problems occur then an Exception is thrown.

create_object_cache

Create the datatype cache. This will over write any pre-existing cache that it finds.

This method is not thread safe.

Throw an exception if any of the following occurs: * A SOAP error as a result of calling the registry * Problems writing to the cache directory

update_object_cache

Update the object cache. This will update any items that are 'old', by relying on the LSID for the datatype. This method is not thread safe.

This method returns the number of changed resources.

To update the cache with a thread safe method, call get_rdf.

Throw an exception if any of the following occur:
* There is a SOAP error calling the registry
* There were read/write errors on the cache directory or its contents

get_rdf

Gets the cached copy of the RDF for all datatypes. This subroutine is thread safe as it performs a flock on a Lock file in the directory while performing operations.

Throw an exception if any of the following occur:
* There was a SOAP problem communicating with a registr
* There was a file read/write while performing cache related
activities
* There was a problem parsing XML