[BioLib-dev] GSoC: Mapping JAVA libraries to Perl/Ruby/Python using Biolib+SWIG+JNI
Pjotr Prins
pjotr.public14 at thebird.nl
Wed Mar 31 18:13:39 UTC 2010
Hi Luiz,
On Tue, Mar 30, 2010 at 06:13:02PM -0300, Luiz Irber wrote:
> On Tue, Mar 30, 2010 at 3:07 PM, Pjotr Prins <pjotr.public14 at thebird.nl> wrote:
> > For Biolib we are really interested in making JAVA available to SWIG
> > over JNI. Any JAVA/Scala/Jython bioinformatics library could act as a
> > proof of concept. As far as I am concerned you can bring up something
> > completely different, as long as it covers some real JAVA-like
> > functionality that would map SWIG through the JNI.
>
> I think I found a good alternative:
>
> http://www.loci.wisc.edu/bio-formats
>
> They already have some solutions to interface non-Java code:
>
> http://www.loci.wisc.edu/bio-formats/interfacing-non-java-code
Cool. Is there a language you would prefer to map to - Perl, Python,
Ruby? A clear choice will allow us to get the relevant Bio* project
interested in some functionality from JAVA.
> And a C++ binding using Jace:
>
> https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/native/bf-cpp/
>
> If they already have bindings working, what's the point? Why don't
> just pick the C++ bindings and use them to expose methods to other
> languages? Because Jace seems to be unmaintained (last release in
> 2008), and it's not always a easy thing to map C++ to other languages
> (at least in my experience).
Yes. Correct. The C++ needs to be as simple as possible.
> But, given that the bindings already exist, it could be wasted effort,
> and we can find another one that don't have bindings yet. I don't
> think that a pipeline like
>
> Java -> Jace -> C++ -> SWIG
>
> would perform well, but it can be tested.
It is worth trying. Jace will (probably) generate a simple C++
interface, and it may be just the thing to do. If you make a plan I
would start with spending time on assessing the combination with Jace.
SWIG is very good a parsing C/C++ code. If Jace creates clean C++ code
it may work well.
In the next phase see if you can take Jace out of the equation.
Especially if it does not deliver all the goods.
It should be fairly easy to parse a standard JAVA class and convert it
to something C-like that SWIG can accept. There should be other ways.
Another strategy, after studying the way SWIG is implemented for JAVA -
and other languages - you may be able to manipulate the JNI and query
JAVA interactively for bindings (using reflection). After that write
out the C headers for SWIG to parse.
Another option to try would be using a grammar - and parse JAVA input
files - there is a very good one written in JAVA named ANTLR
http://www.antlr.org/. There are probably examples for parsing JAVA
with ANTLR.
I think the essence of this GSoC project is to study the different
strategies, play around, and do a proof-of-concept finding the most
elegant way of mapping Python (or Perl or R) against JAVA. So it is a
project of pursuing different options and finding a route that will
work for a lot of people. If you find an elegant way fame awaits you
;).
It is important in your plan to create deliverables - in the sense of
working pieces of code and tests. These will tell you (and us) how
well a strategy is panning out.
Challenging enough?
Pj.
More information about the BioLib-dev
mailing list