From e8ff6765a4985000342c10d4fc6720e0abe881aa Mon Sep 17 00:00:00 2001 From: Renzo Kottmann Date: Wed, 18 Mar 2020 15:51:46 +0100 Subject: [PATCH 1/4] Translate to English --- .../kosit/validationtool/api/AcceptRecommendation.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/kosit/validationtool/api/AcceptRecommendation.java b/src/main/java/de/kosit/validationtool/api/AcceptRecommendation.java index 3d07933..c491201 100644 --- a/src/main/java/de/kosit/validationtool/api/AcceptRecommendation.java +++ b/src/main/java/de/kosit/validationtool/api/AcceptRecommendation.java @@ -1,21 +1,21 @@ package de.kosit.validationtool.api; /** - * Status der Empfehlung. + * Tri-state describtion of a Recommendation. */ public enum AcceptRecommendation { /** - * Nicht definiert, weil eine Evaluierung nicht durchgeführt wurde, oder nicht durchgeführt werden konnte. + * The evaluation of the overall validation could not be computed. */ UNDEFINED, /** - * Das Dokument ist gemäß Konfiguration valide und kann akzeptiert werden. + * Recommendation is to accept input based on the evaluation of the overall validation. */ ACCEPTABLE, /** - * Das Dokuemnt ist gemäß Konfiguration invalide und sollte NICHT akzeptiert werden. + * Recommendation is to reject input based on the evaluation of the overall validation. */ REJECT -} \ No newline at end of file +} From 7999fa179022c2b6730b7ad074e850479c9b99d9 Mon Sep 17 00:00:00 2001 From: Renzo Kottmann Date: Wed, 18 Mar 2020 15:52:37 +0100 Subject: [PATCH 2/4] Translate getAcceptRecommendation javadoc to English --- .../java/de/kosit/validationtool/api/Result.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/kosit/validationtool/api/Result.java b/src/main/java/de/kosit/validationtool/api/Result.java index 11dfa20..5581e29 100644 --- a/src/main/java/de/kosit/validationtool/api/Result.java +++ b/src/main/java/de/kosit/validationtool/api/Result.java @@ -9,7 +9,7 @@ import net.sf.saxon.s9api.XdmNode; /** * API Rückgabe Objekt des Ergebnisses des Validierungsprozesses. - * + * * @author Andreas Penski */ public interface Result { @@ -17,7 +17,7 @@ public interface Result { /** * Zeigt an, ob die Verarbeitung durch den Validator erfolgreich durchlaufen wurde. Diese Funktion macht ausdrücklich * keine Aussage über die zur Akzeptanz. - * + * * @return true, wenn die Verarbeitung komplett und erfolgreich durchlaufen wurde * @see #getAcceptRecommendation() */ @@ -25,7 +25,7 @@ public interface Result { /** * Gibt eine Liste mit Verarbeitungsfehlermeldungen zurück. - * + * * @return Liste mit Fehlermeldungen */ List getProcessingErrors(); @@ -36,7 +36,9 @@ public interface Result { XdmNode getReport(); /** - * Das evaluierte Ergebnis. + * The Recommendation based on the evaluation of this Result. + * + * @return AcceptRecommendation */ AcceptRecommendation getAcceptRecommendation(); @@ -62,21 +64,21 @@ public interface Result { /** * Liefert die Ergebnisse der Schematron-Prüfungen, in der Reihenfolge der Szenario-Konfiguration. - * + * * @return Liste mit Schematron-Ergebnissen */ List getSchematronResult(); /** * Liefert ein true, wenn keine Schema-Violations vorhanden sind. - * + * * @return true wenn Schema-valide */ boolean isSchemaValid(); /** * Liefert ein true, wenn der Prüfling eine well-formed XML-Datei ist. - * + * * @return true wenn well-formed */ boolean isWellformed(); From aa53eaea7311078f747055a43a812f759245c54f Mon Sep 17 00:00:00 2001 From: Renzo Kottmann Date: Wed, 18 Mar 2020 18:07:47 +0100 Subject: [PATCH 3/4] Add a little englisch foc to acceptMatch Element --- src/main/model/xsd/scenarios.xsd | 81 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/src/main/model/xsd/scenarios.xsd b/src/main/model/xsd/scenarios.xsd index 1b2f9d9..2f41a1f 100644 --- a/src/main/model/xsd/scenarios.xsd +++ b/src/main/model/xsd/scenarios.xsd @@ -1,4 +1,4 @@ - + - + - - - - - - + + + + + + - + - + - + - + - + - + @@ -68,72 +66,73 @@ - - - + + + - + - - - - - - - + + + + + + + + - - + + - + - - + + - + - + - + - + - - - - + + + + - + From fa1dbe75fdfba8ed8e9179a8611ce9a922ecd17c Mon Sep 17 00:00:00 2001 From: Renzo Kottmann Date: Wed, 18 Mar 2020 18:16:35 +0100 Subject: [PATCH 4/4] Add accept documentation about acceptRecommendation --- docs/api.md | 18 ++++++++++++++++++ docs/architecture.md | 10 ++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/api.md b/docs/api.md index 848741c..e537f83 100644 --- a/docs/api.md +++ b/docs/api.md @@ -89,3 +89,21 @@ Initializing all XML artifacts and XSLT-executables is expensive. The `Check` in The only input `de.kosit.validationtool.api.Input` which can be created by various methods of `de.kosit.validationtool.api.InputFactory`. The `InputFactory` calculates a hash sum for each Input which is also written to the Report. _SHA-256_ from the JDK is the default algorithm. It can be changed using the `read`-methods of `InputFactory`. + +## Accept Recommendation and Accept Match + +A tri-state Object `AcceptRecommendation` can be retrieved from the `Result` using `getAcceptRecommendation()`. + +The three defined states are: + +1. `UNDEFINED` i.e. the evaluation of the overall validation could not be computed. +2. `ACCEPTABLE` i.e. the recommendation is to accept input based on the evaluation of the overall validation. +3. `REJECT` i.e. the recommendation is to reject input based on the evaluation of the overall validation. + +By default it is `UNDEFINED`. + +### Accept Match in Scenario Configuration + +For your own configuration you can add an `acceptMatch` element in each scenario. It can contain in XPATH expression over your own defined `Report` to compute a boolean. An XPATH expression evaluating to true will lead to an `ACCEPTABLE` amd otherwise to a `REJECT` recommendation. + +This allows to have own control over what validation result is to be considered acceptable for your own application context. diff --git a/docs/architecture.md b/docs/architecture.md index fc9b2a2..18eb16c 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -13,9 +13,9 @@ the validation and generates a report in XML format. This report is then the inp The validator reports valid/invalid, a configuration reports acceptance/rejection! -## General process +## General default process -The general process is like this: +The general process is like this (the default is defined in `DefaultCheck`): ```mermaid @@ -30,6 +30,7 @@ sequenceDiagram e->>e: validate Schematron e->>e: create Validator Report e->>+c: execute configuration report generator + e->>e: Compute Recommendation ``` @@ -50,3 +51,8 @@ sequenceDiagram 6. *execute configuration report generator* The Validator will search for the XSLT as configured in scenario.xml and execute it with the Validator Report as input +7. compute Recommendation + + In case a scenario contains an `acceptMatch` element with an XPATH expression, this expression will be executed. + + In case the XPATH returns `true`, the recommendation will be set to `ACCEPT` else to `REJECT`. In case no such XPATH is defined it is `UNDEFINED`.