Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attribute named e.g. 'severity' to schematron with well defined semantics for reporting severity levels #58

Open
rkottmann opened this issue Jun 1, 2023 · 8 comments
Labels
2025 A change made in preparing the 2025 edition

Comments

@rkottmann
Copy link

One major technical use case of schematron is to validate and report errors and severity levels to the users. Very often the role and flag attributes are used to communicate the severity level of an assertion or report etc.

However, the role and flag attributes are defined with very open semantics and are not restricted to severity levels. Which leaves a lot of uncertainty of how validators (or SVRL processors) interprete intended reporting of severity levels.

A possible backwards compatible solution would be to introduce a new attribute e.g. named severity which strictly defines possible severity levels to be reported. E.g. https://schematron.com/standards/[email protected] or as defined by XVRL. The would leave the role and flag attributes untouched and improve the usablity of schematron in many business use cases like e.g. standard conformance testing.

@rjelliffe
Copy link
Member

rjelliffe commented Jun 1, 2023 via email

@AndrewSales
Copy link
Collaborator

I agree. I think severity could well go straight in as @rkottmann suggests, but we'll see what flies.

@xatapult
Copy link
Collaborator

xatapult commented Jun 7, 2023

I agree as well.

@rjelliffe
Copy link
Member

rjelliffe commented Jun 7, 2023 via email

@rkottmann
Copy link
Author

rkottmann commented Jun 7, 2023

hi,

I am thinking in the same direction as @rjelliffe . My thinking is that @Severity is not only a backwards compatible solution to the above problem statement but also a nice complement to @ROLE and/or @Flag.

E.g. <sch:assert role="car-check-and-give-hints" severity="warning" ... />The car could be stolen. Please check.</assert> or <sch:assert role="car-check-not-acceptable-findings-in-document, statistics-check" severity="fatal" ... />The numbers do not add up. Cars must have been stolen. Please inform the police.</assert>

IMHO one might consider to only use one severity level per assert/report for the sake of clarity and simplicity. But @ROLE - as open as it is - can be used for groupings and "can be anything, including localized
versions". Also in no single programming language and logging system, I have ever seen more than one severity level per statement. So allowing multiple token would significantly deviate from common sense.

That said, I fully agree on the requirement that a defined list should be extensible for local Schematron use, so that users can add own defined severity levels in addition to the well defined ones. One possible solution is to have an additional token like other: and allow other:self-defined-severity-level with e.g. a regex error|tip|hint|...|other:.*

Then, if I were to be an author of a Schematron application and in need of own defined severity levels, I would write an own Schematron rule to perform an additonal check on my Schematron which I need to develop. Such a rule could be paraphrased as if @severity starts with other: then only allow other:good-suggestion or other:dismiss-this-idea.

@rjelliffe
Copy link
Member

rjelliffe commented Jun 8, 2023 via email

@rjelliffe
Copy link
Member

rjelliffe commented Jun 8, 2023 via email

@AndrewSales
Copy link
Collaborator

AndrewSales commented Feb 10, 2024

As a starting point for this new feature, I think it makes sense to start in a relatively contained way.

I like @rjelliffe 's suggestion to specify a small-ish set of values, but also to leave the set open-ended. This means we have commonly or widely used values at the core, while also allowing user-defined ones: the best of both worlds.

I will say I don't think there is much mileage in specifying the meaning of the core set of values closely, for three reasons:

  1. defining some values within an open-ended set conveys, roughly speaking, "here are some that you might find useful" and provides a potential baseline of interpretation across schemas and the output/SVRL produced when validating against them
  2. by allowing user-defined values, the semantics of the core set becomes less easy or worthwhile to define: a schema author may choose to use none from the core specified set (or no severities at all, for that matter)
  3. a conformant implementation determines whether a document is valid to the schema and validity means passing all the assertions in force. It seems to me that we would have to change that definition if we start to say e.g. only severities of fatal and error connote invalidity, to say nothing of how to handle user-defined values. Schematron's gift to validation is the interpretative step beyond a simple pass/fail, and a (human/machine) operation on SVRL output is one means to gauge "how valid" a document is.

Overall, it will still be a step forward to have a specific place in the language for this information, distinct from @role and @flag, as @rkottmann mentions.

@AndrewSales AndrewSales added the 2025 A change made in preparing the 2025 edition label Feb 10, 2024
AndrewSales added a commit to Schematron/schema that referenced this issue Feb 11, 2024
…proposals#39

extends available at top level, enabling import of library etc
new element rules to group abstract rules, re Schematron/schematron-enhancement-proposals#3 and Schematron/schematron-enhancement-proposals#39
new element group for rule processing without if-then-else behaviour, re Schematron/schematron-enhancement-proposals#25
new attribute severity, re Schematron/schematron-enhancement-proposals#58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2025 A change made in preparing the 2025 edition
Projects
None yet
Development

No branches or pull requests

4 participants