OR operator
OR
is the Boolean operator that allows to combine attributes, two at a time, to create a Boolean expression that will be true, if at least one operand is true.
Syntax is:
operand1
OR
operand2
...
where:
OR
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")
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 if run against a new sample 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 two attributes of the same type. Consider the following rule:
SCOPE SENTENCE
{
DOMAIN(dom1:NORMAL)
{
KEYWORD("well bore")
OR
KEYWORD("well bores")
}
}
against the sample text:
Bering Exploration to utilize coiled tubing technology to re-enter abandoned well bore
HOUSTON - Bering Exploration plans to utilize lateral technology to re-enter well bores that were previously abandoned. Bering currently has 34 abandoned well bores on its existing leases and has initially targeted three for re-entry utilizing coiled tubing laterals (CTL).
The above rule is triggered three times by three different sentences, the first because of the first operand, the others because of the second operand.
Now consider a modified sample rule where well bore and well bores are listed within the same attribute.
SCOPE SENTENCE
{
DOMAIN(dom1:NORMAL)
{
KEYWORD("well bore","well bores")
}
}
If run against the same text, this rule would generate the same result as the previous rule. Using an attribute with n values (as in KEYWORD("well bore", "well bores")
) is equivalent to combining n single-valued attributes of the same type with the OR
attribute.
Similarly, writing a single rule containing n attributes separated by the OR
operator, as in:
SCOPE SENTENCE
{
DOMAIN(dom1:NORMAL)
{
KEYWORD("uncased well")
OR
ANCESTOR(13769)// 13769: bore-hole, bore, borehole, drill hole
}
}
is equivalent to writing n separate rules with a single attribute each, as in.
SCOPE SENTENCE
{
DOMAIN(dom1:NORMAL)
{
KEYWORD("uncased well")
}
DOMAIN(dom1:NORMAL)
{
ANCESTOR(13769)// 13769: bore-hole, bore, borehole, drill hole
}
}
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.
Besides simple attributes, the OR
operator can be used to combine sequences and combination 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
LEMMA("abandoned") + TYPE(ADJ)
>>
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.