Skip to content

MANDATORY

The MANDATORY operator is used to write sub-conditions that must trigger in a rule. This allows you to write a minor number of rules—or longer ones—each one triggering with more sentences that would normally require a higher number of rules.

For example:

SCOPE SENTENCE
{
    IDENTIFY(PERSONAL_DATA)
    {
        @Name[TYPE(NPH)]
        <1:3>
        LEMMA("live", "have")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        MANDATORY
        {
            @Location_of_house[LEMMA("beach", "woods", "forest")],
            @Location_of_house[ANCESTOR(100179164)], //unitary state,
            LEMMA("city centre", "city center")
            <1:3>
            @Location_of_house[SYNCON(12631236, 100001781)]//@SYN: #12631236# [London] //@SYN: #100001781# [Budapest]
        }
    }
}

Note

If the MANDATORY operator is introduced by sequences or operators, they will have to be inserted outside parenthesis. If such operator is succeded by sequences or operators, they will have to be inserted outside parenthesis.

The extraction rule above will trigger, if run against the following texts:

John has a big villa in the city center of Budapest.
John has a big villa in the woods.
John has a big villa in Italy.

Such sentences would normally require either three almost identical rules, with the only difference lying in the @Location_of_house field, like the following case:

SCOPE SENTENCE
{
    IDENTIFY(PERSONAL_DATA)
    {
        @Name[TYPE(NPH)
        <1:3>
        LEMMA("live", "have")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        @Location_of_house[LEMMA("beach", "woods", "forest")]
    }

    IDENTIFY(PERSONAL_DATA)
    {
        @Name[TYPE(NPH)
        <1:3>
        LEMMA("live", "have")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        @Location_of_house[ANCESTOR(100179164)] //unitary state
    }

    IDENTIFY(PERSONAL_DATA)
    {
        @Name[TYPE(NPH)
        <1:3>
        LEMMA("live", "have")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        @Location_of_house[SYNCON(12631236, 100001781)]//@SYN: #12631236# [London] //@SYN: #100001781# [Budapest]
    }
}

or an extremely long rule with more OR operators, like the following case:

SCOPE SENTENCE
{
    IDENTIFY(PERSONAL_DATA)
    {
        @Name[TYPE(NPH)]
        <1:3>
        LEMMA("have", "live")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        @Location_of_house[LEMMA("beach", "woods", "forest")]
        OR
        @Name[TYPE(NPH)]
        <1:3>
        LEMMA("have", "live")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        @Location_of_house[ANCESTOR(100179164)] //unitary state
        OR
        @Name[TYPE(NPH)]
        <1:3>
        LEMMA("have", "live")
        <1:4>
        @Type_of_house[LEMMA("house", "flat", "villa", "shotgun house")]
        <1:3>
        @Location_of_house[SYNCON(12631236, 100001781)]//@SYN: #12631236# [London] //@SYN: #100001781# [Budapest]
    }
}

The syntax for writing a MANDATORY statement is the follwing:

operand
sequence/operator
MANDATORY
{
    sub-condition
}
...

where MANDATORY is in uppercase and can be placed wherever you need it in the rule.

There are a few things to remark in terms of functionalities of this operator:

  • It is possible to use the same field multiple times.
  • It is possible to insert a comma at the end of each field, as you can see in the example above. The comma acts like an OR operator between the MANDATORY statements.
  • Unlike the OPTIONAL operator, it is possible to introduce the MANDATORY operator with boolean operators.