GOBO::Labeled - GOBO::Labeled documentation


GOBO documentation Contained in the GOBO distribution.

Index


Code Index:

NAME

Top

GOBO::Labeled

SYNOPSIS

Top

DESCRIPTION

Top

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

TBD

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;