Edward Kawas > MOBY > MOBY::RDF::Ontologies::Cache::ServiceCache

Download:
MOBY-1.15.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.06   Source  

NAME ^

MOBY::RDF::Ontologies::Cache::ServiceCache - Module for creating a cache of service instances for use when generating RDF

SYNOPSIS ^

        use MOBY::RDF::Ontologies::Cache::ServiceCache;

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

        # create the service cache
        $x->create_service_cache();

        # update the cache
        $x->update_service_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 service instance cache for use in generating service RDF

AUTHORS ^

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

SUBROUTINES ^

new

Instantiate a ServiceCache 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_service_cache

Create the service 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_service_cache

Update the services 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 services. 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

syntax highlighting: