3 # BioPerl module Bio::Biblio
5 # Cared for by Martin Senger <senger@ebi.ac.uk>
6 # For copyright and disclaimer see below.
9 # POD documentation - main docs before the code
13 Bio::Biblio - A Bibliographic Query Service module
18 my $biblio = Bio::Biblio->new();
20 print $biblio->find ('perl')->get_count . "\n";
22 my $collection = $biblio->find ('brazma', 'authors');
23 while ( $collection->has_next ) {
24 print $collection->get_next;
27 # The new() method can accept parameters, for example:
29 $biblio = Bio::Biblio->new
31 -location => 'http://www.ebi.ac.uk/openbqs/services/MedlineSRS',
32 -destroy_on_exit => '0');
34 # See below for some one-liners
38 This is a class whose instances can access bibliographic
39 repositories. It allows to query a bibliographic database (such as
40 MEDLINE) and then to retrieve resulting citations from it. The
41 citations are returned in an XML format which is native to the
42 repository but there are also supporting modules for converting them
45 The detailed descriptions of all query and retrieval methods are in
46 L<Bio::DB::BiblioI> (an interface). All those methods should be
47 called on instances of this (Bio::Biblio) module.
49 The module complies (with some simplifications) with the specification
50 described in the B<OpenBQS> project. Its home page is at
51 L<http://www.ebi.ac.uk/~senger/openbqs>.
53 The module also gives an access to a set of controlled vocabularies
54 and their values. It allows to introspect bibliographic repositories
55 and to find what citation resource types (such as journal and book
56 articles, patents or technical reports) are provided, and what
57 attributes they have, eventually what attribute values are allowed.
59 Here are some one-liners:
61 perl -MBio::Biblio -e 'print new Bio::Biblio->get_by_id ("12368254")'
63 -e 'print join ("\n", @{ Bio::Biblio->new->find ("brazma")->get_all_ids })'
65 -e 'print Bio::Biblio->new->find ("Java")->find ("perl")->get_count'
68 =head1 OVERVIEW OF CLASSES AND PACKAGES
74 This is the main class to be used by the end users. It
75 loads a real implementation for a particular access protocol according
76 to the argument I<-access>. At the time of writing this documentation
77 there is only one available access module implementing all query and
82 This module implements all methods defined in the interface
83 I<Bio::DB::BiblioI> (see L<Bio::DB::BiblioI>) by delegating
84 calls to a loaded low-level module (e.g. see
85 L<Bio::DB::Biblio::soap>).
87 Note that there are other modules which do not use the SOAP protocol
88 and do not implement all query methods - nevertheless they have retrieval
89 methods and can be used in the same way:
93 Lacking documentation:
97 =item Bio::DB::BiblioI
99 This is an interface defining all methods that can be called on
100 I<Bio::Biblio> instances.
102 =item Bio::DB::Biblio::soap
104 This is a real implementation of all methods defined in
105 Bio::DB::BiblioI using SOAP protocol (calling a WebService
106 based on SOAP). This class should not be instantiated directly (use
107 I<Bio::Biblio> instead). See L<Bio::DB::BiblioI> for details.
109 =item Bio::Biblio::IO
111 This module instantiates and uses a converter of the citations read by
112 any of the access methods mentioned above. See L<Bio::Biblio::IO> for
115 =item Bio::Biblio::IO::medlinexml and Bio::Biblio::IO::medline2ref
117 A converter of MEDLINE citations in XML into Perl objects.
119 =item Bio::Biblio::IO::pubmedxml and Bio::Biblio::IO::pubmed2ref
121 A converter of PUBMED citations in XML into Perl objects.
129 User feedback is an integral part of the evolution of this and other
130 Bioperl modules. Send your comments and suggestions preferably to
131 the Bioperl mailing list. Your participation is much appreciated.
133 bioperl-l@bioperl.org - General discussion
134 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
136 =head2 Reporting Bugs
138 Report bugs to the Bioperl bug tracking system to help us keep track
139 of the bugs and their resolution. Bug reports can be submitted via the
142 http://bugzilla.open-bio.org/
146 Martin Senger (martin.senger@gmail.com)
150 Copyright (c) 2002 European Bioinformatics Institute. All Rights Reserved.
152 This module is free software; you can redistribute it and/or modify
153 it under the same terms as Perl itself.
157 This software is provided "as is" without warranty of any kind.
165 OpenBQS home page: http://www.ebi.ac.uk/~senger/openbqs/
169 Comments to the Perl client: http://www.ebi.ac.uk/~senger/openbqs/Client_perl.html
175 The main documentation details are to be found in
178 Here is the rest of the object methods. Internal methods are preceded
179 with an underscore _.
184 # Let the code begin...
190 use base
qw(Bio::Root::Root Bio::DB::BiblioI);
192 # -----------------------------------------------------------------------------
196 Usage : my $obj = Bio::Biblio->new(@args);
197 Returns : Bio::Biblio object on success, or undef on failure
198 Args : This module recognizes and uses:
201 It indicates what lower-level module to load.
204 -location => 'http://...'
205 It says where to find a bibliographic query service.
206 The format and contents of this argument is dependent
207 on the '-access' argument.
209 For 'soap' access it is a URL of a WebService.
210 Default is http://www.ebi.ac.uk/openbqs/services/MedlineSRS
212 Other arguments can be given here but they are
213 recognized by the lower-level module
214 (e.g. see Bio::DB::Biblio::soap).
216 It builds, populates and returns a new I<Bio::Biblio> object. This is
217 how it is seen from the outside. But in fact, it builds, populates and
218 returns a more specific lower-level object, for example
219 I<Bio::DB::Biblio::soap> object - which one it is depends on the
220 parameter I<-access>.
222 The real initialization is done in the method I<_initialize> of the
225 This method can also be used for I<cloning> an existing object and
226 changing or adding new attributes to it in the same time. This is,
227 however, not particulary useful for the casual users of this module,
228 because the query methods (see L<Bio::DB::BiblioI>) themselves
229 already return cloned objects with more refined query
230 collections. Anyway this is how the cloning can be done:
233 my $biblio = Bio::Biblio->new();
235 # this will create a new object which will NOT send a 'destroy'
236 # message to the remote server when its life ends
237 my $clone = $biblio->new (-destroy-on-exit => '0');
242 my ($caller,@args) = @_;
243 my $class = ref($caller) || $caller;
245 # if $caller is an object, or if it is an underlying
246 # 'real-work-doing' class (e.g. Bio::DB::Biblio::soap) then
247 # we want to call SUPER to create and bless an object
249 if ($class =~ /Bio::DB::Biblio::(\S+)/) {
250 my ($self) = $class->SUPER::new
(@args);
252 # now the $self is an empty object - we will populate it from
253 # the $caller - if $caller is an object
256 %{ $self } = %{ $caller };
259 # and finally add values from '@args' into the newly created
260 # object (the values will overwrite the values copied above)
262 $self->_initialize (@args);
265 # this is called only the first time when somebody calls: 'new
266 # Bio::Biblio (...)', and it actually loads a 'real-work-doing'
267 # module and call this new() method again (unless the loaded
268 # module has its own new() method)
272 @param { map { lc $_ } keys %param } = values %param; # lowercase keys
274 $param {'-access'} ||
275 $class->_guess_access ( $param {'-location'} ) ||
277 $access = "\L$access"; # normalize capitalization to lower case
279 # load module with the real implementation - as defined in $access
280 return unless (&_load_access_module
($access));
282 # this will call this same method new() - but rather its the
283 # upper (object) branche
284 return "Bio::DB::Biblio::$access"->new (@args);
288 # -----------------------------------------------------------------------------
290 =head2 _load_access_module
292 Usage : $class->_load_access_module ($access)
293 Returns : 1 on success, undef on failure
294 Args : 'access' should contain the last part of the
295 name of a module who does the real implementation
297 It does (in run-time) a similar thing as
299 require Bio::DB::Biblio::$access
301 It prints an error on STDERR if it fails to find and load the module
302 (for example, because of the compilation errors in the module).
306 sub _load_access_module
{
308 my ($module, $load, $m);
310 $module = "_<Bio/DB/Biblio/$access.pm";
311 $load = "Bio/DB/Biblio/$access.pm";
313 return 1 if $main::{$module};
319 Bio
::Root
::Root
->throw (<<END);
320 $load: $access cannot be found or loaded
322 For more information about the Biblio system please see the Bio::Biblio docs.
330 # -----------------------------------------------------------------------------
334 Usage : $class->_guess_access ($location)
335 Returns : string with a guessed access protocol (e.g. 'soap')
336 Args : 'location' defines where to find a bibliographic service
337 in a protocol-dependent manner (e.g. for SOAP it is
338 a URL of a bibliographic WebService)
340 It makes an expert guess what kind of access/transport protocol should
341 be used based on the I<location> of the service (e.g. if the
342 I<location> looks like an IOR then the access protocol is probably
347 # this is kept here for the future when more access protocols
348 # (e.g. CORBA) may be available for accessing bibliographic query
352 # my ($class, $location) = @_;
356 =head2 VERSION and Revision
358 Usage : print $Bio::Biblio::VERSION;
359 print $Bio::Biblio::Revision;