Search Mailing List Archives
[protege-discussion] getSlotWidget(slot)
Neil Douglas Matatall
nmatatal at uci.edu
Fri Oct 5 11:20:59 PDT 2007
Dear List,
Short Version of my question:
is there a way to call getSlotWidget(slot) without creating a
ClsWidget? Even better would be slot.getSlotWidget(). Is there a
way to do this?
Long Version:
I have written a SlotPlugin and I'm trying to find a way to find all
slots that use that plugin during one of the hooks in my
ProjectPlugin. So far the only way I have accomplished this is with
the strategy from
http://protegewiki.stanford.edu/index.php/Working_with_the_graph_widget
Project p = slot.getProject();
p.getKnowledgeBase().getSlots();
if (this.cachedSlots.containsKey(slot.getName())) {
return true;
}
ClsWidget valueType = p.createRuntimeClsWidget(instance);
SlotWidget slotWidget = valueType.getSlotWidget(slot);
if ("MyPluginField".equals(slotWidget.getName())) {
this.cachedSlots.put(slot.getName(), slot);
return true;
}
return false;
This does work, but the problem is that I'm iterating over every
single instance in my ontology, creating a runtime ClsWidget each
time. This either takes too long or causes an OutOfMemory exception
and is just a bad idea in general.
Ideally, I want to just get all the slots and determine which ones
use my SlotWidget without needing to construct a runtime widget (i.e.
using the slot only). That way I can interate over the Clses,
determine if the Cls contains one of the slots in question, and then
perform individual operations on the SlotValues if necessary. This
way, the chances of taking a noticeable performance hit / running out
of memory would be pretty low.
Thanks in advance,
Neil Matatall
More information about the protege-discussion
mailing list