Union (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
 
 
Line 6: Line 6:
  
 
Union(Directive d1,Directive d2,...)
 
Union(Directive d1,Directive d2,...)
 +
 +
== Examples ==
 +
 +
Following example gets all instances and subclasses of the input topic and concatenates the results. The reason for ''Roles'' directive on line 5 is to remove the default column which will still be present from ''Players'' directive.
 +
 +
importPackage(org.wandora.query2);
 +
importPackage(org.wandora.topicmap);
 +
new Union(
 +
  new Instances().as("#instance"),
 +
  new Roles("#instance").from(
 +
    new Players(
 +
      XTMPSI.SUPERCLASS_SUBCLASS,
 +
      XTMPSI.SUBCLASS).whereInputIs(XTMPSI.SUPERCLASS).as("#instance")
 +
  )
 +
)

Latest revision as of 12:50, 20 August 2009

[edit] Description

Joins the results of inner directives by concatenating them. If the results from different directives have different roles, new columns will be added with null values to make roles of each row identical. Duplicate rows are not removed.

[edit] Constructor

Union(Directive d1,Directive d2,...)

[edit] Examples

Following example gets all instances and subclasses of the input topic and concatenates the results. The reason for Roles directive on line 5 is to remove the default column which will still be present from Players directive.

importPackage(org.wandora.query2);
importPackage(org.wandora.topicmap);
new Union(
  new Instances().as("#instance"),
  new Roles("#instance").from(
    new Players(
      XTMPSI.SUPERCLASS_SUBCLASS,
      XTMPSI.SUBCLASS).whereInputIs(XTMPSI.SUPERCLASS).as("#instance")
  )
)
Personal tools