Edward Kawas > MOSES-MOBY > MOSES::MOBY::Cache::Registries

Download:
MOSES-MOBY-0.96.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.06   Source  

NAME ^

MOSES::MOBY::Cache::Registries - List of known BioMoby registries

SYNOPSIS ^

  use MOSES::MOBY::Cache::Registries;

  # print synonyms of all available registries
  print "Available registries: ",
        join (", ", MOSES::MOBY::Cache::Registries->list);

  # print all features of a selected registry
  my $regs = new MOSES::MOBY::Cache::Registries;
  my %reg = $regs->get ('IRRI');
  foreach $key (sort keys $reg) {
     print "$key: $reg{$key}\n";
  }
  
  # add a new user defined (localhost) registry
  my $success = MOSES::MOBY::Cache::Registries->add(
               endpoint  => 'http://localhost/cgi-bin/MOBY/MOBY-Central.pl',
               namespace => 'http://localhost/MOBY/Central',
               name      => 'My Localhost registry',
               contact   => 'Edward Kawas (edward.kawas@gmail.com)',
               public    => 'yes',
               text      => 'A curated private registry hosted right here on this cpu',
               synonym   => 'my_new_reg',);
  print "Registry added!" if $success == 1;
  print "Registry not added to persistent store! Unknown error. Please check the log file." if $success == 0;
  print "Registry not added! Please check the parameters." if $success == -1;
  print "Registry not added! It may be already defined or synonym is in use."
      if $success == -2;

DESCRIPTION ^

A list of known BioMoby registries is hard coded here, and their characteristics (such as their endpoints) can be retrieved by a user-friendly synonym.

There is not that many registries, so there is (at the moment) no intention to retrieve details from a database. Hard-coded entries seem to be sufficient (if you create a new BioMoby registry, then make sure to add the registry to this list by either editing the list (persistent) or by programatically using the add() method).

SUBROUTINES ^

All subroutines can be called as object or class methods unless you plan on using the add() method. In that case, make sure to use class methods.

list

   my @regs = MOSES::MOBY::Cache::Registries->list;

Return a list of synonyms (abbreviations) of all available registries. At least a synonym default is always present. The synonyms can be used in the get method.

add

   my $regs = new MOSES::MOBY::Cache::Registries;
   print "Success!" if $reg->add(%details) == 1;

Add a registry to the list. This method consumes a hash with the following keys: synonym - a short name for the registry name - a human readable textual name of the reg endpoint - the endpoint to the registry namespace - the registry URI text - a human readable textual description for the reg public - is this a public registry? [yes | no] contact - contact information for the registry force - if the registry synonym is in use, overwrite it

Returns: 1 on success (add to persistent store and in memory object) 0 failure to add persistent store, for other non life threatening reasons (like incomplete config file, etc)- check log file -1 failure if there are bad parameters -2 failure if the registry already exists or synonym in use

The synonym can be used in the get method to retrieve the registry.

remove

   my $regs = new MOSES::MOBY::Cache::Registries;
   print "Success!" if $reg->remove($name) == 1;

Removes a registry from the list. This method consumes a the name of a registry to remove

Returns: 1 on success (remove from persistent store and in memory object) 0 failure to remove from persistent store, for other non life threatening reasons (like incomplete config file, etc)- check log file

get

   my %reg = MOSES::MOBY::Cache::Registries->get ('IRRI');
   my %reg = MOSES::MOBY::Cache::Registries->get;

Return a hash with details about a registry whose abbreviation was given as an argument. No argument is the same as 'default'. The known synonyms can be obtained by list method.

Returned hash can contain the following keys:

all

   my $regs = MOSES::MOBY::Cache::Registries->all;

Return a hash reference with details about all registries. It is the same as calling get for all individual entries.

AUTHORS ^

 Martin Senger (martin.senger [at] gmail [dot] com)
 Edward Kawas (edward.kawas [at] gmail [dot] com)
syntax highlighting: