Bio::DB::BiblioI(3pm)

πŸ’– Bio::DB::BiblioI πŸ’–

okay so bestie, this is Bio::DB::BiblioI(3pm) β€” an interface to a Bibliographic Query Service. Sit down, hydrate, we're doing this. πŸ¦‹βœ¨


🌸 VERSION 🌸

version 1.70 β€” she's current, she's iconic, no cap. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

okay so real talk first: this is an interface module. You do not instantiate it, bestie, it's giving abstract art πŸ–ΌοΈ. You use the Bio::Biblio module instead, like this:

use Bio::Biblio;
my $biblio = Bio::Biblio->new(@args);

✨ DESCRIPTION ✨

This interface is the whole blueprint for talking to a bibliographic repository β€” like, how to query it, how to pull citations out of it. That's the vibe. 🫢

The citations you get back come in XML format, and if you want them as actual perl objects you can convert them using Bio::Biblio::IO. Slay. πŸ’–

Also, this interface complies β€” with some simplifications, she's not doing extra credit β€” with the spec described in the OpenBQS project. Its home page is at http://www.ebi.ac.uk/~senger/openbqs/. iykyk. πŸ‘‘


🌈 ATTRIBUTES 🌈

⭐ has_next

Usage   : my $is = $biblio->has_next;
Returns : 1 or undef
Args    : none

It returns 1 if there's a next citation available in the underlying query collection. Otherwise it returns undef β€” like, nothing, ghosted, gone. πŸ‘»

It throws an exception if this object does not represent any query result β€” see the explanation in method reset_retrieval elsewhere in this document. (Yes bestie, we get there, be patient. πŸ™ˆ)

⭐ exists

Usage   : my $exists = $biblio->exists;
Returns : 1 or undef
Args    : none

It returns 1 if the underlying query collection represented by the $biblio object still exists β€” on the server side, like, remotely. πŸ”₯

So here's the situation: if you have a collection ID (maybe you stored it or printed it in a previous session) but you don't have a "Bio::Biblio" object representing it anymore, this is literally how you check whether the collection is still alive:

use Bio::Biblio;
print
  Bio::Biblio->new(-collection_id => '1014324148861')->exists;
It throws an exception if this object does not represent any query result β€” see the explanation in method reset_retrieval elsewhere in this document.

⭐ contains

Usage   : my $yes = $biblio->contains ($vocabulary_name, $value);
Returns : 1 or undef
Args    : $vocabulary_name defines a vocabulary where to look,
          and a $value defines what to look for

It returns 1 if the given controlled vocabulary contains the given value. πŸ’―

For example β€” when you know that a vocabulary "MEDLINE/JournalArticle/properties" contains the value "COUNTRY", you can use it in the find method, like so:

$biblio->find ('United States', 'COUNTRY');

see how that works? obsessed. πŸŽ€


πŸ’œ METHODS πŸ’œ

πŸ¦‹ get_collection_id

Usage   : my $collection_id = $biblio->get_collection_id;
Returns : string identifying a query collection
          represented by the $biblio object
Args    : none

Every query collection is uniquely identify-able by its collection ID β€” every single one, no duplicates, main character energy only. πŸ‘‘ The value you get back can be used to populate another $biblio object, and then you can go access that collection. Cute, right?

πŸ¦‹ get_count

Usage   : my $count = $biblio->get_count;
Returns : integer
Args    : none, or a string identifying a query collection

It returns the number of citations in the query collection represented by the calling $biblio object β€” or, if you pass one, in the collection whose ID is given as an argument. Either way, you're getting a number. πŸ”’

πŸ¦‹ find

Usage   : my $new_biblio = $biblio->find ($keywords, $attrs);
          my $new_biblio = $biblio->find ('perl', 'abstract');
          my $new_biblio = $biblio->find ( [ 'perl', 'Java' ] );
Returns : new Bio::Biblio object representing a new query
          collection
Args    : $keywords - what to look for (mandatory)
           - a comma-delimited list of keywords, or
           - an array reference with keywords as elements
          $attrs - where to look in (optional)
           - a comma-delimited list of attribute names, or
           - an array reference with attribute names as elements

This is the main query method, bestie, the moment, the one we've all been waiting for. πŸ’… It looks for the $keywords in a default set of attributes β€” or, if $attrs is given, only in the given attributes.

And here's the slay: because it returns a new Bio::Biblio object, and that new object can be queried again, you can chain several invocations together like the queen you are:

$biblio->find ('Brazma')->find ('Robinson')->get_collection_id;

look at her go. πŸƒβ™€οΈπŸ’¨

πŸ¦‹ reset_retrieval

Usage   : $biblio->reset_retrieval;
Returns : nothing
Args    : none

It sets an iterator stored in the $biblio object back to its beginning. After this, the retrieval methods has_next, get_next and get_more start iterating the underlying query collection again β€” from the start, rewound, replayed. πŸ”

It throws an exception if this object does not represent any query result (e.i. it does not contain a collection ID). Note that a collection ID is created automatically when this object was returned by a find method, or it can be assigned in a constructor using argument -collection_id.

πŸ¦‹ get_next

Usage   : my $citation = $biblio->get_next;
Returns : a citation in an XML format
Args    : none

It returns the next available citation from the underlying query collection. ⚠️ It throws an exception if there are no more citations β€” so to avoid that whole situation, use it together with the has_next method, like this:

my $result = $biblio->find ('brazma', 'authors');
while ( $result->has_next ) {
    print $result->get_next;
}
It also throws an exception if this object does not represent any query result β€” see the explanation in reset_retrieval elsewhere in this document.

πŸ¦‹ get_more

Usage   : my $r_citations = $biblio->get_more (5);
Returns : an array reference - each element has a citation
          in an XML format
Args    : an integer 'how_many' citations to return;
          default is 1 - but it is assigned with warning

It returns the next how_many available citations from the underlying query collection. She's chill about it: it does not throw any exception if 'how_many' is more than what's currently available β€” it simply returns less. Generous. 🫢 However 😭 it does throw an exception if you use it again without calling reset_retrieval first. Rude but fair.

It also throws an exception if this object does not represent any query result β€” see the explanation in method reset_retrieval elsewhere in this document.

πŸ¦‹ get_all_ids

Usage   : my $r_ids = $biblio->get_all_ids;
Returns : an array reference - each element has
          a citation identifier
Args    : none

The identifiers of all citations in the underlying query collection get returned. πŸ’– A usual pattern is to take those ids and then use them in the get_by_id method, like:

my $biblio = $repository->find ('brazma')->find ('robinson');
foreach my $id ( @{ $biblio->get_all_ids } ) {
    print $biblio->get_by_id ($id);
}
It throws an exception if this object does not represent any query result β€” see the explanation in method reset_retrieval elsewhere in this document.

πŸ¦‹ get_by_id

Usage   : my $citation = $biblio->get_by_id ('12368254');
Returns : a citation in an XML format
Args    : a citation identifier (PMID for Medline)

