Edward Kawas
and 1 contributors


MOBY::RDF::Ontologies::Cache::NamespaceCache - Module for creating a cache of namespaces for use when generating RDF


        use MOBY::RDF::Ontologies::Cache::NamespaceCache;

        # 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::NamespaceCache->new(
                endpoint        => $url, 
                namespace       => $uri,
                cache           => $cachedir,

        # create the namespace cache

        # update the cache

        # obtain the RDF in a thread safe manner
        my $rdf = $x->get_rdf


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


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



Instantiate a NamespaceCache 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 the namespace 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 the namespace cache. This will update any items that are 'old', by relying on the LSID for the namespace. This method is not thread safe.

This method returns the number of changed resources or -1 if a cache had to be created for you.

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


Gets the cached copy of the RDF for all namespaces. 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