[Pellet-users] listening to reasoning progress?
Evren Sirin
evren at clarkparsia.com
Fri May 29 01:31:32 UTC 2009
On Tue, May 26, 2009 at 1:54 AM, Egon Willighagen <
egon.willighagen at gmail.com> wrote:
> Hi all,
>
> I am integrating Pellet and Jena into Bioclipse [0] and setting up
> scripting commands (see an overview of use cases at [1]) using a
> so-called manager, the RDFManager [2]. This all works pretty well, but
> the Pellet reasoner seems to output information to STDOUT which I
> would like to report to the user, such as:
>
> WARNING: Unsupported axiom: Property
> http://purl.org/dc/elements/1.1/language is defined both as an
> AnnotationProperty and a DatatypeProperty
> May 25, 2009 11:17:32 PM
> org.mindswap.pellet.jena.graph.loader.DefaultGraphLoader
> addUnsupportedFeature
>
The warning messages are stored as a set of strings in the loader. The
following snippet shows how to access the warnings:
// Create the model and read the ontology
OntModel model = ModelFactory.createOntologyModel(
PelletReasonerFactory.THE_SPEC );
model.read( ontologyURI );
// Make sure model is prepared (that is when data is loaded into
Pellet)
model.prepare();
// Get the underlying Pellet graph
PelletInfGraph pellet = ((PelletInfGraph) model.getGraph());
// Get the warnings
Set<String> warnings = pellet.getLoader().getUnpportedFeatures();
> And information on how far the reasoning has progressed:
>
> Classifying: 1% complete in 00:00:00
> Classifying: 2% complete in 00:00:00
> Classifying: 3% complete in 00:00:00
> Classifying: 4% complete in 00:00:00
> ...
> Classifying: 97% complete in 00:00:00
> Classifying: 98% complete in 00:00:00
> Classifying: 100% complete in 00:00:00
> Classifying finished in 00:00:00
> Realizing 91 elements
>
> Is there any way I can get access to this information from my Java
> code [2]? Bioclipse is an Eclipse RCP program, which comes with a nice
> progress bar functionality, where I want to report the progress...
>
You can implement the ProgressMonitor interface in Pellet and use your
custom progress monitor. There is an existing (simple) implementation using
the standard javax.swing.ProgressMonitor for implementation. See
org.mindswap.pellet.utils.progress.SwingProgressMonitor for details. If that
implementation is good enough for you you can use it directly. Or you can
implement your version using that example. Once you have this implementation
the following snippet shows how to override the default monitor (you need
the steps from above snippet to prepare the model and get the pellet graph):
pellet.getKB().getTaxonomyBuilder().setProgressMonitor( new
MyProgressMonitor() );
Cheers,
Evren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.owldl.com/pipermail/pellet-users/attachments/20090529/a36c1623/attachment.htm
More information about the Pellet-users
mailing list