# XOR operator

A combination of two expressions made with the `XOR` operator is true if any expression is matched and the other is not matched anywhere within the scope of the rule. The difference with the `AND NOT` operator is subtle: an `AND NOT` combination is true if the first expression is matched and the second is not, a `XOR` combination is true if any of the two expressions is matched while the other is not.

Consider the following example:

``````SCOPE SENTENCE
{
DOMAIN(dom1:NORMAL)
{
KEYWORD("uncased well")
XOR
ANCESTOR(13769)//  13769: bore-hole, bore, borehole, drill hole
}
}
``````

The rule's condition is the combination of a `KEYWORD` attribute and an `ANCESTOR` attribute. It will match the portion of input text delimited by rule's scope, if it contains at least a token having its literal value set to uncased well or at least a token from a concept which descends from syncon 13769.

Consider this text:

``````A simple method is presented to estimate the distribution of temperature around an uncased well at any time. A method of determining temperature around the wellbore during the drilling period has been adopted from the literature and is extended to the period by superpositioning in the time domain the effect of temperature change.
``````

The first sentence contains:

``````uncased well = keyword "uncased well", once
``````

The second sentence contains:

``````wellbore = concept descending from syncon 13769, once
``````

The rule's condition is thus met twice and the rule is triggered twice.

``````When an uncased well is put into production, the pressure in the wellbore is lower than the pore pressure
``````

Since uncased well and wellbore are in the same sentence, the rule is not triggered: both operands are true (in the rule's scope).

See the topic about the `OR` operator to compare this behavior to the behavior that could be observed, if the same sample sentence were analyzed with the same rule, but with the `OR` operator.

Note

As shown with these examples, the exclusive `OR` is a peculiar operator defining very strict conditions in a rule. The user is advised to use it only when strictly necessary.

As for `AND`, `AND NOT` and `OR`, the `XOR` operator can be used to combine positional sequences and combinations of attributes.

The syntax is:

``````expression
XOR
expression``````

where `XOR` is a language keyword and must be written in uppercase.