Count (query directive)
From WandoraWiki
(Difference between revisions)
Line 6: | Line 6: | ||
Count(Directive directive) | Count(Directive directive) | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | Following example counts all instances of the input directive. | ||
+ | |||
+ | importPackage(org.wandora.query2); | ||
+ | new Count(new Instances()) | ||
+ | |||
+ | Following example finds all topics in the topic map that have more than 5 instances. | ||
+ | |||
+ | importPackage(org.wandora.query2); | ||
+ | new Count(new Instances()) | ||
+ | .as("#count") | ||
+ | .from(new AllTopics().as("#topic")) | ||
+ | .where("#count",">","\"5\"",true) | ||
+ | |||
[[Category:Query directives]] | [[Category:Query directives]] |
Revision as of 13:02, 21 August 2009
Description
Counts the number of rows returned by the inner directive using same input the Count directive got.
Constructor
Count(Directive directive)
Examples
Following example counts all instances of the input directive.
importPackage(org.wandora.query2); new Count(new Instances())
Following example finds all topics in the topic map that have more than 5 instances.
importPackage(org.wandora.query2); new Count(new Instances()) .as("#count") .from(new AllTopics().as("#topic")) .where("#count",">","\"5\"",true)