Samuel Lampa's blog

How to deal with rdf namespaces (does not work well with JPL)

I had the problem that in JPL (The java Prolog API) you cannot use namespaces before term (atoms or variables etc.) names, like so:

prologFunction( ns:'atom' ).

The best solution would be to have some kind of "namespace-like" support in the JS console of Bioclipse instead. One easy thing one can do is to just create a simple function that appends the long preceding URL, so a JS Example could be:

function molid ( term ) {
  return "http://pele.farmbio.uu.se/nmrshiftdb/?moleculeId=" + term;
}
blipkit.queryRDF(molid("234"),"X","Y");

Solved problem with using rdf_db (to load RDF data) from Bioclipse

I had problems executing rdf_db from inside Bioclipse, but was getting problems similar to this one:

Running JavaScript...
org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Failed to run method (line: #9)
 jpl.PrologException: PrologException: error(existence_error(procedure, /(rdf_load, 1)), context(:(system, /('$c_call_prolog', 0)), _0))
JavaScript done.

This was solved by adding the following line to the blipstart.pl file:

:- use_module(library('semweb/rdf_db')).

So the last part of the file now looks like:

.

Nice intro to RDF in Prolog (by Pellet author)

I found a nice introduction to the use of RDF in Prolog (SWI-Prolog). It contains short primers for both RDF and Prolog, so it should be accessible to anyone with a minimal programming background:

Pondering over strategies for evaluating BLIPKIT vs Pellet for use with NMRShift data

As a subproject, I'm now focusing on doing some comparison between reasoning in Prolog and Pellet, using example data from NMRShiftDB.org. Below I'm documenting my planning, + any new findings while I'm digging in to this subpeoject.

Testing out querying Prolog from Bioclipse

My project has been more or less on hold for around a week because of exams and other stuff. Looking forward to getting some concrete things done now. While still reading up a bit on OWL, I've started taken the first steps of the prolog/blipkit integration with a simple method for querying a prolog on the form "subject, a predicate, and an object".

Running Ubuntu Karmic Koala and sun-java-6

Upgraded to Ubuntu Karmic Koala, and took the occasion to swith to sun-java-6 (Had problems with OpenJDK before).

Bioclipse with blipkit plugin still works like a charm. Just had to modify the Eclipse startup script, since the path's to my java libraries changed.

Accessing BLIPKIT from command line Java or Eclipse Plug-in in Ubuntu

For my own documentation I went ahead and summarized all the steps I had to take

  1. In order to start blipkit from java commandline, and
  2. In order to start blipkit from an Eclipse plugin.

Got blipkit started from inside Eclipse

I now also managed to start blipkit from inside Eclipse.

The trick was to start the whole eclipse (The eclipse using for building Bioclipse) preceded with LD_PRELOAD=...the path to libjpl.so , and before that adding the paths to where libjava.so and libjvm.so are located.

Finally got blipkit started from java via jpl

Finally got blipkit started from java via jpl :)

  • (Thanks to Andrew Koster on the SWIPL mailing list, who made me continue researching the LD_PRELOAD trick!)

In order to get the jpl java examples to work, LD_LIBRARY_PATH has to contain:

/usr/lib/jvm/java-1.5.0-sun-1.5.0.19/jre/lib/i386/client/:/usr/lib/jvm/java-1.5.0-sun-1.5.0.19/jre/lib/i386/

Furthermore, CLASSPATH has to be:
/usr/local/lib/pl-5.7.15/lib/jpl.jar:/home/samuel/install/swi-prolog/pl57/packages/jpl/examples/java/Test

Now firing up blipkit works, when calling Java from commandline!!!

Things learned today, 15/10 2009

  • Simply moving initialization statements from the blip startup script in /usr/local/bin/blip to /home/samuel/.plrc did not work.