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

Schematron checks on XSpec files to help with development #1654

Open
AlexJitianu opened this issue Sep 2, 2022 · 3 comments
Open

Schematron checks on XSpec files to help with development #1654

AlexJitianu opened this issue Sep 2, 2022 · 3 comments

Comments

@AlexJitianu
Copy link

AlexJitianu commented Sep 2, 2022

One of our common users (Oxygen + XSpec) developed Schematron/SQF rules to aid its XSpec authoring efforts. Unfortunately, he cannot provide the Schematron, but gave some details on the the things he validate and in most cases provide fixes for:

  • checks x:description@schematron is pointing to a file
  • checks that all x:expect-* @id values reference valid @id values from the Schematron file assert/report elements (QF allows selection from those ids)
  • check for correct expect type (assert or report) relative to the Schematron rule type (QF will update the expect element as required)
  • check test coverage for the Schematron rule ids. This lists Schematron @id values not covered by an expect and the same for those not covered by a expect-not.
  • warns if x:description@run-as is not set to 'external' (which I have found to cause problems that are difficult to troubleshoot - all I know is having this setting removes problems with tests running - not entirely sure why)

It's really easy to get some of things wrong by mistake and it can be really difficult for someone new to (or even experienced with) Xspec to catch them as in some cases you think tests are working but are not - unlike when the Xspec just doesn't run (which can be difficult to troubleshoot as you need to read/understand the stack trace - particularly the @run-as thing).

Those working extensively with XSpec or those actively involved in XSpec development have probably discovered other similar situations.

@galtm
Copy link
Collaborator

galtm commented Sep 4, 2022

This could be an extension of the work for #742 .

warns if x:description@run-as is not set to 'external'

I'm not sure if warning about non-external transformations is a good idea, though. External transformations are an experimental feature and are not suitable for all situations.

@AirQuick
Copy link
Member

AirQuick commented Oct 24, 2022

As @galtm suggested, we already have a Schematron + SQF which is integrated into Oxygen via a framework file. So any suggestions or pull requests for that file are welcome.

  • checks x:description@schematron is pointing to a file

4 years ago, I tried this sch:assert but it didn't work reliably on Oxygen at that time.

<sch:rule context="/x:description[@schematron]">
	<sch:let name="uri" value="resolve-uri(@schematron, base-uri())" />
	<sch:assert id="schematron-attribute-must-specify-schematron-file"
		test="
			if (doc-available($uri)) then
				doc($uri)/sch:schema
			else
				false()"
		><sch:name />/@schematron must specify Schematron file: <sch:value-of select="$uri"
		 /></sch:assert>
</sch:rule>

Maybe it was related to the document cache.

  • checks that all x:expect-* @id values reference valid @id values from the Schematron file assert/report elements (QF allows selection from those ids)
  • check for correct expect type (assert or report) relative to the Schematron rule type (QF will update the expect element as required)
  • check test coverage for the Schematron rule ids. This lists Schematron @id values not covered by an expect and the same for those not covered by a expect-not.

Those checks can be difficult when taking x:import and shared scenarios into consideration. But perhaps we can forget about it for now and consider implementing some of the checks as role="info".

@AirQuick
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants