MAGE::...aValues(3pm)

πŸ’– NAME πŸ’–

Okay bestie, so this is a page from the User Contributed Perl Documentation, and the manual is called MAGE::...aValues(3pm) (the full glow-up name got truncated, but we know her πŸ’…).

The class we're stanning today is Bio::MAGE::BioAssayData::BioDataValues β€” Class for the MAGE-OM API. That's it. That's the name section. Short. Iconic. Periodt. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

Okay so here's the vibe, literally copy-paste this energy:

use Bio::MAGE::BioAssayData::BioDataValues

# Bio::MAGE::BioAssayData::BioDataValues 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 = $biodatavalues->propertySets(); # getter
$biodatavalues->propertySets(\@namevaluetype_list); # setter

Getter, setter, that's the whole plot. πŸŽ€


🌈 DESCRIPTION 🌈

Straight from the MAGE-OM documentation for the BioDataValues class, no cap:

The actual values for the BioAssayCube.

And here's the thing you need to internalize: Bio::MAGE::BioAssayData::BioDataValues is an abstract base class and should not be directly instantiated. She's not here to be built, she's here to be an interface definition for her subclasses. She's giving blueprint energy. Main character, but you don't cast the blueprint. πŸ‘‘


🧚 INHERITANCE 🧚

Bio::MAGE::BioAssayData::BioDataValues has the following superclasses:

  • Bio::MAGE::Extendable

Bio::MAGE::BioAssayData::BioDataValues has the following subclasses:

  • Bio::MAGE::BioAssayData::BioDataCube
  • Bio::MAGE::BioAssayData::BioDataTuples

Look at the family tree, we love a lineage moment 🌸


✨ CLASS METHODS ✨

The following methods can all be called without first having an instance of the class, via the Bio::MAGE::BioAssayData::BioDataValues->methodname() syntax. Class-level, no object required, we love a low-maintenance queen πŸ’…

  • new()
  • new(%args)

So here's the tea: Bio::MAGE::BioAssayData::BioDataValues is an abstract base class and should not be directly instantiated using the new() constructor. She's listed here just to indicate what arguments will be accepted for her subclasses.

The object constructor new() accepts the following optional named-value style arguments:

  • propertySets β€” Sets the value of the propertySets association (this association was inherited from class Bio::MAGE::Extendable).

The value must be of type: array of Bio::MAGE::NameValueType.

  • $obj = class->new(%parameters)

The new() method is the class constructor.

  • Parameters: if given 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 is used to retrieve the name of all slots defined in a given class.

NOTE: the list of names does not include attribute or association names. Don't come for her about it, that's just the rules πŸ™ˆ
  • 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.
  • @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.
  • @class_list = get_subclasses() β€” returns the list of subclasses for this class.
  • $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.

πŸ’œ INSTANCE METHODS πŸ’œ

Now we're in object territory, bestie. Gotta have an instance for these 🫢

  • $obj_copy = $obj->new()

When invoked with an existing object reference and not a class name, the new() method acts as a copy constructor β€” with the new object's initial values set to be those of the existing object. Clone era πŸ”₯

  • 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 is used to set a number of slots at the same time. It has two different invocation methods. The first takes a named parameter list, and the second takes two array references. Two ways, one queen πŸ’…

  • Return value: none
  • Side effects: will call croak() if a slot_name is used that the class does not define.
  • @obj_list = $obj->get_slots(@name_list)

The get_slots() method is used to get the values of a number of slots at the same time.

  • 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 undef if 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::BioAssayData::BioDataValues has the following attribute accessor methods:

