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] getInstance returns null

Jonathan Carter jonathan.carter at
Thu Oct 2 11:14:27 PDT 2008

Hi Avi,

I have done this and use it for a slot widget I wrote that generates strings based on a pattern and the values of other slots of the Instance. However, I am reading the Browser Text from the slots on the form to get the strings.

I had issues with getting nulls for the slots and that happens if the FormWidget that your slot widget hasn't finished initialising. What this means is that your slot widget tries to read from other slots that haven't been instantiated yet. So, to get around this, I just had to test for and deal with NULL values. Once the form has finished being instantiated, everything is fine.

You can work back from your slot widget to the other slot widgets through the form widget that is the parent of your slot widget.

To get a reference to the Instance of a slot widget, use the ClsWidget:
// assume you have a Slot variable called aSourceSlot
ClsWidget aClswidget = getClsWidget();
SlotWidget aSlotwidget = aClswidget.getSlotWidget(aSourceSlot);
Instance aSlotWidgetInstance = aSlotWidget.getInstance();

And that gets you the instance you need assuming you have a Slot object to identify which widget you want. Note the comment about nulls above. In my real code, this snippet tests for null after each get...() Call to avoid possible null pointer exception.

Hope this helps


Jonathan Carter
Enterprise Architecture Solutions

------Original Message------
From: Avi Pfeffer
To: protege-discussion
ReplyTo: User support for Core Protege and the Protege-Frames editor
Sent: 2 Oct 2008 18:03
Subject: [protege-discussion] getInstance returns null


I am writing a slot widget.   I want to get access to other slots of
the instance to which the slot belongs, so I am calling getInstance,
inherited from AbstractSlotWidget.  Unfortunately, getInstance is
returning null.  Is this expected behavior, or am I doing something
wrong?  Is there any other way to get access to the instance to which
the slot belongs?

I am using Protege Frames 3.4 beta.

Thank you,
 Avi Pfeffer
protege-discussion mailing list
protege-discussion at

Instructions for unsubscribing: 

Sent from my BlackBerry® wireless device

More information about the protege-discussion mailing list