First (query directive)
From WandoraWiki
		(Difference between revisions)
		
		
| (2 intermediate revisions by one user not shown) | |||
| Line 11: | Line 11: | ||
== Examples ==  | == Examples ==  | ||
| − | importPackage(org.wandora.query2);  | + |  importPackage(org.wandora.query2);  | 
| − | new If(  | + |  new If(  | 
| − | + |    new BaseName().where("#DEFAULT","!=",null),  | |
| − | + |    new BaseName(),  | |
| − | + |    new First(new SubjectIdentifiers())  | |
| − | )  | + |  )  | 
| − | .from(new Instances())  | + |  .from(new Instances())  | 
This returns the base names of the instances of the input topic or the first subject identifier if the base name is not defined.  | This returns the base names of the instances of the input topic or the first subject identifier if the base name is not defined.  | ||
| + | |||
| + | [[Category:Query directives]]  | ||
Latest revision as of 09:57, 21 August 2009
[edit] Description
Returns the first or the first N rows of specified directive. May return less than specified number of rows if the inner directive does not return that many rows.
[edit] Constructor
First(Directive directive) - Returns the first row of directive.
First(int count, Directive directive) - Returns the first count rows of directive
[edit] Examples
importPackage(org.wandora.query2);
new If(
  new BaseName().where("#DEFAULT","!=",null),
  new BaseName(),
  new First(new SubjectIdentifiers())
)
.from(new Instances())
This returns the base names of the instances of the input topic or the first subject identifier if the base name is not defined.