Research · Ontologies & business rules

The company's rules, written once and applied exactly

An ontology describes what the company deals with: its objects, their attributes, their links and the rules that apply to them. In VAILS, it is not a design document: it runs. Documents are transcribed into it, business rules apply to it, and it can be queried or checked for consistency at any time.

How it works

An ontology is declared with classes, typed and constrained attributes (mandatory, bounds, closed list of values, inheritance) and relations. It is compiled into logical rules, in a knowledge base specific to the ontology and to the session.

Data reaches it in three ways: extracted from a text or an image by the language model, guided by the schema; created directly by the program; or produced by an optimization run. Business rules are written with a condition, an action and a priority; inference applies them until nothing changes any more. The ontology is then queried with filters, or in natural language.

  1. Declare
  2. Populate
  3. Apply the rules
  4. Query and check

Business examples

Banking: blocking risky transfers

Three rules, in order of priority: a high amount or a sensitive country makes the transfer risky, and a risky transfer is blocked. The rules are readable by the compliance department.

$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"]]

Result obtained on the server: the €15,500 transfer to the Cayman Islands is blocked, the €820 one remains pending.

Recruitment: a chain of rules

A first rule sets the level from experience; a second decides from the level and the score. Inference chains the two.

$RH = [ontology:define "RH_Tri"
    [ontology:class Candidat
        [attributes [nom String [required true]] [experience Integer [min 0]]
                    [score Integer [min 0] [max 100]]
                    [niveau String [default "JUNIOR"]] [decision String [default "A_ETUDIER"]]]]]
[ontology:rule "NiveauSenior" $RH [target "Candidat"] [priority 100]
    [when ($this.experience >= 7)]
    [then [ontology:set $this "niveau" "SENIOR"]]]
[ontology:rule "Accepte" $RH [target "Candidat"] [priority 10]
    [when (($this.niveau == "SENIOR") && ($this.score >= 70))]
    [then [ontology:set $this "decision" "ACCEPTE"]]]
[ontology:commit [new Candidat [nom "Marie"] [experience 9] [score 82]]]
[ontology:commit [new Candidat [nom "Paul"] [experience 9] [score 55]]]
[ontology:commit [new Candidat [nom "Lea"] [experience 3] [score 90]]]
[ontology:infer-fixpoint $RH 10]
[ontology:select $RH "Candidat" [decision "ACCEPTE"]]

Result obtained on the server: only Marie is accepted; Paul is senior but his score is too low, Léa is not yet senior.

Purchasing: checking supplier data quality

Before paying or listing a supplier, the ontology checks that mandatory fields are present and that values stay within their bounds. This check is purely symbolic.

$Four = [ontology:define "Fournisseurs"
    [ontology:class Fournisseur
        [attributes [raison_sociale String [required true]] [siret String [required true]]
                    [note_qualite Integer [min 0] [max 20]]]]]
[ontology:commit [new Fournisseur [raison_sociale "Alpha SARL"] [note_qualite 25]]]
[ontology:consistent $Four]

Result obtained on the server: two blocking violations, the missing company registration number and a quality score of 25 for a maximum of 20.

Orders: mapping a free value to the catalogue

The colour and size of a window only accept catalogue values. When the customer writes anthracite or large format, extraction maps the value to the right label by meaning.

$menuiserie = [ontology:define menuiserie
    [ontology:class Fenetre [attributes
        [reference String]
        [couleur String [in_values "Blanc 9010" "Gris 7016" "Brun 8019" "Noir 9005"]]
        [taille String [in_values "S" "M" "L" "XL"]]]]]
$f = [ontology:fromText $menuiserie "Fenetre" "Commande REF-001 : fenetre coulissante, profil couleur anthracite, grand format (large)."]
[print $f.couleur]     # Gris 7016
[print $f.taille]      # L

Quotes: extracting a scanned document

A PDF quote is turned into images, then transcribed into the schema, including its table of lines. Amounts arrive typed, ready to be checked by rules.

[ontology:class Devis
    [attributes
        [numero String [key true]]
        [date Date]
        [client Client]
        [lignes List [of LigneDevis]]      # déclenche l'extraction du tableau
        [total_ht Currency]
        [taux_tva Number]
        [total_ttc Currency]]]
$images = [pdfToImages $fichier_pdf 2.0]
$devis  = [ontology:fromImage $DevisSystem "Devis" $images]

Rules written by business teams

Rules can also be written in Gherkin, the format of test scenarios, then automatically turned into an executable ontology.

$source = "
Feature: SecurityRules
  Background: Schema
    Given I define an ontology named 'BankSystem'
    And I define a class 'Transaction' with attributes:
    | Name   | Type    | Default   |
    | amount | Integer | 0         |
    | status | String  | 'Pending' |

  @priority: 100
  Scenario: High Value Rule
    Given a 'Transaction' context
    When 'amount' is greater than 1000
    Then set 'status' to 'HighRisk'
"
$Ontologie = [evaluate [ontology:loadGherkin $source]]

What it guarantees, and its limits

  • Rules apply exactly and reproducibly, in order of priority, until stable.
  • Consistency is checked without a language model: mandatory fields, bounds, value lists, cardinalities.
  • Each session has its own ontologies; keeping them beyond the session is done explicitly, by saving them in the workspace.
  • Extraction from a text or an image goes through the language model; ontological contracts make it possible to validate it and retry it when it deviates.

Apply this work to your processes?

The diagnosis starts from how you actually work and identifies the decisions that can be entrusted to AI.

Chat with us on WhatsApp