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

NAME

GOBO::Graph

SYNOPSIS

DESCRIPTION

A collection of inter-related GOBO::Node objects. With a simple ontology these are typically GOBO::TermNode objects, although other graphs e.g. instance graphs are possible.

This module deliberately omits any kind of graph traversal functionality. This is done by an GOBO::InferenceEngine.

DETAILS

A GOBO::Graph consists of two collections: a node collection and a link collection. Both types of collection are handled behind the scenes using indexes (in future these can be transparently mapped to databases).

A graph keeps a reference of all nodes declared or referenced. We draw a distinction here: a graph can reference a node that is not declared in that graph. For example, consider an obo file with two stanzas:

 id: x
 is_a: y

 id: y
 is_a: z

Here there are only two nodes declared (x and y) but there are a total of three references.

The noderef method can be used to access the full list of nodes that are either declared or referenced. This is useful to avoid instantiating multiple copies of the same object.

Methods such as terms, relations and instances return only those nodes declared to be in the graph

SEE ALSO

GOBO::Node

GOBO::LinkStatement

declared_subsets

 - returns ArrayRef[GOBO::Subset]

returns the subsets declared in this graph.

See also: GOBO::TermNode->subsets() - this returns the subsets a term belongs to

terms

 - Returns: ArrayRef[GOBO::TermNode], where each member is a term belonging to this graph

get_term

 - Argument: id Str
 - Returns: GOBO::TermNode, if term is declared in this graph

get_relation

 - Argument: id Str
 - Returns: GOBO::RelationNode, if relation is declared in this graph

get_instance

 - Argument: id Str
 - Returns: GOBO::InstanceNode, if instance is declared in this graph

relations

 - Returns: ArrayRef[GOBO::RelationNode], where each member is a relation belonging to this graph

instances

 - Returns: ArrayRef[GOBO::InstanceNode], where each member is an instance belonging to this graph

add_term

 - Arguments: Str or GOBO::Node
 - Returns: GOBO::TermNode
 - Side effects: adds the object to the list of terms referenced in this graph. Forces the class to be GOBO::TermNode

add_relation

 - Arguments: Str or GOBO::Node
 - Returns: GOBO::RelationNode
 - Side effects: adds the object to the list of relations referenced in this graph. Forces the class to be GOBO::RelationNode

add_instance

 - Arguments: Str or GOBO::Node
 - Returns: GOBO::InstanceNode

adds the object to the list of instances referenced in this graph. Forces the class to be GOBO::InstanceNode

remove_node

 - Arguments: node GOBO::Node, cascade Bool[OPT]

unlinks the node from this graph

If cascade is 0 or undef, any links to or from this node will remain as dangling links.

If cascade is set, then links to and from this node will also be deleted

given a subject (child), get target (parent) links

if relation is specified, also filters results on relation

given a subject (child), get target (parent) links

if relation is specified, also filters results on relation

get_is_a_roots

 - Argument: none
 - Returns: ArrayRef[GOBO::TermNode]

returns terms that lack an is_a parent

get_roots

 - Argument: relation Str or OBO::RelationNode [OPTIONAL]
 - Returns: ArrayRef[GOBO::TermNode]

returns terms that lack a parent by the given relation. If no relation specified, then returns terms that lack a parent by any relation