Closed mauralp closed 1 year ago
@mauralp According to the documentation of ilivalidator this should be possible with:
!!@ ilivalid.check = warning
MANDATORY CONSTRAINT NOT (((Behoerde == #Regierungsrat) OR (Behoerde == #Departement_fuer_Bau_und_Umwelt))
AND NOT (DEFINED (Nummer)));
If you don't want the error level hard coded in the INTERLIS model, you may use a config file for ilivalidator where you can adjust the error level dynamically. For examples see here.
DANKE! Thank you guys
The ilivalidator use a default name / Number for the constraint!
if i want to assign a new name a unique identifier to the constraint ; lets say:
!!@ ilivalid.nr = TG1001
This will make it easier to identify the specific constraint that triggered an error or warning in the validation log....
this syntax did not work
!!@ ilivalid.nr = TG1001 or i can write it
CONSTRAINT TG1001: MANDATORY NOT ((DEFINED(ID_OEREB_URL)) AND (NOT (DEFINED(Datum_Inkraftsetzung))));
or
!!@ ilivalid.check = warning;
CONSTRAINT Beschluesse.TG1001
FOR Beschluesse
WHERE (DEFINED(ID_OEREB_URL)) AND (NOT DEFINED(Datum_Inkraftsetzung))
WITH 'ID_OEREB_URL and Datum_Inkraftsetzung must be defined or undefined together';
or
CONSTRAINT TG1001 OF Beschluesse = MANDATORY NOT ((DEFINED(ID_OEREB_URL)) AND (NOT
(DEFINED(Datum_Inkraftsetzung))));
these all not work! CONSTRAINT
And i would like to order The Error and warnings depending of the name of the Constraint: (Like this)
log_file = """ Constraint A: Error message 1 Constraint B: Warning message 1 Constraint A: Warning message 2 Constraint C: Error message 2 """
logs = {} for line in log_file.strip().split('\n'): constraint, message = line.split(': ') if constraint in logs: logs[constraint].append(message) else: logs[constraint] = [message]
for constraint, messages in logs.items(): print(f"Constraint {constraint} has the following errors or warnings:") for message in messages: print(f"- {message}")
This should output the following: Constraint A has the following errors or warnings:
Is this possible??
At the moment it is like that: (depending of Lines) Error: line 242: Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse: tid ch13cw7k20lVjIkq: Unique constraint Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse.Constraint2 is violated! Values /api/geolinks/5690 already exist in Object: ch13cw7k20lViXNS Warning: line 242: Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse: tid ch13cw7k20lVjIkq: Mandatory Constraint Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse.Constraint8 is not true. Error: line 243: Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse: tid ch13cw7k20lVkfhw: Unique constraint Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse.Constraint2 is violated! Values /api/geolinks/5690 already exist in Object: ch13cw7k20lViXNS Warning: line 246: Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse: tid ch13cw7k3lsQm87Q: Mandatory Constraint Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse.Constraint8 is not true.
until Now it is: Mandatory Constraint Ortsplanung_Basis_TG06.Ortsplanung_Basis.Beschluesse.Constraint8
The ilivalidator use a default name / Number for the constraint! if i want to assign a new name a unique identifier to the constraint ; lets say: !!@ ilivalid.nr = TG1001 This will make it easier to identify the specific constraint that triggered an error or warning in the validation log.... this syntax did not work
You have to use
!!@ name = ...
For examples see https://github.com/sogis/ipw-validator/blob/main/model/2023-02-07/VSADSSMINI_2020_LV95_Validierung_IPW_20230207.ili
Yes sorry i saw it now in the ilivalidator Doc!!
I have another Question; I want to categorise the Error or split them between Error and Warning; So I did this:/ Ich habe eine weitere Frage; Ich möchte die Fehler kategorisieren oder sie in Fehler und Warnung aufteilen; Also habe ich dies vorgenommen: !!@ ccat="warning" MANDATORY CONSTRAINT NOT (((Behoerde == #Regierungsrat) OR (Behoerde == #Departement_fuer_Bau_und_Umwelt)) AND NOT (DEFINED (Nummer))); is this Possible in Ili validator or it should be define in The Function and i should say import Function? / ist dies möglich in Ili Validator oder es sollte in der Funktion definiert werden und ich sollte Import Funktion geben? thks maud