Literals (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
(Examples)
 
(2 intermediate revisions by one user not shown)
Line 9: Line 9:
 
== Notes ==
 
== Notes ==
  
The ''from'' method present in every directive can be given strings instead of directives. In this case a ''Literals'' directive is implicitly from the strings. ''A.from("b","c","d")'' resolves to ''new From(A,new Literals("b","c","d"))''.
+
The ''from'' method present in every directive can be given strings instead of directives. In this case a ''Literals'' directive is implicitly created from the strings. ''A.from("b","c","d")'' is same as ''A.from(new Literals("b","c","d"))''.
  
 
== Examples ==
 
== Examples ==
Line 15: Line 15:
 
  importPackage(org.wandora.query2);
 
  importPackage(org.wandora.query2);
 
  new If(
 
  new If(
   new Exists(new Instances()),
+
   new Instances(),
 
   new Literals("has instances"),
 
   new Literals("has instances"),
 
   new Literals("no instances")
 
   new Literals("no instances")

Latest revision as of 13:23, 25 August 2009

Contents

[edit] Description

Returns the strings provided to constructor. The returned rows have one column with the default role.

[edit] Constructor

Literals(String s1,...)

[edit] Notes

The from method present in every directive can be given strings instead of directives. In this case a Literals directive is implicitly created from the strings. A.from("b","c","d") is same as A.from(new Literals("b","c","d")).

[edit] Examples

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

This returns one of two literals depending on whether the input has instances.

Example below gets instances from the schema type topic. Literals is used implicitly.

importPackage(org.wandora.query2);
new Instances().from("http://www.wandora.org/core/schema-type")
Personal tools