MAGE::...otocol(3pm)

✨ Bio::MAGE::Protocol::Protocol ✨

okay bestie, sit down, hydrate πŸ’– this is the manual page for Bio::MAGE::Protocol::Protocol β€” you'll also see it filed under the name MAGE::...otocol(3pm) in the User Contributed Perl Documentation corner of the universe. it's giving class-for-the-MAGE-OM-API energy and honestly? we're obsessed.


🌸 NAME 🌸

Bio::MAGE::Protocol::Protocol β€” a whole entire class for the MAGE-OM API. that's the name, that's the vibe, periodt.


πŸ’… SYNOPSIS πŸ’…

use Bio::MAGE::Protocol::Protocol

# creating an empty instance
my $protocol = Bio::MAGE::Protocol::Protocol->new();

# creating an instance with existing data
my $protocol = Bio::MAGE::Protocol::Protocol->new(
      URI=>$uri_val,
      name=>$name_val,
      identifier=>$identifier_val,
      text=>$text_val,
      title=>$title_val,
      parameterTypes=>\@parameter_list,
      auditTrail=>\@audit_list,
      propertySets=>\@namevaluetype_list,
      hardwares=>\@hardware_list,
      descriptions=>\@description_list,
      softwares=>\@software_list,
      security=>$security_ref,
      type=>$ontologyentry_ref,
);

# 'URI' attribute
my $URI_val = $protocol->URI(); # getter
$protocol->URI($value); # setter

# 'name' attribute
my $name_val = $protocol->name(); # getter
$protocol->name($value); # setter

# 'identifier' attribute
my $identifier_val = $protocol->identifier(); # getter
$protocol->identifier($value); # setter

# 'text' attribute
my $text_val = $protocol->text(); # getter
$protocol->text($value); # setter

# 'title' attribute
my $title_val = $protocol->title(); # getter
$protocol->title($value); # setter

# 'parameterTypes' association
my $parameter_array_ref = $protocol->parameterTypes(); # getter
$protocol->parameterTypes(\@parameter_list); # setter

# 'auditTrail' association
my $audit_array_ref = $protocol->auditTrail(); # getter
$protocol->auditTrail(\@audit_list); # setter

# 'propertySets' association
my $namevaluetype_array_ref = $protocol->propertySets(); # getter
$protocol->propertySets(\@namevaluetype_list); # setter

# 'hardwares' association
my $hardware_array_ref = $protocol->hardwares(); # getter
$protocol->hardwares(\@hardware_list); # setter

# 'descriptions' association
my $description_array_ref = $protocol->descriptions(); # getter
$protocol->descriptions(\@description_list); # setter

# 'softwares' association
my $software_array_ref = $protocol->softwares(); # getter
$protocol->softwares(\@software_list); # setter

# 'security' association
my $security_ref = $protocol->security(); # getter
$protocol->security($security_ref); # setter

# 'type' association
my $ontologyentry_ref = $protocol->type(); # getter
$protocol->type($ontologyentry_ref); # setter

like. look at that. getter, setter, getter, setter β€” a little routine, a little choreography, we love a consistent queen πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

straight up lifted from the MAGE-OM documentation for the "Protocol" class, no cap:

A Protocol is a parameterizable description of a method. ProtocolApplication is used to specify the ParameterValues of it's Protocol's Parameters.

(read that twice if you need to, it's dense but it's the whole point of this class 🫢)


πŸŽ€ INHERITANCE πŸŽ€

Bio::MAGE::Protocol::Protocol has the following superclasses:

  • Bio::MAGE::Protocol::Parameterizable

so yeah, it's a <purple>Parameterizable</purple> at heart. it got those genes. iconic behavior.


πŸ‘‘ CLASS METHODS πŸ‘‘

these ones are special bestie β€” you can call all of them without ever making an instance first, using the Bio::MAGE::Protocol::Protocol->methodname() syntax. no object required, we're going straight to the class. main character energy fr fr.

new()

