Join (query directive)
Contents |
Description
Joins the results of inner directives by performing a cartesian product on the results of them.
Constructor
Join(Directive d1,Directive d2,...)
Notes
This directive is best used using the join method present in every directive. Calling A.join(B) will resolve to new Join(A,B). In many cases you do not need to refer to join specifically at all. Instead you may provide several directives to from method which will implicitly join them.
Example
importPackage(org.wandora.query2); importPackage(org.wandora.topicmap); new Join( new Instances().as("#instance"), new Players( XTMPSI.SUPERCLASS_SUBCLASS, XTMPSI.SUBCLASS).whereInputIs(XTMPSI.SUPERCLASS) ).where("#instance","t=",XTMPSI.SUBCLASS)
Above example joins instances and subclasses of input. Typically the results of joins are filtered by comparing some values of the result rows. In this case only rows where the topics with roles "#instance" and XTMPSI.SUBCLASS are the same are selected (see Compare directive). Effectively this query finds out if any of the instances of the input topic are also subclasses of it.