[Bioperl-l] Bio::Ontology
Hilmar Lapp
hlapp@gnf.org
Sun, 22 Sep 2002 14:52:09 -0700
On Sunday, September 22, 2002, at 09:06 AM, Ewan Birney wrote:
> On Sat, 21 Sep 2002, Hilmar Lapp wrote:
>
<snip>
>> 2) Inheritance. My vote goes for largely if not completely
>> decoupling Ontologies and Graphs, disregarding that of course in
>> many practical cases you will want to execute graph-operations on
>> ontologies. I think this can be easily and more flexibly achieved by
>> composition rather than inheritance, which would mandate it. Hence,
>> my vote is TermI should not inherit from Graph::NodeI or any similar
>> interface.
>
> Which way around does the composition go - Terms have-a Node or Nodes
> have-a Term (or both, but then we have memory cycles?)
>
Terms possibly have-a Node. The question is whether you want to have
a node() method on the interface (which would return $self for
implementations that use inheritance).
> It the consequence of this that to do any graph operation from a
> Term you
> need to have the graph object passed in?
No, but good point, see the each_relationship() discussion. With
composition exposed on the interface, you know that for any TermI
object you'd be able to say, e.g., $term->node()->get_parent_nodes().
I don't like this that much however, because it still assumes too
much, namely that there is a Node object. Some Graph implementations
may not have this (e.g., the one on CPAN doesn't).
So what I favor presently is an abstract OntologyEngineI, the
definition of which would include the minimal set of operations that
you would usually want to do on ontologies or its constituents.
I.e., it would resemble the Strategy pattern, and everyone who feels
up to it can implement that and underpin an ontology with it.
I guess OntologyEngineI would come close to ChrisM's VocabI or
StructuredVocabI -- possibly with some methods removed for
simplicity.
To come back to your question, yes, then you would have to have the
engine implementation in hand, or, what I prefer, have a get/set
method ontology_engine() on the TermI interface.
<snip>
>>
>> RelationshipI makes a lot of sense to me, except that I think it
>> should not inherit from Graph::ArcI, and I'm also not sure why
>> Relationships shall have stable identifiers.
>>
>
> I'd love you hear Chris' response to this one...
>
As far as I've seen relationships in GO don't have identifiers ...
that's why I thought you can well live without. I may be mistaken
though.
-hilmar
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------