Банки: блокиране на рискови преводи
Три правила по реда на приоритета: висока сума или чувствителна държава правят превода рисков, а рисковият превод се блокира. Правилата са разбираеми за отдела по съответствие.
Резултат, получен на сървъра: преводът от 15 500 € към Кайманови острови е блокиран, а този от 820 € остава в изчакване.
$Banque = [ontology:define "Banque_Securite"
[ontology:class Virement
[attributes
[montant Float [required true]]
[pays_destination String [default "France"]]
[niveau_risque String [default "FAIBLE"]]
[statut String [default "EN_ATTENTE"]]]]]
[ontology:rule "MontantEleve" $Banque [target "Virement"] [priority 100]
[when ($this.montant > 10000)]
[then [ontology:set $this "niveau_risque" "ELEVE"]]]
[ontology:rule "PaysSensible" $Banque [target "Virement"] [priority 90]
[when ($this.pays_destination == "Iles Caimans")]
[then [ontology:set $this "niveau_risque" "ELEVE"]]]
[ontology:rule "Blocage" $Banque [target "Virement"] [priority 10]
[when ($this.niveau_risque == "ELEVE")]
[then [ontology:set $this "statut" "BLOQUE"]]]
[ontology:commit [new Virement [montant 15500] [pays_destination "Iles Caimans"]]]
[ontology:commit [new Virement [montant 820]]]
[ontology:infer-fixpoint $Banque 10]
[ontology:select $Banque "Virement" [statut "BLOQUE"]]