(That's the whole list, bestie. She said no attributes, and honestly? Respect. Minimalism. πŸŽ€)

πŸ¦‹ 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 maybe included in the association:

  1. There must be exactly one item in the association, i.e. this is a mandatory data field.
  2. 0..1

There may be one item in the association, i.e. this is an optional data field.

  1. 1..N

There must be one or more items in the association, i.e. this is a mandatory data field, with list cardinality.

  1. 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::BioAssayData::BioDataValues 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 = $biodatavalues->setPropertySets($array_ref)

The restricted setter method for the propertySets association.

  • Input parameters: the value to which the propertySets association will be set : a reference to an array of objects of type Bio::MAGE::NameValueType
  • Return value: the current value of the propertySets association : a reference to an array of objects of type Bio::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_ref is not a reference to an array class Bio::MAGE::NameValueType instances
  • $array_ref = $biodatavalues->getPropertySets()

The restricted getter method for the propertySets association.

  • Input parameters: none
  • Return value: the current value of the propertySets association : a reference to an array of objects of type Bio::MAGE::NameValueType
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified
  • $val = $biodatavalues->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. More is more, bestie 🫢

  • Input parameters: the list of values @vals to 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 @vals is not an instance of class Bio::MAGE::NameValueType

And finally, the moment we've all been waiting for, the abstract-base-class energy in code form 🧚✨

sub initialize {

  carp __PACKAGE__ . "::initialize: abstract base classes should not be instantiated";

}

Like she literally says it herself: abstract base classes should not be instantiated. Listen to her. πŸ’…


✨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS ✨

Okay bestie, so in the Perl implementation of MAGE-OM classes there are three kinds of class data members, and you need to know the difference or you will absolutely get lost: slots, attributes, and associations. Let's break it down 🫢


πŸŽ€ SLOTS πŸŽ€

So this API uses the word "slot" to mean a data member of the class that wasn't in the UML model at all β€” it's there for mostly internal purposes. Like, mind your business energy πŸ’…. Use these only if you genuinely understand the inner workings of the API, fr fr.

Most of the time, slots get used by generic methods β€” you know, the ones in the XML writing and reading classes and stuff.

Slots are implemented with unified getter/setter methods, and here's the whole vibe:

  • $var = $obj->slot_name(); β€” grabs the current value of the slot. ✨
  • $new_var = $obj->slot_name($new_var); β€” stores $new_var in the slot, and the return value is also $new_var. It's giving "I give back what you gave me" πŸ’–
  • @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. Like, none. Zero. The API is trusting you completely and honestly that's a lot of pressure 😭

πŸ¦‹ ATTRIBUTES AND ASSOCIATIONS πŸ¦‹

Now "attribute" and "association" mean data members of the class that were specified directly from the UML model. So these are the official, canon, main-character data members πŸ‘‘

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, don't hand it anything, it will not accept your gifts πŸŽπŸ™…

  • set* β€” sets the current value, replacing any existing value. Out with the old, in with the new, periodt.
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.

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* β€”
NOTE: Only present in associations with list cardinality.

Appends a list of objects to any values that may already be stored in the association. Like adding more friends to the group chat, the more the merrier 🫢

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 base class to rule them all, lowkey iconic:

  • $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. (Yes, they're pointing you back up the page β€” go look, bestie, it's worth it πŸ“–βœ¨)


πŸ› BUGS πŸ›

Please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net)

Like, tell them, don't tell me, I'm just the messenger πŸ’Œ


πŸ‘‘ AUTHOR πŸ‘‘

Jason E. Stewart (jasons 'at' cpan 'dot' org)

Shoutout to Jason, absolute legend, ate and left no crumbs πŸ«‘πŸ’…


🌈 SEE ALSO 🌈

perl(1).


πŸ’€ POD ERRORS πŸ’€

Hey! The above document had some coding errors, which are explained below:

  • Around line 276:
    • '=item' outside of any '=over'
  • Around line 361:
    • You forgot a '=back' before '=head2'
  • Around line 389:
    • Expected '=item 2'
  • Around line 394:
    • Expected '=item 3'
  • Around line 399:
    • Expected '=item 4'

Not me exposing the doc's own typos 😭 it's fine, we've all been there, the POD parser is just being a hater πŸ’€


And that's the whole page, bestie! This one's perl v5.32.0, dated 2020-11-27, and it lives under MAGE::...aValues(3pm). Go forth and slay your MAGE-OM objects πŸŽ€βœ¨πŸ’–