And (query directive)
From WandoraWiki
(Difference between revisions)
| Line 9: | Line 9: | ||
== Notes == | == Notes == | ||
| − | In simple cases you can avoid using And directive by calling the where method twice. A.where(new And(B,C)) is logically same as A.where(B).where(C) though structurally it resolves to a slightly different query. | + | In simple cases you can avoid using ''And'' directive by calling the ''where'' method twice. ''A.where(new And(B,C))'' is logically same as'' A.where(B).where(C)'' though structurally it resolves to a slightly different query. |
| + | |||
| + | == Examples == | ||
| + | |||
| + | importPackage(org.wandora.query2); | ||
| + | importPackage(org.wandora.topicmap); | ||
| + | new Instances().where( | ||
| + | new And( | ||
| + | new IsOfType("http://www.wandora.org/core/associationtype"), | ||
| + | new IsOfType("http://www.wandora.org/core/contenttype") | ||
| + | ) | ||
| + | ) | ||
| + | |||
| + | This gets all instances of the input topic that are also instances of both association type and content type. | ||
[[Category:Query directives]] | [[Category:Query directives]] | ||
Latest revision as of 10:11, 21 August 2009
Contents |
[edit] Description
Includes rows which satisfy all inner filtering directives.
[edit] Constructor
And(WhereDirective d1,WhereDirective d2,...)
[edit] Notes
In simple cases you can avoid using And directive by calling the where method twice. A.where(new And(B,C)) is logically same as A.where(B).where(C) though structurally it resolves to a slightly different query.
[edit] Examples
importPackage(org.wandora.query2);
importPackage(org.wandora.topicmap);
new Instances().where(
new And(
new IsOfType("http://www.wandora.org/core/associationtype"),
new IsOfType("http://www.wandora.org/core/contenttype")
)
)
This gets all instances of the input topic that are also instances of both association type and content type.