| GOBO documentation | Contained in the GOBO distribution. |
GOBO::Labeled
A role for any kind of entity that can have a human-readable label attached: both primary label and alternate labels (GOBO::Synonym)
For genes the primary label is a symbol. For GOBO::TermNode objects (units in an ontology) it is the class name
Is this over-abstraction? This could be simply mixed in with Node
| GOBO documentation | Contained in the GOBO distribution. |
package GOBO::Labeled; use Moose::Role; use GOBO::Synonym; has label => (is => 'rw', isa => 'Str'); # TODO -- delegate to primary synonym? has description => (is => 'rw', isa => 'Str'); has synonyms => ( is=>'rw', isa=>'ArrayRef[GOBO::Synonym]'); sub add_synonyms { my $self = shift; if (!$self->synonyms) { $self->synonyms([]); } push(@{$self->synonyms}, map { ref($_) ? $_ : new GOBO::Synonym(label=>$_) } @_); return; } sub add_synonym { my $self = shift; $self->add_synonyms(@_); } 1;