Compare (query directive)

From WandoraWiki
(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
Compares the values of two roles in the input column. The directive constructor is given a comparison operator as a string. It can be one of "==", "!=", "<", ">", "<=", ">=" or various aliases of these commonly used in programming languages. It can also be one of two topic map related operators "t=" or "t!=". These compare the equality or inequality, respectively, of topics instead of numeric or string representations the values.  
+
Compares the values of two roles in the input column.
 +
 
 +
The directive constructor is given a comparison operator as a string. It can be one of "==", "!=", "<", ">", "<=", ">=" or various aliases of these commonly used in programming languages. It can also be one of two topic map related operators "t=" or "t!=". These compare the equality or inequality, respectively, of topics instead of numeric or string representations the values.
 +
 
 +
The operands can be either role identifiers in the input column or literal values. Literals must be inside double quotation marks, role values are not. null is also a valid operand which is treated as a literal. You will of course have to escape the quotation marks since the operands are normal Java strings. For example "#DEFAULT" refers to the value of column with the default role and "\"#DEFAULT\"" is a string literal.
  
 
== Constructor ==
 
== Constructor ==
  
Compare(String role1,String comp,String role2)
+
Compare(String operand1,String operator,String operand2)
  
Compare(String role1,String comp,String role2,boolean numeric) - If numeric is true, converts the values to numbers before comparing
+
Compare(String operand1,String operator,String operand2,boolean numeric) - If numeric is true, converts the values to numbers before comparing
  
 
== Notes ==
 
== Notes ==

Revision as of 10:22, 21 August 2009

Description

Compares the values of two roles in the input column.

The directive constructor is given a comparison operator as a string. It can be one of "==", "!=", "<", ">", "<=", ">=" or various aliases of these commonly used in programming languages. It can also be one of two topic map related operators "t=" or "t!=". These compare the equality or inequality, respectively, of topics instead of numeric or string representations the values.

The operands can be either role identifiers in the input column or literal values. Literals must be inside double quotation marks, role values are not. null is also a valid operand which is treated as a literal. You will of course have to escape the quotation marks since the operands are normal Java strings. For example "#DEFAULT" refers to the value of column with the default role and "\"#DEFAULT\"" is a string literal.

Constructor

Compare(String operand1,String operator,String operand2)

Compare(String operand1,String operator,String operand2,boolean numeric) - If numeric is true, converts the values to numbers before comparing

Notes

The where method present in every directive can be given three strings corresponding to the first constructor. A new Compare directive will be implicitly created. A.where("r1","==","r2") will resolve to new From(new Compare("r1","==","r2"),A).

Personal tools