The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

OBO::Core::Relationship - A relationship between two terms or two relationships within an ontology.

SYNOPSIS

use OBO::Core::Relationship; use OBO::Core::Term; use strict;

# three new relationships my $r1 = OBO::Core::Relationship->new(); my $r2 = OBO::Core::Relationship->new(); my $r3 = OBO::Core::Relationship->new();

$r1->id("CCO:P0000001_is_a_CCO:P0000002"); $r2->id("CCO:P0000002_part_of_CCO:P0000003"); $r3->id("CCO:P0000001_has_child_CCO:P0000003");

$r1->type("is_a"); $r2->type("part_of"); $r3->type("has_child");

!$r1->equals($r2); !$r2->equals($r3); !$r3->equals($r1);

# three new terms my $n1 = OBO::Core::Term->new(); my $n2 = OBO::Core::Term->new(); my $n3 = OBO::Core::Term->new();

$n1->id("CCO:P0000001"); $n2->id("CCO:P0000002"); $n3->id("CCO:P0000003");

$n1->name("One"); $n2->name("Two"); $n3->name("Three");

# r1(n1, n2) $r1->head($n2); $r1->tail($n1);

# r2(n2, n3) $r2->head($n3); $r2->tail($n2);

# r3(n1, n3) $r3->head($n3); $r3->tail($n1);

# three new relationships my $r4 = OBO::Core::Relationship->new(); my $r5 = OBO::Core::Relationship->new(); my $r6 = OBO::Core::Relationship->new();

$r4->id("CCO:R0000004"); $r5->id("CCO:R0000005"); $r6->id("CCO:R0000006");

$r4->type("r4"); $r5->type("r5"); $r6->type("r6");

$r4->link($n1, $n2); $r5->link($n2, $n3); $r6->link($n1, $n3);

DESCRIPTION

A Relationship between two terms (OBO::Core::Term) in the ontology (OBO::Core::Ontology).

A relationships must have a unique ID (e.g. "CCO:P0000028_is_a_CCO:P0000005"), a type (e.g. "is_a") and it must known the linking terms (tail and head).

AUTHOR

Erick Antezana, <erick.antezana -@- gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2006, 2007, 2008, 2009, 2010 by Erick Antezana

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

id

  Usage    - print $relationship->id() or $relationship->id($id)
  Returns  - the relationship ID (string)
  Args     - the relationship ID (string)
  Function - gets/sets an ID
  

type

  Usage    - $relationship->type("is_a") or print $relationship->type()
  Returns  - the type of the relationship (string)
  Args     - the type of the relationship (string)
  Function - gets/sets the type of the relationship
  

equals

  Usage    - print $relationship->equals($another_relationship)
  Returns  - either 1 (true) or 0 (false)
  Args     - the relationship (OBO::Core::Relationship) to compare with
  Function - tells whether this relationship is equal to the parameter
  
  Usage    - $relationship->head($object) or $relationship->head()
  Returns  - the OBO::Core::Term (object or target) or OBO::Core::RelationshipType (object or target) targeted by this relationship
  Args     - the target term (OBO::Core::Term) or the target relationship type (OBO::Core::RelationshipType)
  Function - gets/sets the term/relationship type attached to the head of the relationship
  

tail

  Usage    - $relationship->tail($subject) or $relationship->tail()
  Returns  - the OBO::Core::Term (subject or source) or OBO::Core::RelationshipType (object or target) sourced by this relationship
  Args     - the source term (OBO::Core::Term) or the source relationship type (OBO::Core::RelationshipType)
  Function - gets/sets the term/relationship type attached to the tail of the relationship
  
  Usage    - $relationship->link($tail, $head) or $relationship->link()
  Returns  - the two Terms or two RelationshipTypes (subject and source) connected by this relationship
  Args     - the source(tail, OBO::Core::Term/OBO::Core::RelationshipType) and target(head, OBO::Core::Term/OBO::Core::RelationshipType) term/relationship type
  Function - gets/sets the terms/relationship type attached to this relationship