From (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
Line 9: Line 9:
 
== Notes ==
 
== Notes ==
  
This directive is best used using the from method present in every directive. Calling A.from(B) will resolve to new From(A,B).
+
This directive is best used using the from method present in every directive. Calling ''A.from(B)'' will resolve to ''new From(A,B)''.
  
The from method, but not the directive constructor, can be given several directives. In this case they will be joined using the Join directive. A.from(B,C) will resolve to new From(A,new Join(B,C)).
+
The ''from'' method, but not the directive constructor, can be given several directives. In this case they will be joined using the [[Join (query directive)|Join]] directive. ''A.from(B,C)'' will resolve to ''new From(A,new Join(B,C))''.
 +
 
 +
You may also give the ''from'' method, not the directive constructor, one or more strings. In this case a [[Literals (query directive) |Literals]] directive will be implicitly created from the strings. ''A.from("b","c","d")'' resolves to ''new From(A,new Literals("b","c","d"))''.
 +
 
 +
== Examples ==
 +
 
 +
importPackage(org.wandora.query2);
 +
new Instances().from(new Instances())
 +
 
 +
Above example selects the instances of the instances of the input topic.
 +
 
 +
importPackage(org.wandora.query2);
 +
new Instances().from("http://www.wandora.org/core/schema-type")
 +
 
 +
Above example gets instances of the specified topic. The from method implicitly creates a [[Literals (query directive) |Literals]] directive. [[Instances (query directive) |Instances]] directive can take as input both topics or subject identifier string so this works without explicitly converting the string to a topic.
  
You may also give the from method, not the directive constructor, one or more strings. In this case a Literals directive will be implicitly created from the strings. A.from("b","c","d") resolves to new From(A,new Literals("b","c","d")).
 
  
 
[[Category:Query directives]]
 
[[Category:Query directives]]

Revision as of 10:51, 20 August 2009

Contents

Description

Takes the results from one directive and feeds them one row at a time to another combining all results.

Constructor

From(Directive to,Directive from)

Notes

This directive is best used using the from method present in every directive. Calling A.from(B) will resolve to new From(A,B).

The from method, but not the directive constructor, can be given several directives. In this case they will be joined using the Join directive. A.from(B,C) will resolve to new From(A,new Join(B,C)).

You may also give the from method, not the directive constructor, one or more strings. In this case a Literals directive will be implicitly created from the strings. A.from("b","c","d") resolves to new From(A,new Literals("b","c","d")).

Examples

importPackage(org.wandora.query2);
new Instances().from(new Instances())

Above example selects the instances of the instances of the input topic.

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

Above example gets instances of the specified topic. The from method implicitly creates a Literals directive. Instances directive can take as input both topics or subject identifier string so this works without explicitly converting the string to a topic.

Personal tools