NAME
MOSES::MOBY::Cache::Central - access to locally cached Moby entities
SYNOPSIS
use MOSES::MOBY::Cache::Central;
# create an aceess to a Moby registry cache
# (use 'registry' only for non-default registries)
my $cache = new MOSES::MOBY::Cache::Central
( cachedir =>'/usr/local/cache/',
);
my $cache = new MOSES::MOBY::Cache::Central
( cachedir =>'/usr/local/cache/',
registry => 'IRRI'
);
# get the location of the cache and the URL of a registry (whose
# cache we are accessing)
print $cache->cachedir;
print $cache->registry();
# create a cache for datatypes and fill it up
$cache->create_datatype_cache;
#update the datatype cache
$cache->update_datatype_cache;
# create a cache for services and fill it up
$cache->create_service_cache;
#update the services cache
$cache->update_service_cache;
# get a data type called DNASequence
my $dna = $cache->get_datatype ('DNASequence');
# get all datatypes from cache
my @dts = $cache->get_datatypes;
# get all services provided by the given authority
my @services = $cache->get_service ('bioinfo.inibap.org');
# get some services provided by the given authority
my @services = $cache->get_service
('bioinfo.inibap.org',
qw( Get_TropGENE_Distance_Matrix Get_TropGENE_Nj_Tree ));
# get all authorities and service names
require Data::Dumper;
my %all = $cache->get_service_names;
print Data::Dumper->Dump ( [ \%all ], ['By_authorities']);
DESCRIPTION
Access to a cached Moby entities, such as data types and service definitions. It does not create a cache, just reads it.
AUTHORS
Edward Kawas (edward.kawas [at] gmail [dot] com)
Martin Senger (martin.senger [at] gmail [dot] com)
ACCESSIBLE ATTRIBUTES
Details are in MOSES::MOBY::Base. Here just a list of them:
- cachedir
-
A mandatory parameter containing a name of a local directory where is a Moby cache. The Moby cache directory can contain more caches (from more Moby registries). The location points to the top-level directory name. For example, if we have the following directory structure (containing caches from four different Moby registries):
/work/moby-live/Java/myCache/ http58.47.47bioinfo46icapture46ubc46ca47cgi45bin47mobycentral47MOBY45Central46pl/ dataTypes/ namespaces/ services/ serviceTypes/ http58.47.47cropwiki46irri46org47cgi45bin47MOBY45Central46pl/ ... http58.47.47mips46gsf46de47cgi45bin47proj47planet47moby47MOBY45Central46pl/ ... http58.47.47mobycentral46icapture46ubc46ca47cgi45bin47MOBY0547mobycentral46pl/ ...
Then, the location should be
/work/moby-live/Java/myCache
. - registry
-
A URL of a moby registry whose cache you are going to access. Or an abbreviation (a synonym) of a BioMoby registry. See more about synonyms in MOSES::MOBY::Cache::Registries.
For a default registry, use string 'default' (but there is no need to do so: default is default by default).
- registries
-
An object of type MOSES::MOBY::Cache::Registries that you can manipulate to add more registries. See more about this object in MOSES::MOBY::Cache::Registries.
SUBROUTINES
get_datatypes
Return a reference to an array of MOSES::MOBY::Def::DataType
objects. They were generated from the local Moby cache. All data types found in the cache are returned.
No arguments (at least, so far).
get_datatype
Return a Moby data type definition (type MOSES::MOBY::Def::DataType), as obtained from a local cache. The argument is a name of a data type that will be returned.
Throw an exception if such named data type does not exist in the local cache.
create_datatype_cache
Create the datatype cache. This will over write any pre-existing cache that it finds.
Throw an exception if any of the following occur: * There is a SOAP error calling the registry * There were write errors on the cache directory or its contents
update_datatype_cache
Update the datatype cache. This will update any items that are 'old', by relying on the LSID for the datatype.
Throw an exception if any of the following occur: * A cache to update doesn't exist * There is a SOAP error calling the registry * There were read/write errors on the cache directory or its contents
create_service_cache
Create the service cache. This will over write any pre-existing cache that it finds.
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.
Throw an exception if any of the following occur: * A cache to update doesn't exist * There is a SOAP error calling the registry * There were read/write errors on the cache directory or its contents
get_datatype_names
Return an array of data type names obtained from the cache. The cache is defined by the cachedir
(and optionally by the registry
) parameters given in the constructor of this instance.
get_related_types
Return a reference to an array of MOSES::MOBY::Def::DataType
objects (they were generated from the local Moby cache). Include only those data types that are referred to (used by) the given data type.
An argument is one or more data types (MOSES::MOBY::Def::DataType
) whose related data types are looked for.
get_services
Return an array of BioMoby service definitions (type MOSES::MOBY::Def::Service
), as obtained from a local cache.
Without any arguments it returns all services from all authorities:
use MOSES::MOBY::Cache::Central;
# create an aceess to a Moby registry cache
# (use 'registry' only for non-default registries)
my $cache = new MOSES::MOBY::Cache::Central
( cachedir =>'/usr/local/cache/',
registry => 'http://my.moby.registry/endpoint/mobycentral.pl'
);
my @services = $cache->get_services;
If there is one argument, it should be a scalar, containing an authority name. All services from this authority are returned. It throws an exception if such named authority does not exist in the local cache:
@services = $cache->get_services ($authority);
If there are more arguments, the first is always an authority name, as above, and the remaining are the service names (from the same authority) wanted to be returned. If any of these names represents an unknown service, it is ignored (no exception thrown):
@services = $cache->get_services ('samples.jmoby.net',
qw ( HelloBiomobyWorld Mabuhay ));
or
@services = $cache->get_services ('samples.jmoby.net', 'Mabuhay');
get_service_names
Return a hash where keys are authority names and values are array references with service names belonging to corresponding authorities.
cache_exists
Return true if a local cache for the given registry exists (or probably exists). An argument is a synonym, or an endpoint, of a registry. See more about registry synonyms in MOSES::MOBY::Cache::Registries.
Here is how to ask for all existing registries:
create_cache_dirs
Creates the cache directories needed for generating datatypes and services.
Throws an exception if there are problems creating the directories.