OWLKB 2.0's KBCaller Documentation


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

API Methods

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:

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 IOException
You can compose this with any of the String-returning API methods (except "subhierarchy"), for example:
KBCaller kbcaller = new KBCaller( "http://open-physiology.org:20080" );
String subclasses_raw;
List<String> subclasses;
  String subclasses_raw = kbcaller.subterms( "part-of some FMA_50801" );
  subclasses = kbcaller.parse_json( kbcaller.subterms( "part-of some FMA_50801" ) );
catch( Exception e )
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.


Back to main OWLKB documentation