|
On 12/13/2010 04:06 PM, Andreas Draeger wrote:
> Hi Nico,
>
> I am very happy if you like to invest more time and elaborate the Terms
> and Triples more intensively. It would be nice if you could keep these
> replace methods to make our Terms get rid of all these backslashes and
> special characters. Did I get all of these or are there other symbols to
> be replaced?
>
> I'm open for anything else.
>
>> At first, I wanted to make our Triple class extends our Term class but
>> if we remove the Triple from the list of terms, we don't need it anymore.
> Ok.
>
>> And we could add some more utilities methods.
>> A getChildren in the jsbml.SBO.Term class to allow a top-down
>> navigation, the getParent allowing already to go up the tree.
> Good idea.
>
>> A getSBORoot in the jsbml.SBO class that would return the root of the
>> ontology (SBO:0000000) and allow with the getChildren to build the
>> ontology tree.
>>
>> What do you think ?
> Yes, sounds nice. Can we benefit from the BioJava implementation? I
> wouldn't like to use to much additional memory etc.
Of course, I only propose small changes to your code :-)
>>> --- src/org/sbml/jsbml/SBO.java (revision 479)
>>> +++ src/org/sbml/jsbml/SBO.java (working copy)
>>> @@ -89,12 +88,9 @@
>>> if (term == null) {
>>> throw new NullPointerException("Term
>>> must not be null.");
> NullPointerException is necessary, I think.
Yes, yes, it was not removed, only line starting with '-' or '+' are
removed or added, the rest is the context.
>>> }
>>> - if (term instanceof org.biojava.ontology.Triple) {
>>> - org.biojava.ontology.Triple triple =
>>> (org.biojava.ontology.Triple) term;
>>> - this.term = triple.getSubject();
>>> - } else {
>>> - this.term = term;
>>> - }
>>> +
>>> + this.term = term;
>>> +
>>> id = name = def = null;
>>> }
>>>
>> We should directly create a SBO.Triple object instead of hiding it in
>> the SBO.Term class and as I proposed
>> earlier, if we remove all together the Triple from the list of terms, we
>> don't need this anyway.
> If you have a good idea I am curious to see it.
My first idea was to have Triple extends Term, like in biojava and
create directly the Triple when creating the list of terms.
But if we hide completely the Triple, I think it is better.
>>> @@ -141,7 +137,7 @@
>>> */
>>> public String getId() {
>>> if (id == null) {
>>> - id = this.term.toString().split(" ")[0];
>>> + id = term.getName();
>>> }
>>> return id;
>>> }
>> When we have only biojava.Term, no need to split the toString or
>> getName, the getName is always what we want.
> Yes, that's true. Here it looks like doubling the effort.
>
>> And in case we want to use the getId with biojava.Triple object, we
>> should not split the name either as we want to distinguish them
>> from the real Term.
>>
>>> @@ -1013,7 +1015,12 @@
>>> public static Set<Term> getTerms() {
>>> if (terms.size()< sbo.getTerms().size()) {
>>> for (org.biojava.ontology.Term term :
>>> sbo.getTerms()) {
>>> - terms.add(new Term(term));
>>> +
>>> + if (term instanceof
>>> org.biojava.ontology.Triple) {
>>> + // does nothing
>>> + } else if (term instanceof
>>> org.biojava.ontology.Term) {
>>> + terms.add(new Term(term));
>>> + }
>> Here, when we encounter a Triple, we are not adding it to the Set of
>> SBO.Term.
> Yes, please let me know about better ideas/implementation. I won't
> change anything in this class in the next time and will just monitor
> what you do.
>
ok, will do the changes and commit.
Nico
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|