[Pellet-users] Interrupting a classification process with a ProgressMonitor

Evren Sirin evren at clarkparsia.com
Mon Jun 9 18:32:15 UTC 2008


Hi Robert,

Attached is a very simple program I've written to try a specialized 
progress monitor that timeouts after a user-specified amount of time. 
The timeout is checked separately for classification and realization 
tasks so if either of those processes take longer the task will be 
canceled. Cancellation means the process will terminate silently as if 
it has never been called. This means the calling method should check the 
isClassified (or isRealized) falgs to figure out if the process 
completed or not (as done in the sample program). It also means that 
taskFinished() will not be called for the canceled process.

The output I get from the sample program looks like the following where 
classification is completed successfully but realization timeouts 
(though your output might be different depending on how fast 
classification and realization happens on your machine):

Loading the ontology...done
taskStarted() called at 14:18:42.310 for Classifying
Classifying 45 elements
Classifying:  100% complete in 00:00:00
Classifying finished
taskFinished() called at 14:18:42.415 for Classifying

Classification successful true

taskStarted() called at 14:18:42.422 for Realizing
Realizing 1555 elements
Realizing:  5% complete in 00:00:00
Realization successful false

There are two subtle issues I discovered writing this program. First, I 
saw that progress monitor is recreated after ever canceled 
classification attempt which means the user-defined progress monitor 
needs to be set every time you call classify to be on the safe side 
(otherwise monitor might be reset to the default monitor which could be 
the silent one with no output). Second issue is canceling realization 
process causes a NullPointerException with the default (slighly faster) 
realization options. Thus, I had to change the configuration option in 
my program at the very beginning.

I don't know if the issue you were seeing was related to these (or if it 
was some weird Tomcat logging thing) but trying your version in a simple 
program like this might reveal the problem.

Cheers,
Evren


On 6/6/08 5:28 AM, Robert Davey wrote:
> Hi all,
>
> I'm trying to cancel a realisation or classification process by
> implementing Evren's suggestion to me (off list) that I should use the
> ProgressMonitor interface.
>
> I make a new implementation (ReasonerProgressMonitor) by extending a
> pre-existing concrete ProgressMonitor (like the ConsoleProgress monitor
> for example) and registering it with the taxonomy builder:
>
> reasoner.getKB().getTaxonomyBuilder().setProgressMonitor(new
> ReasonerProgressMonitor());
>
> I've also tried by writing a full implementation directly from the
> ProgressMonitor interface and neither work.
>
> By "not working" I mean that I can add a system message to my
> ReasonerProgressMonitor constructor to tell me that the correct monitor
> has been added to the TaxonomyBuilder implementation (which works fine)
> but any further system messages in the isCanceled or other overriden
> methods (taskStarted, taskFinished) do not get outputted.
>
> Furthermore, if I try and set the monitor to the ConsoleProgressMonitor,
> I also get no output, e.g. 
>
> System.out.println( progressTitle + " " + progressLength + "
> elements" );
>
> does not show up in my Tomcat logs, but the normal Log INFOs do.
>
> Are there any examples of the progress monitors anywhere, and
> particularly for stopping classification/realisation?
>
> Cheers
>
> Rob
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestMonitor.java
Type: text/x-java
Size: 2467 bytes
Desc: not available
Url : http://lists.owldl.com/pipermail/pellet-users/attachments/20080609/b2bb5ab7/attachment.java 


More information about the Pellet-users mailing list