MAGE::Extendable(3pm)
π MAGE::Extendable β User Contributed Perl Documentation π
okay so bestie, we're doing MAGE::Extendable(3pm) today and honestly? it's giving abstract base class royalty πβ¨. This is the perl documentation for it, and it's a whole journey, so grab a lil snack π and let's get into it.
π¦ NAME π¦
Bio::MAGE::Extendable β the class for the MAGE-OM API. that's it, that's the name π
β¨ SYNOPSIS β¨
here's the vibe, straight up:
use Bio::MAGE::Extendable
# Bio::MAGE::Extendable is an abstract base class and should not
# be directly instantiated. These examples indicate how subclass
# objects will behave
# 'propertySets' association
my $namevaluetype_array_ref = $extendable->propertySets(); # getter
$extendable->propertySets(\@namevaluetype_list); # setter
π¨ real talk: Bio::MAGE::Extendable is an abstract base class and should not be directly instantiated. the examples up there are just showing you how subclass objects will behave. do not come for me if you try to instantiate it, i warned you π
πΈ DESCRIPTION πΈ
okay so, direct from the MAGE-OM documentation for the Extendable class, no cap:
Abstract class that specifies for subclasses an association to NameValueTypes. These can be used, for instance, to specify proprietary properties and in-house processing hints.
and like, in case that wasn't clear: Bio::MAGE::Extendable is an abstract base class and should not be directly instantiated. instead, it serves as an interface definition for its subclasses. it's the blueprint bestie, not the building ποΈβ¨
π INHERITANCE π
Bio::MAGE::Extendable has the following subclasses (yes, it's a whole friend group, we love a big family π):
Bio::MAGE::HigherLevelAnalysis::NodeValueBio::MAGE::Description::DatabaseEntryBio::MAGE::ArrayDesign::ZoneLayoutBio::MAGE::ArrayDesign::ZoneGroupBio::MAGE::Description::ExternalReferenceBio::MAGE::DesignElement::PositionBio::MAGE::Description::OntologyEntryBio::MAGE::DesignElement::MismatchInformationBio::MAGE::Measurement::MeasurementBio::MAGE::DesignElement::FeatureInformationBio::MAGE::Measurement::UnitBio::MAGE::BioAssayData::BioAssayMappingBio::MAGE::BioAssayData::BioAssayDatumBio::MAGE::DescribableBio::MAGE::BioAssayData::QuantitationTypeMappingBio::MAGE::BioAssayData::DesignElementMappingBio::MAGE::DesignElement::FeatureLocationBio::MAGE::Array::FeatureDefectBio::MAGE::BioAssayData::BioDataValuesBio::MAGE::Array::ArrayManufactureDeviationBio::MAGE::Array::PositionDeltaBio::MAGE::Array::ZoneDefectBio::MAGE::Protocol::ParameterValueBio::MAGE::BioSequence::SeqFeatureLocationBio::MAGE::BioMaterial::CompoundMeasurementBio::MAGE::BioMaterial::BioMaterialMeasurementBio::MAGE::BioSequence::SequencePosition
π CLASS METHODS π
these are the methods you can call without even having an instance of the class first, using the Bio::MAGE::Extendable->methodname() syntax. iconic, honestly π«Ά
new()
new(%args)
so Bio::MAGE::Extendable is an abstract base class and should not be directly instantiated using the new() constructor. it's listed here purely to show you what arguments its subclasses will accept, iykyk.
the object constructor new() accepts the following optional named-value style arguments:
propertySetsβ sets the value of thepropertySetsassociation. the value must be of type: array ofBio::MAGE::NameValueType.
$obj = class->new(%parameters)
this one right here is the class constructor, the main character π₯
- Parameters: if you give it a list of name/value parameters, the corresponding slots, attributes, or associations will have their initial values set by the constructor.
- Return value: it returns a reference to an object of the class.
- Side effects: it invokes the
initialize()method if it is defined by the class.
@names = class->get_slot_names()
the get_slot_names() method grabs the name of every slot defined in a given class.
β οΈ NOTE: the list of names does not include attribute or association names. don't get it twisted.
- Return value: a list of the names of all slots defined for this class.
- Side effects: none.
@name_list = get_attribute_names()
returns the list of attribute data members for this class. slay.
@name_list = get_association_names()
returns the list of association data members for this class. also slay.
@class_list = get_superclasses()
returns the list of superclasses for this class. look up β¬οΈβ¨
@class_list = get_subclasses()
returns the list of subclasses for this class. look down β¬οΈπ
$name = class_name()
returns the full class name for this class.
$package_name = package_name()
returns the base package name (i.e. no 'namespace::') of the package that contains this class.
%assns = associations()
returns the association meta-information in a hash where the keys are the association names and the values are Association objects that provide the meta-information for the association. very meta of it π
π§ INSTANCE METHODS π§
$obj_copy = $obj->new()
when you invoke this with an existing object reference and not a class name, new() acts as a copy constructor β the new object's initial values get set to be those of the existing object. it's giving clone energy π―
- Parameters: no input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied.
- Return value: it returns 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 all at once. it's got two different invocation methods: the first takes a named parameter list, and the second takes two array references. pick your fighter π₯
- Return value: none.
- Side effects: will call
croak()if a slot_name is used that the class does not define. so like, don't do that π
@obj_list = $obj->get_slots(@name_list)
the get_slots() method gets the values of a bunch of slots all at once. efficiency 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. - 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. - Side effects: none.
π ATTRIBUTES π
attributes are simple data types that belong to a single instance of a class. in the Perl implementation of the MAGE-OM classes, the interface to attributes is implemented using separate setter and getter methods for each attribute.
Bio::MAGE::Extendable has the following attribute accessor methods:
(that's it. nothing here. the silence is loud π β but keep reading bestie, the associations are where it's at)
π¦ ASSOCIATIONS π¦
associations are references to other classes. associations in MAGE-OM have a cardinality that determines the minimum and maximum number of instances of the 'other' class that may be included in the association:
- there must be exactly one item in the association, i.e. this is a mandatory data field.
- 0..1 β there may be one item in the association, i.e. this is an optional data field.
- 1..N β there must be one or more items in the association, i.e. this is a mandatory data field, with list cardinality.
- 0..N β there may be one or more items in the association, i.e. this is an optional data field, with list cardinality.
Bio::MAGE::Extendable has the following association accessor methods:
propertySets
methods for the propertySets association.
from the MAGE-OM documentation:
Allows specification of name/value pairs. Meant to primarily help in-house, pipeline processing of instances by providing a place for values that aren't part of the specification proper.
$array_ref = $extendable->setPropertySets($array_ref)
- the restricted setter method for the
propertySetsassociation. - Input parameters: the value to which the
propertySetsassociation will be set : a reference to an array of objects of typeBio::MAGE::NameValueType. - Return value: the current value of the
propertySetsassociation : a reference to an array of objects of typeBio::MAGE::NameValueType. - Side effects: none.
- Exceptions: will call
croak()if no input parameters are specified, or if too many input parameters are specified, or if$array_refis not a reference to an array classBio::MAGE::NameValueTypeinstances.
$array_ref = $extendable->getPropertySets()
- the restricted getter method for the
propertySetsassociation. - Input parameters: none.
- Return value: the current value of the
propertySetsassociation : a reference to an array of objects of typeBio::MAGE::NameValueType. - Side effects: none.
- Exceptions: will call
croak()if any input parameters are specified.
$val = $extendable->addPropertySets(@vals)
because the propertySets association has list cardinality, it may store more than one value. this method adds the current list of objects in the propertySets association. the more the merrier, honestly π
- Input parameters: the list of values
@valsto add to the propertySets association. NOTE: submitting a single value is permitted. - Return value: the number of items stored in the slot after adding
@vals. - Side effects: none.
- Exceptions: will call
croak()if no input parameters are specified, or if any of the objects in@valsis not an instance of classBio::MAGE::NameValueType.
and finally, the lil code moment that lives here:
sub initialize {
carp __PACKAGE__ . "::initialize: abstract base classes should not be instantiated";
}
π¨ like it literally says in the code: abstract base classes should not be instantiated. the carp is coming for you if you try. consider yourself warned bestie ππ
π« SLOTS, ATTRIBUTES, AND ASSOCIATIONS π«
okay bestie, so in the Perl implementation of MAGE-OM classes there are literally three flavors of class data members and you need to know the difference or you're gonna be lost: slots, attributes, and associations. Let's break them down π
π SLOTS
This API uses the term "slot" to mean a data member of the class that wasn't in the UML model at all, and it's used for mainly internal purposes. Like, mind your business energy. Use these only if you understand the inner workings of the API, fr fr. Most often, slots get used by generic methods β think the ones hanging out in the XML writing and reading classes β¨
Slots are implemented with unified getter/setter methods, here's the tea:
$var = $obj->slot_name();β retrieves the current value of the slot. just a lil peek π$new_var = $obj->slot_name($new_var);β stores$new_varin the slot, and the return value is also$new_var. she gives back what you gave her, iconic behavior π@names = $obj->get_slot_names()β returns the list of all slots in the class. the whole roster π«Ά
DATA CHECKING: No data type checking is made for these methods. none. zero. she does not check, she just vibes π
π¦ ATTRIBUTES AND ASSOCIATIONS
The terms "attribute" and "association" mean data members of the class that were specified directly from the UML model. So these ones actually came from the source, no cap.
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. like, none. don't hand her anything π
set*β sets the current value, replacing any existing value. out with the old, in with the new β¨
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. 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.
add*β appends a list of objects to any values that may already be stored in the association.
NOTE: Only present in associations with list cardinality. if you don't have list cardinality, she's simply not there, periodt. 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 whole set of generic methods that will operate on slots, attributes, and associations. one class to rule them all, main character energy:
$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 in this page for a detailed description of these methods β the deep dive lives over there, iykyk π
π BUGS
Found something cursed? Please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net) π
πΈ AUTHOR
Jason E. Stewart (jasons 'at' cpan 'dot' org) β thank you for your service, king π«Ά
π SEE ALSO
π¨ POD ERRORS
Hey! The above document had some coding errors, which are explained below. not me exposing the doc's messy era π:
- Around line 361:
- '=item' outside of any '=over'
- Around line 446:
- You forgot a '=back' before '=head2'
- Around line 474:
- Expected '=item 2'
- Around line 479:
- Expected '=item 3'
- Around line 484:
- Expected '=item 4'
and that's the whole page, bestie!! π this doc came to you courtesy of perl v5.32.0, dated 2020-11-27, and it's the MAGE::Extendable(3pm) page β go forth and be extendable, slay β¨π
π¦
π¦ 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