new(%args)

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

  • URI β€” sets the value of the "URI" attribute (this attribute was inherited from class "Bio::MAGE::Protocol::Parameterizable").
  • name β€” sets the value of the "name" attribute (this attribute was inherited from class "Bio::MAGE::Identifiable").
  • identifier β€” sets the value of the "identifier" attribute (this attribute was inherited from class "Bio::MAGE::Identifiable").
  • text β€” sets the value of the "text" attribute.
  • title β€” sets the value of the "title" attribute.
  • parameterTypes β€” sets the value of the "parameterTypes" association (this association was inherited from class "Bio::MAGE::Protocol::Parameterizable"). the value must be of type: array of "Bio::MAGE::Protocol::Parameter".
  • auditTrail β€” sets the value of the "auditTrail" association (this association was inherited from class "Bio::MAGE::Describable"). the value must be of type: array of "Bio::MAGE::AuditAndSecurity::Audit".
  • 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".
  • hardwares β€” sets the value of the "hardwares" association. the value must be of type: array of "Bio::MAGE::Protocol::Hardware".
  • softwares β€” sets the value of the "softwares" association. the value must be of type: array of "Bio::MAGE::Protocol::Software".
  • descriptions β€” sets the value of the "descriptions" association (this association was inherited from class "Bio::MAGE::Describable"). the value must be of type: array of "Bio::MAGE::Description::Description".
  • security β€” sets the value of the "security" association (this association was inherited from class "Bio::MAGE::Describable"). the value must be of type: instance of "Bio::MAGE::AuditAndSecurity::Security".
  • type β€” sets the value of the "type" association. the value must be of type: instance of "Bio::MAGE::Description::OntologyEntry".
ngl the order these show up in the arg list is not the same order as the SYNOPSIS constructor. not me noticing that πŸ™ˆ anyway, both are correct, just sayin'.

$obj = class->new(%parameters)

the "new()" method is the class constructor. the blueprint-maker. the origin story.

  • Parameters: if you hand it a list of name/value parameters, the corresponding slots, attributes, or associations will get their initial values set by the constructor.
  • Return value: it returns a reference to an object of the class. a whole baby object πŸ₯Ή
  • Side effects: it invokes the "initialize()" method if it's defined by the class.

@names = class->get_slot_names()

the "get_slot_names()" method is how you retrieve the name of all slots defined in a given class.

NOTE: the list of names does not include attribute or association names. just slots. don't @ me.
  • 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. that's it, that's the whole job ✨

@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 family tree, upward edition 🌈

@class_list = get_subclasses()

returns the list of subclasses for this class. the family tree, downward edition πŸ¦‹

$name = class_name()

returns the full class name for this class. full government name, no nicknames.

$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. you need an actual $protocol for these. let's go.

$obj_copy = $obj->new()

when you invoke it on an existing object reference instead of a class name, the "new()" method acts as a copy constructor β€” the new object's initial values get set to be those of the existing object. a little clone situation. twin where have you been 😭

  • 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's defined by the class.

$obj->set_slots(%parameters)

$obj->set_slots(\@name_list, \@value_list)

the "set_slots()" method is for setting a bunch of slots at the same time. it has two different invocation methods β€” the first one takes a named parameter list, and the second one 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 make up slot names bestie, it will yell at you.

@obj_list = $obj->get_slots(@name_list)

the "get_slots()" method is for getting the values of a bunch 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. two methods per attribute, because we believe in balance 🧚

"Bio::MAGE::Protocol::Protocol" has the following attribute accessor methods:

URI

Methods for the "URI" attribute.

from the MAGE-OM documentation:

Where an instantiated Parameterizable is located.

$val = $protocol->setURI($val)

the restricted setter method for the "URI" attribute.

  • Input parameters: the value to which the "URI" attribute will be set.
  • Return value: the current value of the "URI" attribute.
  • Side effects: none.
  • Exceptions: will call "croak()" if no input parameters are specified, or if too many input parameters are specified. zero args or too many args, both get a croak. no in-between 🫠

$val = $protocol->getURI()

the restricted getter method for the "URI" attribute.

  • Input parameters: none.
  • Return value: the current value of the "URI" attribute.
  • Side effects: none.
  • Exceptions: will call "croak()" if any input parameters are specified.

name

Methods for the "name" attribute.

from the MAGE-OM documentation:

The potentially ambiguous common identifier.

$val = $protocol->setName($val)

the restricted setter method for the "name" attribute.

  • Input parameters: the value to which the "name" attribute will be set.
  • Return value: the current value of the "name" attribute.
  • Side effects: none.
  • Exceptions: will call "croak()" if no input parameters are specified, or if too many input parameters are specified.

