Skip to content

XOR operator

XOR is the Boolean operator that allows users to combine attributes, two at a time, to create Boolean expressions that will be true, if one of the operands is true, but will be false, if both are true.

The syntax is:

operand1
XOR
operand2
...

where:

  • XOR must be written in uppercase.
  • operand# may refer to a simple attribute, to a set combination of attributes or to a sequence of attributes (positional or logical).

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.

The XOR operator can also be used to combine simple attributes with multiple values and combinations or sequences of attributes, both positional and logical. To see specific syntax, please refer to the examples given for the operators AND, AND NOT and OR.