KBCaller is a Java mini-library which abstracts the act of sending API requests to OWLKB over HTTP. See here for documentation about OWLKB.
public KBCaller( String url )Creates a KBCaller object. Specify the url of an OWLKB instance, including port. For example, our OWLKB demo instance has the url http://open-physiology.org:20080. If OWLKB is running on the same machine as the Java application you're working on, and if OWLKB is running on its default port (20080), you can use the url http://localhost:20080
For documentation on the different API methods, see the comments in KBCaller.java. In all cases except for "addlabel", the methods return a list of results as a JSON list, e.g. something like:
['FMA_50801','CHEBI_999','RICORDO_56345634']If you would prefer the results as an ArrayList<String> and you don't want to add a full JSON parser dependency to your project, we've included a bare-bones JSON-list-parser function in KBCaller:
public ArrayList<String> parse_json( String json ) throws IOExceptionYou can compose this with any of the String-returning API methods (except "subhierarchy"), for example:
KBCaller kbcaller = new KBCaller( "http://open-physiology.org:20080" );If you want to parse the "subhierarchy" JSON, you'll probably want to use a full JSON parser for that, as it's not a flat list.
String subclasses_raw = kbcaller.subterms( "part-of some FMA_50801" );
subclasses = kbcaller.parse_json( kbcaller.subterms( "part-of some FMA_50801" ) );
catch( Exception e )