$val = $protocol->getName()

the restricted getter method for the "name" attribute.

  • Input parameters: none.

okay we're gonna pause it right here bestie, because this page is LONG and there's more coming πŸ’– don't go anywhere β€”

  • Return value: the current value of the name attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

identifier πŸŽ€

Methods for the identifier attribute.

From the MAGE-OM documentation:

An identifier is an unambiguous string that is unique within the scope (i.e. a document, a set of related documents, or a repository) of its use.
  • $val = $protocol->setIdentifier($val) β€” the restricted setter for the identifier attribute.
    • Input parameters: the value to which the identifier attribute will be set
    • Return value: the current value of the identifier attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified
  • $val = $protocol->getIdentifier() β€” the restricted getter for the identifier attribute.
    • Input parameters: none
    • Return value: the current value of the identifier attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

text πŸ¦‹

Methods for the text attribute.

From the MAGE-OM documentation:

The text description of the Protocol.
  • $val = $protocol->setText($val) β€” the restricted setter for the text attribute.
    • Input parameters: the value to which the text attribute will be set
    • Return value: the current value of the text attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified
  • $val = $protocol->getText() β€” the restricted getter for the text attribute.
    • Input parameters: none
    • Return value: the current value of the text attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

title πŸ‘‘

Methods for the title attribute.

From the MAGE-OM documentation:

The title of the Protocol
  • $val = $protocol->setTitle($val) β€” the restricted setter for the title attribute.
    • Input parameters: the value to which the title attribute will be set
    • Return value: the current value of the title attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified
  • $val = $protocol->getTitle() β€” the restricted getter for the title attribute.
    • Input parameters: none
    • Return value: the current value of the title attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

✨ ASSOCIATIONS ✨ πŸ”—

ok bestie, associations are just references to other classes β€” like your fave mutuals but in object form πŸ’…. And in MAGE-OM they come with a cardinality, which decides the minimum and maximum number of instances of the other class that can be part of 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::Protocol::Protocol has the following association accessor methods: πŸ‘‡

parameterTypes 🌈

Methods for the parameterTypes association.

From the MAGE-OM documentation:

The description of the parameters for the Parameterizable class instance.
  • $array_ref = $protocol->setParameterTypes($array_ref) β€” the restricted setter for the parameterTypes association.
    • Input parameters: the value to which the parameterTypes association will be set : a reference to an array of objects of type Bio::MAGE::Protocol::Parameter
    • Return value: the current value of the parameterTypes association : a reference to an array of objects of type Bio::MAGE::Protocol::Parameter
    • 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::Protocol::Parameter instances
  • $array_ref = $protocol->getParameterTypes() β€” the restricted getter for the parameterTypes association.
    • Input parameters: none
    • Return value: the current value of the parameterTypes association : a reference to an array of objects of type Bio::MAGE::Protocol::Parameter
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified
  • $val = $protocol->addParameterTypes(@vals) β€” because the parameterTypes association has list cardinality, it may store more than one value. This method adds the current list of objects in the parameterTypes association. πŸ’–
    • Input parameters: the list of values @vals to add to the parameterTypes 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::Protocol::Parameter

auditTrail πŸ•΅οΈβ€β™€οΈ

Methods for the auditTrail association.

From the MAGE-OM documentation:

A list of Audit instances that track changes to the instance of Describable.
  • $array_ref = $protocol->setAuditTrail($array_ref) β€” the restricted setter for the auditTrail association.
    • Input parameters: the value to which the auditTrail association will be set : a reference to an array of objects of type Bio::MAGE::AuditAndSecurity::Audit
    • Return value: the current value of the auditTrail association : a reference to an array of objects of type Bio::MAGE::AuditAndSecurity::Audit
    • 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::AuditAndSecurity::Audit instances
  • $array_ref = $protocol->getAuditTrail() β€” the restricted getter for the auditTrail association.
    • Input parameters: none
    • Return value: the current value of the auditTrail association : a reference to an array of objects of type Bio::MAGE::AuditAndSecurity::Audit
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified
  • $val = $protocol->addAuditTrail(@vals) β€” because the auditTrail association has list cardinality, it may store more than one value. This method adds the current list of objects in the auditTrail association. ✨
    • Input parameters: the list of values @vals to add to the auditTrail 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::AuditAndSecurity::Audit

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 = $protocol->setPropertySets($array_ref) β€” the restricted setter 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 = $protocol->getPropertySets() β€” the restricted getter 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 = $protocol->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. 🫢
    • 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

