Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] beanshell scripting in protege

Jason Sachs jmsachs at
Thu Nov 13 06:46:36 PST 2008

OK, I found the API at and have
gotten some very preliminary tasks done like creating a new instance of a
class and examining/setting its slots. I'm guessing what I have in mind
should be fairly straightforward, just a matter of getting to know the API &
it looks fairly predictable. (and not "squirrely" like the Win32 API where
sometimes I feel like I'm going in circles around a hidden room... >:( but
that's a whole other ballgame)

is the appropriate way to get/set a slot value like this:
s = kb.getSlot("title");
print(i.getOwnSlotValue(s)); // i is an instance
i.setOwnSlotValue(s,"this is the title");

It seems strange to me to get slots from the kb object rather than the i
object. Frames have a getOwnSlots() method but that returns a collection of
slots which you have to iterate through one by one (at least in beanshell).
It seems like there ought to be Frame.getOwnSlotByName() and
Frame.hasOwnSlotByName() functions.

also a request (and I'm not quite sure how the Protege bindings interact
with the BSF features): in beanshell you can type clear() or reassign the
"kb" variable and you lose access to the knowledge base object. ("Doctor, it
hurts when I stab myself!" "Well stop doing it!") I suspect it is possible
to declare this variable as non-modifiable (there's definitely a way to do
this for objects exposed to Javascript) and that would be helpful.

Of course what I was really trying to do was reset the scripting
environment; there doesn't seem to be any way to do this other than
reconfigure the project to remove the scripting tab, then add it back. A
"reset" or "clear" button would be a lot of help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the protege-discussion mailing list