AbstractTableWidget advice?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

AbstractTableWidget advice?

Richard Dunlap

Context: I've created a metaclass with two metaslots that are both
subslots of :DIRECT-TEMPLATE-SLOTS. [Short reason why -- the metaslots
are containers for instances that are subslots of :SLOT.  This allows me
to restrict the value type the slots could be assigned in a different
way for each metaslot and to group the slots on the class form, but in
all other ways interact with those slots like template slots on the
Forms Tab and Instances Tab.]  The metaclass will be used to create a
hierarchy of classes, and the contents of these metaslots should be
visibly inherited and overrideable.

The only widget I've found that supports the "visibly inherited"
requirement above is the TemplateSlotsWidget -- all other choices show
only direct slots of the class in question.  Anyone who has been down
this path before knows the issue I've run into: the TemplateSlotsWidget
is a direct observer of the direct template slots in the knowledge base,
and thus, while it works for adding slots, additions to one metaslot end
up being displayed as additions to both metaslots.

I see three choices:

1) Follow the model and write a customized version of
DirectTemplatesWidget.  This seems to be the best approach -- but this
class derives from AbstractTableWidget, a further derivation of
AbstractSlotWidget, and uses the "observer on the knowledge base"
pattern that the slot widget plug-in guidelines specifically proscribes.
  Can anyone with experience going this direction tell me if there are
other subtleties I should watch out for?  Currently my number one option
-- it looks like I'm OK if I jump off the TemplateSlotsWidget baseline
and watch my steps while adding filters in strategic spots.

2) Follow the guidelines and write a slot widget plug-in directly.
Besides the fact that the DirectTemplatesWidget is tantalizingly close
to what I want, I'm also hesitant to go this direction because of the
lack of an example of a custom widget for a slot with multiple
cardinality and display of inherited values.  Currently my number two
choice.

1) Write customized versions of the Forms Tab and Instances Tab that
eliminate the need to make the metaslots subslots of
:DIRECT-TEMPLATE-SLOTS.  This is only a partial solution, as I would
also need a customized slot widget to display inherited values (I think)
-- and, for what it's worth, I think making the metaslots subslots of
:DIRECT-TEMPLATE-SLOTS happens to be the correct model.  Currently my
number three choice.

Any suggestions or thoughts before I move too far down this path?  Thanks!

-- Richard Dunlap

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: AbstractTableWidget advice?

Tania Tudorache

Hi Richard,

the subclassing of the :DIRECT-TEMPLATE-SLOTS has been tried before.
(http://article.gmane.org/gmane.comp.misc.ontology.protege.owl/3110) The
problem at that time was that the subslots of :DIRECT-TEMPLATE-SLOTS
attached to classes did not get instantiated at instance level, but this
bug was fixed since then.

 From my experience, I would tend to implement solution No.1. The
customization of the DirectTemplateSlot widget should not be too hard to
implement. However I am not sure that you can subclass the
TemplateSlotsWidget and change the functionality the way you want, cause
many methods are still private.

I have implemented a customized widget for subslots of
:DIRECT-TEMPLATE-SLOT some time ago, but I did not have time to really
test it and finalize small details. But, it worked fine. If you want, I
could look for the code and send it to you, so that you may extend it,
or just have an idea how hard it is to customize the implementation.

Cheers,
Tania


Richard Dunlap wrote:

> Context: I've created a metaclass with two metaslots that are both
> subslots of :DIRECT-TEMPLATE-SLOTS. [Short reason why -- the metaslots
> are containers for instances that are subslots of :SLOT.  This allows me
> to restrict the value type the slots could be assigned in a different
> way for each metaslot and to group the slots on the class form, but in
> all other ways interact with those slots like template slots on the
> Forms Tab and Instances Tab.]  The metaclass will be used to create a
> hierarchy of classes, and the contents of these metaslots should be
> visibly inherited and overrideable.
>
> The only widget I've found that supports the "visibly inherited"
> requirement above is the TemplateSlotsWidget -- all other choices show
> only direct slots of the class in question.  Anyone who has been down
> this path before knows the issue I've run into: the TemplateSlotsWidget
> is a direct observer of the direct template slots in the knowledge base,
> and thus, while it works for adding slots, additions to one metaslot end
> up being displayed as additions to both metaslots.
>
> I see three choices:
>
> 1) Follow the model and write a customized version of
> DirectTemplatesWidget.  This seems to be the best approach -- but this
> class derives from AbstractTableWidget, a further derivation of
> AbstractSlotWidget, and uses the "observer on the knowledge base"
> pattern that the slot widget plug-in guidelines specifically proscribes.
>   Can anyone with experience going this direction tell me if there are
> other subtleties I should watch out for?  Currently my number one option
> -- it looks like I'm OK if I jump off the TemplateSlotsWidget baseline
> and watch my steps while adding filters in strategic spots.
>
> 2) Follow the guidelines and write a slot widget plug-in directly.
> Besides the fact that the DirectTemplatesWidget is tantalizingly close
> to what I want, I'm also hesitant to go this direction because of the
> lack of an example of a custom widget for a slot with multiple
> cardinality and display of inherited values.  Currently my number two
> choice.
>
> 1) Write customized versions of the Forms Tab and Instances Tab that
> eliminate the need to make the metaslots subslots of
> :DIRECT-TEMPLATE-SLOTS.  This is only a partial solution, as I would
> also need a customized slot widget to display inherited values (I think)
> -- and, for what it's worth, I think making the metaslots subslots of
> :DIRECT-TEMPLATE-SLOTS happens to be the correct model.  Currently my
> number three choice.
>
> Any suggestions or thoughts before I move too far down this path?  Thanks!
>
> -- Richard Dunlap
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>
>  

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html