A list for the developers of CellML tools

Text archives Help


[cellml-dev] Java CVTerm implementation


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] Java CVTerm implementation
  • Date: Thu, 15 Apr 2010 11:04:55 +1200

Morgan Taschuk wrote:
> Hi Andrew,
>
>> I found the problem - it was just a missing .class file that the
>> automatically generated wrapped code assumed was present (it wasn't
>> being added to the .jar due to an out of date build script). Now that
>> I have fixed this, the tests pass.
>
> Great, thanks. The unit tests work, and that new method to query
> existing annotation is exactly what we needed.
>
> I've added a few more tests, but unfortunately there seems to be a
> problem with appending children to the Container.
>
> java.lang.RuntimeException: Native code threw exception
> at pjm2pcm.rdf_api.Container.appendChild(Native Method)
> at cellml_api.CVTerm.addResource(CVTerm.java:229)
> at cellml_api.CVTermTest.addResource_test(CVTermTest.java:47)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ...


Hi Morgan,

This turned out to be because containers have to be used with the same
datasource, but I was refreshing the datasource and not refetching the
container.

I have now fixed this (new CVTerm.java attached).

>
> Using changeset 921:2e4662b7db8c. The updated tests are at
> http://dl.dropbox.com/u/4048178/CVTermTest.zip .
>
> Also, the method getResourceURIs used to return a String[], but at
> runtime it complained that it was an Object[], not a String[]. I've
> changed the method so that it returns an Object[], but you may refactor
> at will. :)


I changed it back, with the following toArray call:
String[] ex = {};
return uris.toArray(ex);
This seems to work with the tests.

Also, I fixed one of your tests which was not testing the correct thing;
it applies to a few of them, but removeResource was the only one where
they failed. Checking the length of getCVTerms(model) is not sufficient
- there can be empty CVTerms (this means the bag exists but it has no
contents), so I instead changed the tests to test for the size of the
first bag. For example, removeResource does not cause the bag to be
deleted, only the contents of the bag to be removed.

Best wishes,
Andrew

>
> Thanks for your help with this.
>
> Cheers,
> Morgan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CVTermTest.java
Type: text/x-java
Size: 2134 bytes
Desc: not available
URL:
<http://www.cellml.org/pipermail/cellml-tools-developers/attachments/20100415/2cf0174f/attachment.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CVTerm.java
Type: text/x-java
Size: 13168 bytes
Desc: not available
URL:
<http://www.cellml.org/pipermail/cellml-tools-developers/attachments/20100415/2cf0174f/attachment-0001.java>




Archive powered by MHonArc 2.6.18.

Top of page