Literals (query directive)
From WandoraWiki
(Difference between revisions)
(→Examples) |
|||
(3 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") | + | 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 == | ||
+ | |||
+ | 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") | ||
[[Category:Query directives]] | [[Category:Query directives]] |
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")