Empty (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
 
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 Exists(new Instances()),
 +
  new Empty(),
 +
  new Literals("no instances")
 +
)
 +
 +
Of course you could achieve same thing by using ''Not'' directive in the condition.

Revision as of 13:21, 20 August 2009

Description

Returns an empty result.

Constructor

Empty()

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 Exists(new Instances()),
  new Empty(),
  new Literals("no instances")
)

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

Personal tools