hardwares πŸ› οΈ

Methods for the hardwares association.

From the MAGE-OM documentation:

Hardware used by this protocol.
  • $array_ref = $protocol->setHardwares($array_ref) β€” the restricted setter for the hardwares association.
    • Input parameters: the value to which the hardwares association will be set : a reference to an array of objects of type Bio::MAGE::Protocol::Hardware
  • Return value: the current value of the hardwares association β€” aka a reference to an array of Bio::MAGE::Protocol::Hardware objects πŸ’–
    • Side effects: none, we behave ✨
    • Exceptions: it's gonna call croak() on you if you give it no input parameters at all, or if you give it too many input parameters, or if $array_ref is not a reference to an array of class Bio::MAGE::Protocol::Hardware instances. like bestie, it's picky and that's iconic πŸ’…
  • $array_ref = $protocol->getHardwares() β€” the restricted getter for the hardwares association.
    • Input parameters: none. not a single one. zero. nada πŸ™…
    • Return value: the current value of the hardwares association β€” a reference to an array of objects of type Bio::MAGE::Protocol::Hardware 🌸
    • Side effects: none πŸ¦‹
    • Exceptions: will call croak() if ANY input parameters are specified. yes, even one. don't test her 😭
  • $val = $protocol->addHardwares(@vals) β€” because the hardwares association has list cardinality, it can hold more than one value, and this method adds the current list of objects in the hardwares association. it's giving collection energy πŸ‘‘
    • Input parameters: the list of values @vals to add to the hardwares association. NOTE: submitting a single value is permitted β€” she's flexible like that 🫢
    • 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::Protocol::Hardware πŸ’€

πŸ¦‹ softwares

Methods for the softwares association.

From the MAGE-OM documentation:

Software used by this Protocol.
  • $array_ref = $protocol->setSoftwares($array_ref) β€” the restricted setter for the softwares association.
    • Input parameters: the value to which the softwares association will be set β€” a reference to an array of objects of type Bio::MAGE::Protocol::Software πŸŽ€
    • Return value: the current value of the softwares association β€” a reference to an array of objects of type Bio::MAGE::Protocol::Software ✨
    • 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 of class Bio::MAGE::Protocol::Software instances 😀
  • $array_ref = $protocol->getSoftwares() β€” the restricted getter for the softwares association.
    • Input parameters: none πŸ™ˆ
    • Return value: the current value of the softwares association β€” a reference to an array of objects of type Bio::MAGE::Protocol::Software πŸ’œ
    • Side effects: none πŸ¦‹
    • Exceptions: will call croak() if any input parameters are specified. any. at all. 😭
  • $val = $protocol->addSoftwares(@vals) β€” since the softwares association has list cardinality, it may store more than one value, and this method adds the current list of objects in the softwares association. stack 'em up bestie πŸ“š
    • Input parameters: the list of values @vals to add to the softwares 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::Protocol::Software πŸ’€

πŸ“ descriptions

Methods for the descriptions association.

From the MAGE-OM documentation:

Free hand text descriptions. Makes available the associations of Description to an instance of Describable.
  • $array_ref = $protocol->setDescriptions($array_ref) β€” the restricted setter for the descriptions association.
    • Input parameters: the value to which the descriptions association will be set β€” a reference to an array of objects of type Bio::MAGE::Description::Description 🌸
    • Return value: the current value of the descriptions association β€” a reference to an array of objects of type Bio::MAGE::Description::Description ✨
    • 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 of class Bio::MAGE::Description::Description instances 😀
  • $array_ref = $protocol->getDescriptions() β€” the restricted getter for the descriptions association.
    • Input parameters: none 🫢
    • Return value: the current value of the descriptions association β€” a reference to an array of objects of type Bio::MAGE::Description::Description πŸ’œ
    • Side effects: none 🌈
    • Exceptions: will call croak() if any input parameters are specified πŸ™…
  • $val = $protocol->addDescriptions(@vals) β€” the descriptions association has list cardinality, so it may store more than one value, and this method adds the current list of objects in the descriptions association. tell her everything πŸ’¬
    • Input parameters: the list of values @vals to add to the descriptions 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::Description::Description πŸ’€

πŸ‘‘ security

Methods for the security association.

From the MAGE-OM documentation:

Information on the security for the instance of the class.
  • $val = $protocol->setSecurity($val) β€” the restricted setter for the security association. main character locked down πŸ”
    • Input parameters: the value to which the security association will be set β€” one of the accepted enumerated values 🌟
    • Return value: the current value of the security association β€” one of the accepted enumerated values 🌟
    • Side effects: none πŸ¦‹
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified, or if $val is not an instance of class Bio::MAGE::AuditAndSecurity::Security 😭
  • $val = $protocol->getSecurity() β€” the restricted getter for the security association.
    • Input parameters: none πŸ™ˆ
    • Return value: the current value of the security association β€” an instance of type Bio::MAGE::AuditAndSecurity::Security πŸ’œ
    • Side effects: none ✨
    • Exceptions: will call croak() if any input parameters are specified πŸ’…

🧚 type

Methods for the type association.

From the MAGE-OM documentation:

The type of a Protocol, a user should provide/use a recommended vocabulary. Examples of types include: RNA extraction, array washing, etc...
  • $val = $protocol->setType($val) β€” the restricted setter for the type association.
    • Input parameters: the value to which the type association will be set β€” one of the accepted enumerated values 🌟
    • Return value: the current value of the type association β€” one of the accepted enumerated values 🌟
    • Side effects: none 🌈
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified, or if $val is not an instance of class Bio::MAGE::Description::OntologyEntry πŸ’€
  • $val = $protocol->getType() β€” the restricted getter for the type association.
    • Input parameters: none 🫢
    • Return value: the current value of the type association β€” an instance of type Bio::MAGE::Description::OntologyEntry πŸ’–
    • Side effects: none ✨
    • Exceptions: will call croak() if any input parameters are specified 😀

and then there's this lil guy, just vibing at the end, doing the absolute least and doing it flawlessly:

sub initialize {

  my $self = shift;
  return 1;

}

she literally just returns 1. no thoughts, head empty, slaying anyway πŸ’…βœ¨

✨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS ✨

okay bestie, so in the Perl implementation of MAGE-OM classes there are literally three types of class data members and you need to know all of them: slots, attributes, and associations. let's break it down πŸ’…

🌸 SLOTS 🌸

so this API uses the term "slot" to mean a data member of the class that was not present in the UML model β€” it's mostly for internal purposes. so like, use only if you understand the inner workings of the API, fr fr. most often slots get used by generic methods, like the ones in the XML writing and reading classes. iykyk 🫢

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_var in the slot, and the return value is also $new_var (cute, right?)
  • @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. none. zero. nada. so like, be careful bestie 😭

πŸ¦‹ 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 are the real ones πŸ’–

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 pass anything, okay? πŸ™ˆ
  • 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 (just saying πŸ’…). 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. so like, get the type right or it's not gonna go well bestie 😭
  • add* β€”
NOTE: only present in associations with list cardinality. if it's not there, that's why.

appends a list of objects to any values that may already be stored in the association. it's giving "adding to the collection" energy ✨

DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class. every single one. no exceptions πŸ‘‘

πŸ’œ 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. it's giving main character energy fr:

$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 πŸ‘€ (they're in the earlier part, bestie, go look)


πŸ’€ BUGS πŸ’€

please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net) β€” like, actually send them, we wanna know πŸ™


πŸ‘‘ AUTHOR πŸ‘‘

Jason E. Stewart (jasons 'at' cpan 'dot' org) β€” iconic behavior honestly πŸŽ€


🌈 SEE ALSO 🌈


🫢 POD ERRORS 🫢

hey! the above document had some coding errors, which are explained below:

  • around line 456: '=item' outside of any '=over'
  • around line 541: you forgot a '=back' before a '=head2'
  • around line 929: expected '=item 2'
  • around line 934: expected '=item 3'
  • around line 939: expected '=item 4'
not the POD errors 😭 the docs are still serving though, periodt.

and that's the whole page bestie!! this one came from perl v5.32.0 and it was dated 2020-11-27 β€” yes, that's the version and the date, right there at the bottom of the original. slay πŸ’–βœ¨ go forth and write some MAGE-OM classes, you got this πŸ¦‹πŸŒΈ