MAGE::...ription(3pm)
π MAGE::...ription(3pm) π
okay bestie, gather round, because we're about to get into Bio::MAGE::Description β straight out of the User Contributed Perl Documentation collection, no cap. it's a Perl thing, it's a MAGE thing, it's giving very structured, and honestly? it ate. π
β¨ NAME β¨
Bio::MAGE::Description β the container module for the classes in the MAGE package called Description. she holds the whole squad together, fr fr. π«Ά
β¨ SYNOPSIS β¨
use Bio::MAGE::Description;
that's it. that's the whole vibe check. one line and you're in. π
β¨ DESCRIPTION β¨
so this is a package module, which means it's not out here doing one single job β it's the encapsulator. it wraps up a whole bunch of classes in the Bio::MAGE hierarchy, and those classes belong to the Description package of the MAGE-OM object model. so like, it's the friend group chat, and all the classes are the members. π
β¨ CLASSES β¨
the Bio::MAGE::Description module contains the following Bio::MAGE classes, and yes, every single one of them is iconic:
DescriptionDatabaseEntryDatabaseExternalReferenceOntologyEntry
the way that's a whole lineup?? πβ¨
β¨ CLASS METHODS β¨
@class_list = Bio::MAGE::Description::classes();
this one hands you back a list of the class names in this package β and the important part, bestie: they are non-fully qualified, meaning they do not have 'Bio::MAGE::' stuck on the front like a last name. just the first names. casual. π
$obj = class->new(%parameters)
the "new()" method is the class constructor. it's the birth of the object, the main character entrance, if you will.
- Parameters: if you hand it a list of name/value pairs, the matching slots, attributes, or associations get their initial values set right there by the constructor. so thoughtful.
- Return value: a reference to an object of the class. a whole new baby. πΌ
- Side effects: it invokes the
"initialize()"method if the class defines one.
@names = class->get_slot_names()
the "get_slot_names()" method is how you retrieve the name of all the slots defined in a given class.
NOTE: this list of names does not include attribute names or association names. just slots. do not get it twisted. π
- Return value: a list of the names of all slots defined for this class.
- Side effects: none. clean. immaculate.
@name_list = get_attribute_names()
returns the list of attribute data members for this class. π
@name_list = get_association_names()
returns the list of association data members for this class. π
@class_list = get_superclasses()
returns the list of superclasses for this class. the ancestors. the lineage. π§¬
@class_list = get_subclasses()
returns the list of subclasses for this class. the little ones. π£
$name = class_name()
returns the full class name for this class. full government name. π
$package_name = package_name()
returns the base package name β i.e. with no 'namespace::' on the front β of the package that contains this class. so just the base. stripped down. minimal. clean girl aesthetic. π
%assns = associations()
returns the association meta-information in a hash where the keys are the association names and the values are "Association" objects that carry the meta-information for that association. very meta, very slay. π₯
β¨ INSTANCE METHODS β¨
$obj_copy = $obj->new()
when you invoke this with an existing object reference instead of a class name, "new()" switches roles and acts as a copy constructor β the new object's initial values get set to be those of the existing object. it's giving identical twin energy. π―
- Parameters: no input parameters are used in the copy constructor; the initial values are taken directly from the object being copied.
- Return value: a reference to an object of the class.
- Side effects: it invokes the
"initialize()"method if it is defined by the class.
$obj->set_slots(%parameters)
$obj->set_slots(\@name_list, \@value_list)
the "set_slots()" method sets a bunch of slots at the same time, because doing them one by one is lowkey a waste of your time. it has two different invocation styles:
- the first takes a named parameter list.
- the second takes two array references.
- Return value: none.
- Side effects: it will call
"croak()"if you use aslot_namethat the class does not define. so like, don't invent slots. π«
@obj_list = $obj->get_slots(@name_list)
the "get_slots()" method gets the values of a number of slots at the same time. group retrieval. bulk behavior. efficient queen. π
- Return value: a list of instance objects.
- Side effects: none.
$val = $obj->set_slot($name,$val)
the "set_slot()" method sets the slot $name to the value $val.
- Return value: the new value of the slot, i.e.
$val. it echoes it back at you. πͺ - Side effects: none.
$val = $obj->get_slot($name)
the "get_slot()" method is used to get the values of a number of slots at the same time.
- Return value: a single slot value, or
undefif the slot has not been initialized. she's empty, she's mysterious. π - Side effects: none.
$val = $description->xml_lists()
$inval = $description->xml_lists($inval)
this is the unified setter/getter method for the xml_lists slot. two jobs, one method, multitasking icon.
if $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. (iykyk β¨)
- Input parameters: the optional
$invalwill invoke the setter method. - Return value: for both setter and getter, the current value of the
xml_listsslot. - Side effects: none.
- Exceptions: none.
$val = $description->tagname()
$inval = $description->tagname($inval)
the unified setter/getter method for the tagname slot. same deal, different slot.
if $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked.
- Input parameters: the optional
$invalwill invoke the setter method. - Return value: for both setter and getter, the current value of the
tagnameslot. - Side effects: none.
- Exceptions: none.
$val = $description->database_list()
$inval = $description->database_list($inval)
the unified setter/getter method for the database_list slot. you know the drill by now, bestie.
if $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked.
- Input parameters: the optional
$invalwill invoke the setter method. - Return value: for both setter and getter, the current value of the
database_listslot. - Side effects: none.
- Exceptions: none.
$array_ref = $description->getDatabase_list()
this method handles the list for the "Bio::MAGE::Description::Database" class. it returns a reference to an array of the class objects that have been associated with the package instance.
this is useful when retrieving data from a parsed MAGE-ML file. so if that's your situation, hi, this one's for you. πΈ
$description->addDatabase(@vals)
this method is the interface for adding "Bio::MAGE::Description::Database" objects to the "database_list" list. it's generally used by generic methods such as those in the XMLWriter.
- Input parameters: the list of values
@valsto add to the owner association. NOTE: submitting a single value is permitted β one is fine, no judgment. π«Ά - Return value: none.
- Side effects: none.
- Exceptions: it will call
"croak()"if no input parameters are specified, or if any of the objects in@valsis not a subclass of the class"Bio::MAGE::Description::Database". so bring the right class or don't come at all. π
$description->obj2xml($writer)
write out this object, and all sub-objects, as XML, using the supplied $writer to actually do the XML formatting. she writes, the writer writes. teamwork. π¦
- Input parameters:
$writermust be an XML writer, e.g. an instance ofBio::MAGE::XML::Writer. it must have the methods:write_start_tag(),write_end_tag(), andobj2xml(). - Return value: none.
- Side effects: all writing is delegated to the
$writerβ itswrite_start_tag()andwrite_end_tag()methods are invoked with the appropriate data, and all class sub-objects of the"Bio::MAGE::Description"instance will have theirobj2xml()methods invoked in turn. by letting the$writerdo the actual formatting of the output XML, it enables the user to precisely control the format. so you're the one in charge of the aesthetic. π - Exceptions: it will call
"croak()"if no identifier has been set for the"Bio::MAGE::Description"instance. set your identifier, bestie. π₯
$description->register($obj)
store an object for later writing as XML. it's the "save for later" of the MAGE world. π
- Input parameters: the object to be added to the list of registered objects.
- Return value: none.
- Side effects: if
$objneeds to be stored by this class, a reference will be stored in the correct XML list for this class. - Exceptions: none.
β¨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS β¨
in the Perl implementation of MAGE-OM classes, there are three types of class data members: "slots", "attributes", and "associations". three flavors. three vibes. let's go. π
SLOTS
this API uses the term "slot" to indicate a data member of the class that was not present in the UML model and is used for mainly internal purposes β use only if you understand the inner workings of the API. so like, this is backstage access, not general admission. most often, slots are used by generic methods such as those in the XML writing and reading classes.
slots are implemented using unified getter/setter methods:
$var = $obj->slot_name();β retrieves the current value of the slot.$new_var = $obj->slot_name($new_var);β stores$new_varin the slot, and the return value is also$new_var.@names = $obj->get_slot_names()β returns the list of all slots in the class.
DATA CHECKING: no data type checking is made for these methods. zero. none. you're on your own, gorgeous. π
ATTRIBUTES AND ASSOCIATIONS
the terms "attribute" and "association" indicate data members of the class that were specified directly from the UML model. so these are the legit ones, on the record. π
in the Perl implementation of MAGE-OM classes, association and attribute accessors are implemented using three separate methods:
get*β retrieves the current value.- NOTE: for associations, if the association has list cardinality, an array reference is returned.
- DATA CHECKING: ensure that no argument is provided. no arguments. not one. β
set*β sets the current value, replacing any existing value.- NOTE: for associations, if the association has list cardinality, the argument must be an array reference. because of this, you probably should be using the
add*methods instead. (the setter said "do less." π ) - DATA CHECKING: for attributes, ensure that a single value is provided as the argument. for associations, if the association has list cardinality, ensure that the argument is a reference to an array of instances of the correct MAGE-OM class; otherwise, ensure that there is a single argument of the correct MAGE-OM class.
- NOTE: for associations, if the association has list cardinality, the argument must be an array reference. because of this, you probably should be using the
add*β NOTE: only present in associations with list cardinality. appends a list of objects to any values that may already be stored in the association.- DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class.
GENERIC METHODS
the unified base class of all MAGE-OM classes, "Bio::MAGE::Base", provides a set of generic methods that will operate on slots, attributes, and associations:
$val = $obj->get_slot($name)
\@list_ref = $obj->get_slots(@name_list);
$val = $obj->set_slot($name,$val)
$obj->set_slots(%parameters)
$obj->set_slots(\@name_list, \@value_list)
see elsewhere on this page for a detailed description of these methods β they're all up there in the methods sections, go take a lil scroll. π«Ά
β¨ BUGS β¨
found a bug? π please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net). (yes, the 'at' and 'dot' are spelled out like that, that's the anti-spam disguise, she's shy. π)
β¨ AUTHOR β¨
Jason E. Stewart (jasons 'at' cpan 'dot' org) β the icon, the legend, the author. π
β¨ SEE ALSO β¨
and that's the whole page, bestie. this one came from perl v5.32.0, dated 2020-11-27, and it's filed under MAGE::...ription(3pm). go forth and construct your objects. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libbio-mage-perl 20030502.3-6 Β· MIT
- debian trixie: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu jammy: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu noble: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu resolute: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu stonking: libbio-mage-perl 20030502.3-6 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms