I am working on a new release of Bossam. The upcoming release features a newly designed API. The new API exposes more interfaces for accessing the knowledge object model. You’ll be able to create and manipulate fact and rule objects, which will open better support for programming in rules.
The new Bossam operates in push model, like SAX. It pushes derivations and inconsistencies to the listeners that listen to the events generated from the reasoner. Creating a reasoner and executing a reasoning session looks as follows.
// Create a reasoner with the OWL reasoning capability IReasonerFactory f = ReasonerFactory.getInstance(); IReasoner r = f.createReasoner(ModelType.OWL);
// Read an OWL document specified in N3 from a URL r.read(ModelType.OWL, Syntax.N3, "http://someplace.com/sample.n3");
// Set a listener for events from the reasoner IReasonerListener l = new MyReasonerListener(); r.setReasonerListener(l);
// Execute a reasoning session. // Derivations are pushed to the listener r.run();
The reasoner listener interface has three methods:
void onDerivation(IFact f): called when a new fact is derived.
void onDerivation(IRule r): called when a new rule is derived.
void onInconsistency(IExplanation e): called when an inconsistency is encountered.
As seen in the example code, it’s possible to specify the syntax and the content model when reading in knowledge. For example, if an OWL document specified in RDF/XML is given, it’s possible to read in the document in two ways: either as a plain RDF document or as an OWL document, as shown below.
- Read the document as a plain RDF document:
reasoner.read(ModelType.RDF, Syntax.RDFXML, "http://.....");
- Read the document as an OWL document:
reasoner.read(ModelType.OWL, Syntax.RDFXML, "http://....");
As such, the new Bossam release will come with new API set, which will not be compatible with the previous releases. Any opinions on the new API and the compatibility issue are welcomed.
The new release will also feature user-defined builtin functions and (limited but working) forgetting.
Stay tuned and let me know if you have any idea to be accompanied to the new release. Thanks!