Skip to content

AND NOT operator

AND NOT is the Boolean operator that allows users to combine attributes, two at a time, to create Boolean expressions that will be true, if the first operand is true and the second operand is false.

Syntax is:

operand1
AND NOT
operand2
...

where:

  • AND NOT 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)
    {
        ANCESTOR(134210) // 134210: well
        AND NOT
        LEMMA("abandon") 
    }
}

The rule's condition is the combination of an ANCESTOR attribute and a LEMMA attribute. It will match the portion of input text delimited by the rule's scope, if it contains at least a token descending from syncon 134210 and it does not contain the lemma abandon.

Consider this text:

There are about 603 fields in the Niger Delta. Over 55 per cent of these are onshore, while the remaining is in the shallow waters (less than 500 meters). Of these fields, 193 are currently producing while 23 have either been closed down or abandoned. Across the Niger Delta, abandoned drill locations (including well stubs) numbering well over several tens of thousands.
A large number of exploratory wells were drilled on land, swamp and offshore locations.

The fifth sentence contains exploratory wells, a child of syncon 134210 and it does not contain occurrences of the lemma abandon so the rule can trigger and a NORMAL quantity of points (e.g., 60) is added to dom1 domain's cumulative score.

The fourth sentence contains a match for the ANCESTOR attribute (well), but since this same sentence also contains the verb form abandoned, the rule's condition is not met.

Combined attributes can have more than one value. Compare the first sample rule with the following:

SCOPE SENTENCE
{
    DOMAIN(dom1:NORMAL)
    {
        LEMMA("well", "field", "exploratory well")
        AND NOT
        LEMMA("abandon", "close down")
    }
}

Run against the same sample text, the rule is triggered twice, because the first sentence contains fields, the last sentence contains exploratory wells and both sentences do not contain occurrences of the lemma abandon or the lemma close down.

The other sentences contain fields and well, matched by the first attribute, but since the same sentence also contains, respectively, closed down and abandoned, matched by the second attribute, the rule will not trigger.

If the rule's scope is narrower, as in:

SCOPE CLAUSE
{
    DOMAIN(dom1:NORMAL)
    {
        LEMMA("well", "field", "exploratory well")
        AND NOT
        LEMMA("abandon", "close down")
    }
}

the rule will be triggered three times, because of the third sentence, where fields is matched by the first attribute and the clause in which the token is located does not contain occurrences of the lemmas close down or abandon.

In the following extraction rules:

SCOPE SENTENCE
{
    IDENTIFY(TEST)
    {
        LEMMA("offshore")
        <1:4>
        @OffShoreField_gas[TYPE(NPR)]|[TEXT]
        <1:4>
        LEMMA("discovery")
        AND NOT
        ANCESTOR(64566) + TYPE(NOU)//  64566: petroleum, rock oil, fossil oil, oil, black gold
    }

    IDENTIFY(TEST)
    {
        LEMMA("offshore")
        <1:4>
        @OffShoreField_oil[TYPE(NPR)]|[TEXT]
        <1:4>
        LEMMA("discovery")
        AND NOT
        ANCESTOR(64471) + TYPE(NOU)//  64471: natural gas, gas
    }
}

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

If run against the following sample text:

The offshore Tuui and Maari discoveries are predominantly oil. The basin remains under-explored compared to many comparable rift complex basins of its size and there remains considerable potential for further discoveries.

the second rule will be triggered twice, extracting Tuui and Maari in the @OffShoreField_oil field; the first rule is not triggered, because its conditions ask for the lemma offshore, a proper noun and the lemma discovery in the same sentence at a certain maximum distance from each other (and the first sentence has them all), but does not "tolerate" the presence of oil, a concept which descends from ancestor syncon 64566.