This example shows an instance of the DataSubset specialization of the WhereClause class that defines a compound expression for "Example flag 1 is not missing or N". The compound expression of this data subset:
- Negates another compound expression that specifies that the value of the EXMPFL variable in the ADVS dataset is missing or the value of the EXMPFL variable in the ADVS dataset is equal to "N".
- Could be expressed as:
NOT (ADVS.EXMPLFL EQ '' OR ADVS.EXMPLFL EQ 'N')
Note that this is a relatively simple example that has been created to illustrate the use of "NOT"; in practice, it would be better to simplify this criterion by using the logically equivalent inverse criterion: ADVS.EXMPLFL NE '' AND ADVS.EXMPLFL NE 'N'
. The "NOT" logical operator would generally only be used to negate either:
- more complex compound expressions where the logically inverse criterion is more difficult to express, or
- compound expressions in which subclauses are referenced by identifier values (as described in the AnalysisSet and GroupingFactor sections).
Lines 1-5: | Show the attributes of the DataSubset specialization of the WhereClause class: - level is assigned as "1" because this is the "top" level of the specification of the selection criterion.
- order is "1" because level is "1" and this is not a specialization of the Group class.
- The presence of the compoundExpression attribute indicates that a compound expression is being defined.
| Lines 6-7: | Show the attributes of an instance of the CompoundSubsetExpression specialization of the WhereClauseCompoundExpression class (because this is a compound expression within a DataSubset class): - The value of the logicalOperator attribute is "NOT", which indicates that the subclause specified in the whereClauses attribute is being negated.
- The whereClause attribute contains a single subclause, which is another compound expression represented as an instance of the WhereClause class (because this is a subclause within a CompoundSubsetExpression class) with "2" as the value of the level attribute (1 greater than the level of the DataSubset class specifying this compound expression). The value of the order attribute is "1" because this is the first (and only) subclause within this level.
| Lines 11-12: | Show the attributes of an instance of the WhereClauseCompoundExpression class (because this is a compound expression within a WhereClause class): - The value of the logicalOperator attribute is "OR" which indicates that either of the subclauses specified in the whereClauses attribute has to be satisfied.
- The whereClause attribute contains 2 subclauses, both of which are simple conditions represented as instances of the WhereClause class (because these are subclauses within a WhereClauseCompoundExpression class) with "3" as the value of the level attribute (1 greater than the level of the WhereClause class specifying this compound expression). The values of the order attribute are "1" and "2" to order the subclauses within this level.
|
|
id: DSS-EXMPL-NOT
label: Example flag is not missing or N
level: 1
order: 1
compoundExpression:
logicalOperator: NOT
whereClauses:
- level: 2
order: 1
compoundExpression:
logicalOperator: OR
whereClauses:
- level: 3
order: 1
condition:
dataset: ADVS
variable: EXMPLFL
comparator: EQ
value:
- level: 3
order: 2
condition:
dataset: ADVS
variable: EXMPLFL
comparator: EQ
value:
- N |
This compound expression could be represented in tabular form as shown in the following table where:
- Each instance of the WhereClause class (and its DataSubset specialization) is represented on a separate row.
- The values of the id and label attributes of the DataSubset class have be propagated onto all rows representing subclauses within the defined data subset.
id | label | level | order | logicalOperator | dataset | variable | comparator | value |
---|
DSS-EXMPL-NOT | Example flag is not missing or N | 1 | 1 | NOT |
|
|
|
| DSS-EXMPL-NOT | Example flag is not missing or N | 2 | 1 | OR |
|
|
|
| DSS-EXMPL-NOT | Example flag is not missing or N | 3 | 1 |
| ADVS | EXMPLFL | EQ |
| DSS-EXMPL-NOT | Example flag is not missing or N | 3 | 2 |
| ADVS | EXMPLFL | EQ | N |
|