Players (query directive)
Gets players of specified roles from associations of specified type. Input topic is the active column value of input row.
Players(TopicOperand associationType,TopicOperand r1,...)
This directive contains a method whereInputIs(String role). This method can be used to set an additional requirement for the returned rows. The input topic must play the specified role for a row to be included in the results. For example new Players(XTMPSI.SUPERCLASS_SUBCLASS,XTMPSI.SUBCLASS).whereInputIs(XTMPSI.SUPERCLASS) will return all subclasses of input. Since the input class itself is likely to be a subclass of some other class, it might be returned as well without the whereInputIs method call.
Following example gets the super classes of the input topic. The call to whereInputIs makes sure that the input topic plays the role sub class in any association whose players might be included. Without it an association where the input topic is a super class of some other topic might be considered and the input topic included in the results.
importPackage(org.wandora.query2); importPackage(org.wandora.topicmap); new Players(XTMPSI.SUPERCLASS_SUBCLASS,XTMPSI.SUPERCLASS) .whereInputIs(XTMPSI.SUBCLASS),