Empty (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
 
(Examples)
 
(One intermediate revision by one user not shown)
Line 8: Line 8:
  
 
[[Category:Query directives]]
 
[[Category:Query directives]]
 +
 +
== Examples ==
 +
 +
''Empty'' directive doesn't have many practical uses. It can be combined for example with ''If'' directive to return an empty set in some cases. ''If'' directive does this internally if no else directive is provided. You can turn this other way round and only return something in the else part as follows.
 +
 +
importPackage(org.wandora.query2)
 +
new If(
 +
  new Instances(),
 +
  new Empty(),
 +
  new Literals("no instances")
 +
)
 +
 +
Of course you could achieve same thing by using ''Not'' directive in the condition.

Latest revision as of 13:23, 25 August 2009

[edit] Description

Returns an empty result.

[edit] Constructor

Empty()

[edit] Examples

Empty directive doesn't have many practical uses. It can be combined for example with If directive to return an empty set in some cases. If directive does this internally if no else directive is provided. You can turn this other way round and only return something in the else part as follows.

importPackage(org.wandora.query2)
new If(
  new Instances(),
  new Empty(),
  new Literals("no instances")
)

Of course you could achieve same thing by using Not directive in the condition.

Personal tools