MAGE::...eValue(3pm)
π Bio::MAGE::HigherLevelAnalysis::NodeValue β from the MAGE-OM API π
okay bestie, welcome to the perl docs for Bio::MAGE::HigherLevelAnalysis::NodeValue, which lives in the User Contributed Perl Documentation section of the manual (section 3pm). she's a whole class, she's part of the MAGE-OM API, and we're gonna get into it. grab a snack π
β¨ NAME β¨
Bio::MAGE::HigherLevelAnalysis::NodeValue β a whole class for the MAGE-OM API. no cap, that's literally what she is.
πΈ SYNOPSIS πΈ
here's the vibe in code form, bestie:
use Bio::MAGE::HigherLevelAnalysis::NodeValue
# creating an empty instance
my $nodevalue = Bio::MAGE::HigherLevelAnalysis::NodeValue->new();
# creating an instance with existing data
my $nodevalue = Bio::MAGE::HigherLevelAnalysis::NodeValue->new(
value=>$value_val,
name=>$name_val,
dataType=>$ontologyentry_ref,
scale=>$ontologyentry_ref,
type=>$ontologyentry_ref,
propertySets=>\@namevaluetype_list,
);
# 'value' attribute
my $value_val = $nodevalue->value(); # getter
$nodevalue->value($value); # setter
# 'name' attribute
my $name_val = $nodevalue->name(); # getter
$nodevalue->name($value); # setter
# 'dataType' association
my $ontologyentry_ref = $nodevalue->dataType(); # getter
$nodevalue->dataType($ontologyentry_ref); # setter
# 'scale' association
my $ontologyentry_ref = $nodevalue->scale(); # getter
$nodevalue->scale($ontologyentry_ref); # setter
# 'type' association
my $ontologyentry_ref = $nodevalue->type(); # getter
$nodevalue->type($ontologyentry_ref); # setter
# 'propertySets' association
my $namevaluetype_array_ref = $nodevalue->propertySets(); # getter
$nodevalue->propertySets(\@namevaluetype_list); # setter
look at her go. getters AND setters? we love a versatile queen. π
π DESCRIPTION π
straight from the MAGE-OM documentation for the NodeValue class, and I'm quoting her exactly:
A value associated with the Node that can rank it in relation to the other nodes produced by the clustering algorithm.
so basically she holds a value that lets a Node get ranked against all the other nodes that came out of the clustering algorithm. it's giving ranking energy. it's giving "who's the main character Node" energy. π
π¦ INHERITANCE π¦
Bio::MAGE::HigherLevelAnalysis::NodeValue has exactly one superclass, and it's:
Bio::MAGE::Extendable
that's it, that's the whole family tree she's inheriting from. iconic lineage honestly. β¨
π CLASS METHODS π
okay so here's the tea: all of these methods can be called without having an instance of the class first. you just hit her with the:
Bio::MAGE::HigherLevelAnalysis::NodeValue->methodname()
syntax. class methods, no instance needed, she doesn't gatekeep. π
π§ new()
π§ new(%args)
the object constructor new() takes these optional named-value style arguments, bestie:
valueβ sets the value of thevalueattributenameβ sets the value of thenameattributedataTypeβ sets the value of thedataTypeassociation
the value must be of type: an instance of Bio::MAGE::Description::OntologyEntry.
scaleβ sets the value of thescaleassociation
the value must be of type: an instance of Bio::MAGE::Description::OntologyEntry.
propertySetsβ sets the value of thepropertySetsassociation (and psst, this association was inherited from classBio::MAGE::Extendable, so thank her ancestors for this one)
the value must be of type: an array of Bio::MAGE::NameValueType.
typeβ sets the value of thetypeassociation
the value must be of type: an instance of Bio::MAGE::Description::OntologyEntry.
π $obj = class->new(%parameters)
the new() method is the class constructor. the whole origin story.
Parameters: if you give her a list of name/value parameters, the corresponding slots, attributes, or associations will have their initial values set by the constructor. she's setting you up on arrival fr fr.
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 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 so you know, bestie. π
Return value: a list of the names of all slots defined for this class.
Side effects: none. she's chill like that.
π @name_list = get_attribute_names()
returns the list of attribute data members for this class. that's it, that's the whole thing. β¨
π @name_list = get_association_names()
returns the list of association data members for this class. also that simple. π
π @class_list = get_superclasses()
returns the list of superclasses for this class. (remember, she's got exactly one, and it's Bio::MAGE::Extendable β go say hi to her.)
π @class_list = get_subclasses()
returns the list of subclasses for this class.
πΈ $name = class_name()
returns the full class name for this class. like, the whole entire thing, namespace and all.
πΈ $package_name = package_name()
returns the base package name (i.e. no 'namespace::' in it) 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. meta-information about meta-information? we love layers. π
π INSTANCE METHODS π
okay bestie, this is the part where the object actually does stuff. every method here is called on an actual instance, so you need a $nodevalue (or whatever class) already living in a variable. let's go one by one, no skipping, i promise π«Ά
$obj_copy = $obj->new()
so when you call new() on an existing object reference instead of on a class name, it flips into copy constructor mode β the brand new object starts out with initial values that are literally the ones from the existing object. it's giving "twin but make it fresh" π―
- Parameters: none, bestie. no input parameters are used in the copy constructor, because 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's defined by the class.
$obj->set_slots(%parameters) $obj->set_slots(\@name_list, \@value_list)
set_slots() is the "set a whole bunch of slots at once" girlie. she has two different invocation methods:
- the first one takes a named parameter list, i.e.
%parameters - the second one takes two array references, i.e.
\@name_listand\@value_list
- Return value: none πΆ
- Side effects: will call
croak()if a slot_name is used that the class does not define.
like, if you make up a slot that doesn't exist? she WILL yell at you. croak() says hi. π
@obj_list = $obj->get_slots(@name_list)
get_slots() grabs the values of a bunch of slots all at the same time. one call, many slots, maximum efficiency, we love a multitasker β¨
- Return value: a list of instance objects
- Side effects: none
$val = $obj->set_slot($name,$val)
set_slot() sets the slot $name to the value $val. simple, clean, iconic π
- Return value: the new value of the slot, i.e.
$val - Side effects: none
$val = $obj->get_slot($name)
get_slot() is used to get the values of a number of slots at the same time. (yes, that's exactly what the docs say about the single slot getter, and no, we are not arguing with the docs today π)
- 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 one 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 β so like, one setter, one getter, per attribute. no shared anything, she's exclusive π
Bio::MAGE::HigherLevelAnalysis::NodeValue has the following attribute accessor methods:
value
methods for the value attribute.
from the MAGE-OM documentation:
The value for this NodeValue.
$val = $nodevalue->setValue($val)
the restricted setter method for the value attribute.
- Input parameters: the value to which the
valueattribute will be set - Return value: the current value of the
valueattribute - Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if too many input parameters are specified
$val = $nodevalue->getValue()
the restricted getter method for the value attribute.
- Input parameters: none
- Return value: the current value of the
valueattribute - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
"restricted" means she takes exactly the right amount of arguments and nothing else. extra args?croak(). zero args where one is needed? alsocroak(). she's strict but she's fair π
name
methods for the name attribute.
from the MAGE-OM documentation:
The name for this value.
$val = $nodevalue->setName($val)
the restricted setter method for the name attribute.
- Input parameters: the value to which the
nameattribute will be set - Return value: the current value of the
nameattribute - Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if too many input parameters are specified
$val = $nodevalue->getName()
the restricted getter method for the name attribute.
- Input parameters: none
- Return value: the current value of the
nameattribute - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
π¦ ASSOCIATIONS π¦
associations are references to other classes. and because MAGE-OM is dramatic, associations have a cardinality that determines the minimum and maximum number of instances of the 'other' class that may be included in the association. here's the whole rundown, no cuts:
- exactly one β 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::HigherLevelAnalysis::NodeValue has the following association accessor methods:
dataType
methods for the dataType association.
from the MAGE-OM documentation:
The data type of the any element.
$val = $nodevalue->setDataType($val)
the restricted setter method for the dataType association.
- Input parameters: the value to which the
dataTypeassociation will be set : one of the accepted enumerated values. - Return value: the current value of the
dataTypeassociation : 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$valis not an instance of classBio::MAGE::Description::OntologyEntry
$val = $nodevalue->getDataType()
the restricted getter method for the dataType association.
- Input parameters: none
- Return value: the current value of the
dataTypeassociation : an instance of typeBio::MAGE::Description::OntologyEntry. - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
scale
methods for the scale association.
from the MAGE-OM documentation:
The scale (linear, log10, ln, etc.) of the value.
$val = $nodevalue->setScale($val)
the restricted setter method for the scale association.
- Input parameters: the value to which the
scaleassociation will be set : one of the accepted enumerated values. - Return value: the current value of the
scaleassociation : 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$valis not an instance of classBio::MAGE::Description::OntologyEntry
$val = $nodevalue->getScale()
the restricted getter method for the scale association.
- Input parameters: none
- Return value: the current value of the
scaleassociation : an instance of typeBio::MAGE::Description::OntologyEntry. - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
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 = $nodevalue->setPropertySets($array_ref)
the restricted setter method for the propertySets association.
- 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 = $nodevalue->getPropertySets()
the restricted getter method for the propertySets association.
- 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 = $nodevalue->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
@valsto add to thepropertySetsassociation. 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
note the NOTE up there bestie β one single value is permitted, she's flexible like that π«Ά
type
methods for the type association.
from the MAGE-OM documentation:
The type of value, distance, etc.
$val = $nodevalue->setType($val)
the restricted setter method for the type association.
- Input parameters: the value to which the
typeassociation will be set : one of the accepted enumerated values. - Return value: the current value of the
typeassociation : 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$valis not an instance of classBio::MAGE::Description::OntologyEntry
$val = $nodevalue->getType()
the restricted getter method for the type association.
- Input parameters: none
- Return value: the current value of the
typeassociation : an instance of typeBio::MAGE::Description::OntologyEntry. - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
and then the page just. ends with this lil guy, exactly as written:
sub initialize {
my $self = shift;
return 1;
}
main character energy honestly π
πΈ SLOTS, ATTRIBUTES, AND ASSOCIATIONS πΈ
ok so in the Perl version of MAGE-OM classes, there are literally three flavours of class data members and you need to know which is which: slots, attributes, and associations. bestie, they are NOT the same thing, do not mix them up π
β¨ SLOTS β¨
So this API uses the word "slot" for a class data member that wasn't in the UML model at all. They're mostly there for internal stuff β so like, only touch them if you genuinely understand the inner workings of the API, okay? π«Ά
Most of the time, slots get used by generic methods β think the ones hanging out in the XML writing and reading classes. they're the backstage crew of this whole operation ngl.
Slots are implemented with unified getter/setter methods, so it's one method doing both jobs:
$var = $obj->slot_name();β grabs the current value of the slot, that's it, that's the whole vibe.$new_var = $obj->slot_name($new_var);β stores$new_varin the slot, and the return value is also$new_var(yes, it gives you back what you gave it, iconic behaviour honestly).@names = $obj->get_slot_names()β hands you the list of every slot in the class. all of them. the full roster π
DATA CHECKING: nope. zero. none. No data type checking is made for these methods. it will not catch you. be your own adult π
π¦ ATTRIBUTES AND ASSOCIATIONS π¦
The words "attribute" and "association" are for data members that were specified directly from the UML model. so these are the official ones, the ones on the mood board.
In the Perl implementation of MAGE-OM classes, association and attribute accessors get implemented using three separate methods:
get*β retrieves the current value.- NOTE: for associations, if the association has list cardinality, you get back an array reference. not the array. the reference. iykyk.
- DATA CHECKING: ensures that no argument is provided. give it an argument and it will simply not be having it π
set*β sets the current value, replacing whatever was there before. out with the old, in with the new, no sentimental attachments.- NOTE: for associations, if the association has list cardinality, the argument must be an array reference. and because of that whole situation, you probably should be using the
add*methods instead. like, genuinely,add*is the main character here π - DATA CHECKING: for attributes, it ensures a single value is provided as the argument. for associations, if the association has list cardinality, it ensures the argument is a reference to an array of instances of the correct MAGE-OM class; otherwise it ensures there's a single argument of the correct MAGE-OM class. so yes, it is checking. respectfully.
- NOTE: for associations, if the association has list cardinality, the argument must be an array reference. and because of that whole situation, you probably should be using the
add*β NOTE: only present in associations with list cardinality. if you don't have list cardinality, this method simply does not exist for you, sorry bestie π- Appends a list of objects to any values that may already be stored in the association. it doesn't wipe what's there β it adds on top. growth mindset fr fr π±
- DATA CHECKING: ensures that all arguments are of the correct MAGE-OM class.
π GENERIC METHODS π
The unified base class of all MAGE-OM classes is Bio::MAGE::Base, and it provides a whole little set of generic methods that will operate on slots, attributes, and associations. equal opportunity methods, we love to see it:
$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 covered up in the instance methods zone, go look, it's worth it).
π 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 snitching on the docs but the docs snitched on themselves π:
- Around line 374:
'=item' outside of any '=over'
- Around line 459:
- You forgot a
'=back'before a'=head2'
- You forgot a
- Around line 631:
- Expected
'=item 2'
- Expected
- Around line 636:
- Expected
'=item 3'
- Expected
- Around line 641:
- Expected
'=item 4'
- Expected
and that's the whole page, bestie!! this was documented by perl v5.32.0 and dated 2020-11-27, so if you're reading this from the future β hi, hope the APIs still slay π β¨ go write some MAGE-OM code, you've got this π¦π
π¦ 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