Bio
Biblio
Toolbar
Summary
Bio::Biblio - A Bibliographic Query Service module
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
use Bio::Biblio;
my $biblio = new Bio::Biblio;
print $biblio->find ('perl')->get_count . "\n";
my $collection = $biblio->find ('brazma', 'authors');
while ( $collection->has_next ) {
print $collection->get_next;
}
Here are some one-liners:
perl -MBio::Biblio -e 'print new Bio::Biblio->get_by_id ("94033980")'
perl -MBio::Biblio \
-e 'print join ("\n", @{ new Bio::Biblio->find ("brazma")->get_all_ids })'
perl -MBio::Biblio \
-e 'print new Bio::Biblio->find ("Java")->find ("perl")->get_count'
The new method can get parameters, for example:
my $biblio = Bio::Biblio
(-access => 'soap',
-location => 'http://industry.ebi.ac.uk/soap/openBQS',
-destroy_on_exit => '0');
Description
This is a class whose instances can access bibliographic
repositories. It allows to query a bibliographic database (such as
MEDLINE) and then to retrieve resulting citations from it. The
citations are returned in an XML format which is native to the
repository but there are also supporting modules for converting them
into Perl objects.
The detailed descriptions of all query and retrieval methods are in
Bio::DB::BiblioI (an interface). All those methods should be
called on instances of this (Bio::Biblio) module.
The module complies (with some simplifications) with the specification
described in the
OpenBQS project. Its home page is at
http://industry.ebi.ac.uk/openBQS. There are also links to
available servers providing access to the bibliographic repositories
(namely to
MEDLINE).
The module also gives an access to a set of controlled vocabularies
and their values. It allows to introspect bibliographic repositories
and to find what citation resource types (such as journal and book
articles, patents or technical reports) are provided, and what
attributes they have, eventually what attribute values are allowed.
Methods
Methods description
Usage : $class->_guess_access ($location) Returns : string with a guessed access protocol (e.g. 'soap') Args : 'location' defines where to find a bibliographic service in a protocol-dependent manner (e.g. for SOAP it is a URL of a bibliographic WebService)
It makes an expert guess what kind of access/transport protocol should be used based on the location of the service (e.g. if the location looks like an IOR then the access protocol is probably CORBA). |
Usage : $class->_load_access_module ($access) Returns : 1 on success, undef on failure Args : 'access' should contain the last part of the name of a module who does the real implementation
It does (in run-time) a similar thing as
require Bio::DB::Biblio::$access
It prints an error on STDERR if it fails to find and load the module (for example, because of the compilation errors in the module). |
Usage : my $obj = new Bio::Biblio (@args); Returns : Bio::Biblio object on success, or undef on failure Args : This module recognizes and uses:
-access => 'soap'
It indicates what lower-level module to load.
Default is 'soap'.
-location => 'http://...' It says where to find a bibliographic query service. The format and contents of this argument is dependent on the '-access' argument.
For 'soap' access it is a URL of a WebService.
Default is http://industry.ebi.ac.uk/soap/openBQS
Other arguments can be given here but they are
recognized by the lower-level module
(e.g. see Bio::DB::Biblio::soap).
It builds, populates and returns a new Bio::Biblio object. This is how it is seen from the outside. But in fact, it builds, populates and returns a more specific lower-level object, for example Bio::DB::Biblio::soap object - which one it is depends on the parameter -access. The real initialization is done in the method _initialize of the lower-level object. This method can also be used for cloning an existing object and changing or adding new attributes to it in the same time. This is, however, not particulary useful for the casual users of this module, because the query methods (see Bio::DB::BiblioI) themselves already return cloned objects with more refined query collections. Anyway this is how the cloning can be done:
use Bio::Biblio; my $biblio = new Bio::Biblio;
# this will create a new object which will NOT send a 'destroy'
# message to the remote server when its life ends
my $clone = $biblio->new (-destroy-on-exit => '0'); |
Methods code
BEGIN { $VERSION = do { my @r = (q$$Revision: 1.7 $ =~ /\d+/g); sprintf "%d.%-02d", @r };
$Revision = q$$Id: Biblio.pm,v 1.7 2002/10/22 07:45:09 lapp Exp $; } |
sub _guess_access
{ return 'soap'; } |
sub _load_access_module
{ my ($access) = @_;
my ($module, $load, $m);
$module = "_<Bio/DB/Biblio/$access.pm";
$load = "Bio/DB/Biblio/$access.pm";
return 1 if $main::{$module};
eval {
require $load;
};
if ( $@ ) {
Bio::Root::Root->throw (<<END);
$load: $access cannot be found or loaded
Exception $@
For more information about the Biblio system please see the Bio::Biblio docs.
END
;
return;
}
return 1;
}
} |
sub new
{ my ($caller,@args) = @_;
my $class = ref($caller) || $caller;
if ($class =~ /Bio::DB::Biblio::(\S+)/) {
my ($self) = $class->SUPER::new (@args);
if (ref ($caller)) {
%{ $self } = %{ $caller };
}
$self->_initialize (@args);
return $self;
} else {
my %param = @args;
@param { map { lc $_ } keys %param } = values %param; my $access =
$param {'-access'} ||
$class->_guess_access ( $param {'-location'} ) ||
'soap';
$access = "\L$access";
return undef unless (&_load_access_module ($access));
return "Bio::DB::Biblio::$access"->new (@args);
}
}
} |
General documentation
OVERVIEW OF CLASSES AND PACKAGES | Top |
Bio::Biblio
This is the main class to be used by the end users. It
loads a real implementation for a particular access protocol according
to the argument
-access. At the time of writing this documentation
there is only one available access module implementing all query and
retrieval methods:
-access => soap
This module implements all methods defined in the interface
Bio::DB::BiblioI (see
Bio::DB::BiblioI) by delegating
calls to a loaded low-level module (e.g. see
Bio::DB::Biblio::soap).
Note that there is also another module (and perhaps more) which does
not use SOAP protocol and do not implement all query methods -
nevertheless it has retrieval methods and it can be used in the same
way:
-access => biofetch
Bio::DB::BiblioI
This is an interface defining all methods that can be called on
Bio::Biblio instances.
Bio::DB::Biblio::soap
This is a real implementation of all methods defined in
Bio::DB::BiblioI using SOAP protocol (calling a WebService
based on SOAP). This class should not be instantiated directly (use
Bio::Biblio instead). See
Bio::DB::BiblioI for details.
Bio::Biblio::IO
This module instantiates and uses a converter of the citations read by
any of the access methods mentioned above. See
Bio::Biblio::IO for
details.
Bio::Biblio::IO::medlinexml and Bio::Biblio::IO::medline2ref
A converter of MEDLINE citations in XML into Perl objects.
Bio::Biblio::IO::pubmedxml and Bio::Biblio::IO::pubmed2ref
A converter of PUBMED citations in XML into Perl objects.
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/MailList.shtml - About the mailing lists
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
email or the web:
bioperl-bugs@bioperl.org
http://bugzilla.bioperl.org/
Copyright (c) 2002 European Bioinformatics Institute. All Rights Reserved.
This module is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
This software is provided "as is" without warranty of any kind.
The main documentation details are to be found in
Bio::DB::BiblioI.
Here is the rest of the object methods. Internal methods are preceded
with an underscore _.
Usage : print $Bio::Biblio::VERSION;
print $Bio::Biblio::Revision;