Re: [protege-discussion] Problem with events and database backing
I am a bit confused getting this message because I think that the new
lists are protege-users and protege-dev. So I am forwarded this message
to protege-dev just in case.
On 02/15/2014 07:23 AM, clemens utschig wrote:
> folks - this is rather urgent...
> I try to get the listener magic to work (e.g. new instance created,
> frame update, browser text changed) - between the protege application
> and and multiple api based consumers all using the same - database
> backed - project.
> It seems somehow events / listeners are not firing / generated by
> Any help much appreciated.
This is just a thought and may not be related to what you are
experiencing. I am assuming that you are talking about Protege 3
although -- even though the implementations are completely different --
the same comments apply to Protege 4 and 5.
If you create two separate Protege knowledge bases (e.g. separate java
objects) that point to the same database then you will have several
problems. These problems only occur when modifying the knowledge bases;
I think that things will work if all the callers are in read-only mode.
The most obvious problem is that changes in one Protege knowledge base
will only generate events in that knowledge base and not in the other
knowledge bases. A less obvious problem is that, in certain
circumstances, changes made with one knowledge base will not be seen in
other knowledge bases. There may be other problems as well.
If this is in fact your problem then there are two obvious fixes to the
problem. If everything is happening in a single JVM, then it is
possible that you can refactor your code so that all callers requesting
a knowledge base will get the same one. Maybe there would be a static
method or something that manages the process of getting the knowledge
base. Since the code will no longer be reentrant, you may need to also
add some synchronization.
If you have more than one JVM or there is some other reason why the
above solution is not practical then the other approach is to use a
Protege server. If you have several clients accessing the same server
all the events and other synchronization will be taken care of. This is
easier than it sounds and there is a wiki page telling you how to do this: