# OR operator

A combination of two expressions made with the `OR` operator is true if any expression is matched anywhere within the scope of the rule.

Consider the following example:

``````SCOPE SENTENCE
{
DOMAIN(dom1:NORMAL)
{
KEYWORD("uncased well")
OR
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 that 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.

Now consider the same rule run against this text:

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

The rule is triggered only once, because there is only one sentence and it matches both operands (the first because of uncased well and the second because of wellbore).

The `OR` operator can be used to combine positional sequences and combinations of attributes as shown below.

``````SCOPE SENTENCE
{
//abandon a well - lemma &VO ancestor
DOMAIN(dom1:NORMAL)
{
LEMMA("abandon", "cap")
&VO
ANCESTOR(18635, 39645) // oil well, oiler // oilfield, oil field
OR
>>
ANCESTOR(18635, 39645) // oil well, oiler // oilfield, oil field
}
}
``````

This rule combines a logical sequence with a strict positional sequence. Consider running the above rule against the following sample text:

``````Most of the abandoned oil wells are dangerous because very few of them are really properly capped or retired. Most of these oil wells were not probably abandoned with proper evacuation procedures and very few of them ever get checked after abandonment. So pressure that builds up from gases in the earth and shifting earthquakes can cause oil and gas to come back to the surface, even on an oil well that had been capped.
``````

The text contains three pairs of values that match the rule, each one in a different sentence and therefore triggers the rule three times.

The first pair is abandoned + oil wells in the first sentence, matched by the second operand, the second pair is oil wells + were (not) abandoned in the second sentence and the third is oil well + had been capped, both matched by the first operand, because oil wells and oil well are disambiguated as concepts descending from syncon 18635 and because a verb-object relation exists between were (not) abandoned and oil wells and between had been capped and oil well.

The syntax of the `OR` operator is:

``````expression
OR
expression``````

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

Warning

If used too often, the `OR` operator can cause a slowdown in the rules execution and, consequently, the engine performance, therefore it is advisable to use the `OR` operator only when necessary.