2 # BioPerl module Bio::Biblio
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Martin Senger <senger@ebi.ac.uk>
7 # For copyright and disclaimer see below.
10 # POD documentation - main docs before the code
14 Bio::Biblio - A Bibliographic Query Service module
19 my $biblio = Bio::Biblio->new();
21 print $biblio->find ('perl')->get_count . "\n";
23 my $collection = $biblio->find ('brazma', 'authors');
24 while ( $collection->has_next ) {
25 print $collection->get_next;
28 # The new() method can accept parameters, for example:
30 $biblio = Bio::Biblio->new
32 -location => 'http://www.ebi.ac.uk/openbqs/services/MedlineSRS',
33 -destroy_on_exit => '0');
35 # See below for some one-liners
39 This is a class whose instances can access bibliographic
40 repositories. It allows to query a bibliographic database (such as
41 MEDLINE) and then to retrieve resulting citations from it. The
42 citations are returned in an XML format which is native to the
43 repository but there are also supporting modules for converting them
46 The detailed descriptions of all query and retrieval methods are in
47 L<Bio::DB::BiblioI> (an interface). All those methods should be
48 called on instances of this (Bio::Biblio) module.
50 The module complies (with some simplifications) with the specification
51 described in the B<OpenBQS> project. Its home page is at
52 L<http://www.ebi.ac.uk/~senger/openbqs>.
54 The module also gives an access to a set of controlled vocabularies
55 and their values. It allows to introspect bibliographic repositories
56 and to find what citation resource types (such as journal and book
57 articles, patents or technical reports) are provided, and what
58 attributes they have, eventually what attribute values are allowed.
60 Here are some one-liners:
62 perl -MBio::Biblio -e 'print new Bio::Biblio->get_by_id ("12368254")'
64 -e 'print join ("\n", @{ Bio::Biblio->new->find ("brazma")->get_all_ids })'
66 -e 'print Bio::Biblio->new->find ("Java")->find ("perl")->get_count'
69 =head1 OVERVIEW OF CLASSES AND PACKAGES
75 This is the main class to be used by the end users. It
76 loads a real implementation for a particular access protocol according
77 to the argument I<-access>. At the time of writing this documentation
78 there is only one available access module implementing all query and
83 This module implements all methods defined in the interface
84 I<Bio::DB::BiblioI> (see L<Bio::DB::BiblioI>) by delegating
85 calls to a loaded low-level module (e.g. see
86 L<Bio::DB::Biblio::soap>).
88 Note that there are other modules which do not use the SOAP protocol
89 and do not implement all query methods - nevertheless they have retrieval
90 methods and can be used in the same way:
94 Lacking documentation:
98 =item Bio::DB::BiblioI
100 This is an interface defining all methods that can be called on
101 I<Bio::Biblio> instances.
103 =item Bio::DB::Biblio::soap
105 This is a real implementation of all methods defined in
106 Bio::DB::BiblioI using SOAP protocol (calling a WebService
107 based on SOAP). This class should not be instantiated directly (use
108 I<Bio::Biblio> instead). See L<Bio::DB::BiblioI> for details.
110 =item Bio::Biblio::IO
112 This module instantiates and uses a converter of the citations read by
113 any of the access methods mentioned above. See L<Bio::Biblio::IO> for
116 =item Bio::Biblio::IO::medlinexml and Bio::Biblio::IO::medline2ref
118 A converter of MEDLINE citations in XML into Perl objects.
120 =item Bio::Biblio::IO::pubmedxml and Bio::Biblio::IO::pubmed2ref
122 A converter of PUBMED citations in XML into Perl objects.
130 User feedback is an integral part of the evolution of this and other
131 Bioperl modules. Send your comments and suggestions preferably to
132 the Bioperl mailing list. Your participation is much appreciated.
134 bioperl-l@bioperl.org - General discussion
135 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
139 Please direct usage questions or support issues to the mailing list:
141 I<bioperl-l@bioperl.org>
143 rather than to the module maintainer directly. Many experienced and
144 reponsive experts will be able look at the problem and quickly
145 address it. Please include a thorough description of the problem
146 with code and data examples if at all possible.
148 =head2 Reporting Bugs
150 Report bugs to the Bioperl bug tracking system to help us keep track
151 of the bugs and their resolution. Bug reports can be submitted via the
154 https://redmine.open-bio.org/projects/bioperl/
158 Martin Senger (martin.senger@gmail.com)
162 Copyright (c) 2002 European Bioinformatics Institute. All Rights Reserved.
164 This module is free software; you can redistribute it and/or modify
165 it under the same terms as Perl itself.
169 This software is provided "as is" without warranty of any kind.
177 OpenBQS home page: http://www.ebi.ac.uk/~senger/openbqs/
181 Comments to the Perl client: http://www.ebi.ac.uk/~senger/openbqs/Client_perl.html
187 The main documentation details are to be found in
190 Here is the rest of the object methods. Internal methods are preceded
191 with an underscore _.
196 # Let the code begin...
202 use base
qw(Bio::Root::Root Bio::DB::BiblioI);
204 # -----------------------------------------------------------------------------
208 Usage : my $obj = Bio::Biblio->new(@args);
209 Returns : Bio::Biblio object on success, or undef on failure
210 Args : This module recognizes and uses:
213 It indicates what lower-level module to load.
216 -location => 'http://...'
217 It says where to find a bibliographic query service.
218 The format and contents of this argument is dependent
219 on the '-access' argument.
221 For 'soap' access it is a URL of a WebService.
222 Default is http://www.ebi.ac.uk/openbqs/services/MedlineSRS
224 Other arguments can be given here but they are
225 recognized by the lower-level module
226 (e.g. see Bio::DB::Biblio::soap).
228 It builds, populates and returns a new I<Bio::Biblio> object. This is
229 how it is seen from the outside. But in fact, it builds, populates and
230 returns a more specific lower-level object, for example
231 I<Bio::DB::Biblio::soap> object - which one it is depends on the
232 parameter I<-access>.
234 The real initialization is done in the method I<_initialize> of the
237 This method can also be used for I<cloning> an existing object and
238 changing or adding new attributes to it in the same time. This is,
239 however, not particulary useful for the casual users of this module,
240 because the query methods (see L<Bio::DB::BiblioI>) themselves
241 already return cloned objects with more refined query
242 collections. Anyway this is how the cloning can be done:
245 my $biblio = Bio::Biblio->new();
247 # this will create a new object which will NOT send a 'destroy'
248 # message to the remote server when its life ends
249 my $clone = $biblio->new (-destroy-on-exit => '0');
254 my ($caller,@args) = @_;
255 my $class = ref($caller) || $caller;
257 # if $caller is an object, or if it is an underlying
258 # 'real-work-doing' class (e.g. Bio::DB::Biblio::soap) then
259 # we want to call SUPER to create and bless an object
261 if ($class =~ /Bio::DB::Biblio::(\S+)/) {
262 my ($self) = $class->SUPER::new
(@args);
264 # now the $self is an empty object - we will populate it from
265 # the $caller - if $caller is an object
268 %{ $self } = %{ $caller };
271 # and finally add values from '@args' into the newly created
272 # object (the values will overwrite the values copied above)
274 $self->_initialize (@args);
277 # this is called only the first time when somebody calls: 'new
278 # Bio::Biblio (...)', and it actually loads a 'real-work-doing'
279 # module and call this new() method again (unless the loaded
280 # module has its own new() method)
284 @param { map { lc $_ } keys %param } = values %param; # lowercase keys
286 $param {'-access'} ||
287 $class->_guess_access ( $param {'-location'} ) ||
289 $access = "\L$access"; # normalize capitalization to lower case
291 # load module with the real implementation - as defined in $access
292 return unless (&_load_access_module
($access));
294 # this will call this same method new() - but rather its the
295 # upper (object) branche
296 return "Bio::DB::Biblio::$access"->new (@args);
300 # -----------------------------------------------------------------------------
302 =head2 _load_access_module
304 Usage : $class->_load_access_module ($access)
305 Returns : 1 on success, undef on failure
306 Args : 'access' should contain the last part of the
307 name of a module who does the real implementation
309 It does (in run-time) a similar thing as
311 require Bio::DB::Biblio::$access
313 It prints an error on STDERR if it fails to find and load the module
314 (for example, because of the compilation errors in the module).
318 sub _load_access_module
{
320 my ($module, $load, $m);
322 $module = "_<Bio/DB/Biblio/$access.pm";
323 $load = "Bio/DB/Biblio/$access.pm";
325 return 1 if $main::{$module};
331 Bio
::Root
::Root
->throw (<<END);
332 $load: $access cannot be found or loaded
334 For more information about the Biblio system please see the Bio::Biblio docs.
342 # -----------------------------------------------------------------------------
346 Usage : $class->_guess_access ($location)
347 Returns : string with a guessed access protocol (e.g. 'soap')
348 Args : 'location' defines where to find a bibliographic service
349 in a protocol-dependent manner (e.g. for SOAP it is
350 a URL of a bibliographic WebService)
352 It makes an expert guess what kind of access/transport protocol should
353 be used based on the I<location> of the service (e.g. if the
354 I<location> looks like an IOR then the access protocol is probably
359 # this is kept here for the future when more access protocols
360 # (e.g. CORBA) may be available for accessing bibliographic query
364 # my ($class, $location) = @_;
368 =head2 VERSION and Revision
370 Usage : print $Bio::Biblio::VERSION;
371 print $Bio::Biblio::Revision;