It returns a citation β€” and she does not care whether the citation is or is not in the underlying query collection (of course, it still has to be in the repository, bestie, let's be reasonable πŸ™ˆ).

πŸ¦‹ get_all

Usage   : my $all = $biblio->get_all;
Returns : a (big) string with all citations in an XML format
Args    : none

It returns an XML valid string β€” which means the individual citations are also surrounded by a "set" XML tag, she's wrapped, she's contained, she's cozy 🎁 β€” representing all citations from the underlying query collection.

Heads up bestie: some servers may limit the number of citations which can be returned by this method. In such a case you need either to refine further your query collection (using the find method) or to retrieve results by iteration (methods has_next, get_next, get_more).
It throws an exception if this object does not represent any query result β€” see the explanation in method reset_retrieval elsewhere in this document.

πŸ¦‹ destroy

Usage   : $biblio->destroy;
Returns : nothing
Args    : none

It sends a message to the remote server to forget (or free, or destroy β€” whatever the server chooses to do, honestly it's her call πŸ’…) the query collection represented by this object.

It throws an exception if this object does not represent any query collection.

πŸ¦‹ get_vocabulary_names

Usage   : print join ("\n", @{ $biblio->get_vocabulary_names });
Returns : an array reference - each element has a name
          of a controlled vocabulary
Args    : none

So the controlled vocabularies let you introspect bibliographic repositories β€” like snooping but make it academic πŸ” β€” and find out what citation resource types (journal and book articles, patents or technical reports, all of that) are provided by the repository, what attributes they have, and eventually what attribute values are allowed.

This method returns the names of all available controlled vocabularies. Those names can then be used in the other methods that deal with vocabularies: contains, get_entry_description, get_all_values, and get_all_entries. Teamwork, babes. 🫢

πŸ¦‹ get_entry_description

Usage   : $biblio->get_entry_description ($voc_name, $value);
Returns : a string with a desciption
Args    : $voc_name defines a vocabulary where to look,
          and a $value defines whose description to return

Each vocabulary entry has its value (mandatory attribute), and can have a description (optional attribute, she's flexible ✨). That description might just be a human readable explanation of an attribute, or it can carry a more exact meaning. For example, the server implementation of the bibliographic query service provided by the EBI puts into attribute descriptions the words queryable and/or retrievable to distinguish the role of the attributes. ikr, so organised. πŸ“‹

It throws an exception if either the vocabulary or the value do not exist.

πŸ¦‹ get_all_values

Usage   : $biblio->get_all_values ($vocabulary_name);
Returns : an array reference - each element has a value (scalar)
          from the given controlled vocabulary
Args    : $vocabulary_name defines a vocabulary whose values
          are being returned

It returns all values of the given vocabulary. Every last one. πŸ’―

It throws an exception if the vocabulary does not exist.

πŸ¦‹ get_all_entries

Usage   : $biblio->get_all_entries ($vocabulary_name);
Returns : a hash reference - keys are vocabulary values
          and values are their descriptions
Args    : $vocabulary_name defines a vocabulary whose entries
          are being returned

It returns pairs of values and their descriptions for the whole vocabulary β€” the full package, no crumbs. πŸŽ€

It throws an exception if the vocabulary does not exist.

Here's one way to grab it and print it out:

my $name = 'MEDLINE2005/JournalArticle/properties';
use Data::Dumper;
print Data::Dumper->Dump ( [$biblio->get_all_entries ($name)],
                           ['All entries']);

okay bestie that's where part 1 ends, don't go anywhere, there's more coming 🌸

πŸ’Œ FEEDBACK πŸ’Œ

Okay bestie, this part is literally just how to talk to us, and we want to hear from you, no cap.

πŸ“¬ Mailing lists

Here's the tea: user feedback is a whole integral part of how this module and all the other Bioperl modules grow and evolve. So like, send your comments and suggestions, preferably to the Bioperl mailing list. Your participation? much appreciated 🫢

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

πŸ›Ÿ Support

Hear me out: pls direct your usage questions and support issues to the mailing list:

bioperl-l@bioperl.org

and not straight to the module maintainer, okay? It's giving "don't DM the one person when there's a whole group chat of legends." So many experienced and responsive experts will be able to look at the problem and address it quickly πŸ’…

And if at all possible, include a thorough description of the problem, with code and data examples. The more context, the faster the slay. ✨

πŸ› Reporting bugs

Found a bug? Iconic of you, honestly. Report it to the Bioperl bug tracking system so we can keep track of all the bugs and their resolutions β€” it's a whole vibe check for quality, fr fr. Bug reports can be submitted via the web:

https://redmine.open-bio.org/projects/bioperl/

✍️ Authors

Martin Senger <martin.senger@gmail.com>

This software is Copyright (c) by 2002 European Bioinformatics Institute and released under the license of the same terms as the perl 5 programming language system itself.


And that's a wrap on Bio::DB::BiblioI(3pm), bestie! πŸŽ€ This lil' page you just read was generated by perl v5.36.0 on 2023-02-14 β€” yeah, Valentine's Day, because this module loves you back πŸ’– Go forth, query those bibliographies, and remember: read the docs, respect the license, and email the mailing list before you email the maintainer. Periodt. πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from