Skip to content

AND operator

A combination of two expressions made with the AND operator is true if both the expressions are matched anywhere within the scope of the rule.

Consider the following example:

SCOPE SENTENCE
{
    DOMAIN(dom1:NORMAL)
    {
        LEMMA("abandon")
        AND
        LEMMA("oil well")
    }
}

The rule's condition is the combination of two LEMMA attributes. It will match the portion of input text delimited by rule's scope, if it contains at least a token having its lemma attribute set to abandon and at least another token with its lemma attribute set to oil well.

Consider this text:

Improperly abandoned oil wells, improperly abandoned facilities and abandoned oil sumps are all potential sources of safety hazards.

The sentence contains:

abandoned = lemma "abandon", three times
oil wells = lemma "oil well", one time

so it matches the rule's condition three times, the first time because of the first abandoned and the only oil wells, the second time because of the second abandoned and the only oil wells and the third time because of the third abandoned and the only oil wells.
This means that the rule is triggered three times, the rule's action is performed three times and a NORMAL quantity of points (e.g., 60) is added to dom1 domain's cumulative score three times.

In the following rule:

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

AND is used to combine a strict positional sequence with the concepts that descend from an "ancestor" concept.

If run against the following sample text:

Temperature Distribution Around an Uncased Well with a History of Variations in Wellbore Temperature

the condition is met because meaning of Well disambiguation matches the ANCESTOR attribute.

The AND operator can be used to combine positional sequences and combinations of attributes. The extraction rule below shows the AND operator used with combinations of attributes.

SCOPE PHRASE (NP)
{
    IDENTIFY(TEST)
    {
        @Well[LEMMA("well") + TYPE(NOU)]
        AND
        @Depth[ANCESTOR(58535) + SYNCON(UNKNOWN)] // linear measure, linear unit, long measure
    }
}

The first operand will match the lemma well, only if it's a noun (well is also an adverb, a verb and even an adjective), the second operand will match any type of linear measure, only if it is an unknown entity, that is an entity which is not inside the knowledge graph, but was assigned a virtual supernomen by the disambiguator.
The condition must be met in the scope of a noun phrase. If the rule above is run against the following text:

Repsol, in partnership with CGX, Tullow and YPF, is drilling a 6,500-metre well (21,000-feet) in the Guyana Basin that experts claim could hold 15 billion barrels of oil and 42 trillion cubic feet (1.2 trillion cubic metres) of natural gas.

it is triggered by 6,500-metre (a virtual child of syncon 58808, meter, which in turn is a child of syncon 58535, linear measures) and the noun well, both of which are found within the same noun phrase a 6,500-metre well.
21,000-feet is also a virtual child of syncon 58835 and thus a potentially valid value for the second attribute, but the noun phrase in which it is located does not contain the noun well.

The syntax of the AND operator is:

expression
AND
expression

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