Schematron / schematron-enhancement-proposals

This repository collects proposals to enhance Schematron beyond the ISO specification
9 stars 0 forks source link

pattern/@document should allow variable that is a document #63

Open rjelliffe opened 1 year ago

rjelliffe commented 1 year ago

At the moment, sch:pattern/@documents takes a list of IRIs, or string variables.

I propose that it shoukd also allow variables names that are documents.

For example, at its simplest: '''

< x/> ... ''' This would address three issues: 1. The document could be selected by an Xpath, allowing use of document-available() for better fallback. For example, if the extetnal document is not available, the variable is a document with a fallback element < no-doc/> which can then have a rule/report in the pattern so the SVRL reflects that no document was found. 2. The document could be JSON parsed by the XPath3 functiom, or csv parsed by some function provided, or constructed ftom multiple inputs 3. There would be no risk that if multiple patterns validate the same @document, that document gets read in multiple times. I don't think this would be hard to implement: iterate over each token, if the token does not start with $ treat it as an IRI, else if it starts with $ then check if the variable's contains a document() and use that, else take the string value of the variable as an IRI. Rick
dmj commented 1 year ago

At the moment, sch:pattern/https://github.com/documents takes a list of IRIs, or string variables.

I think this is not correct: The @‍documents attribute contains an expression that evaluates to a sequence of IRIs. The envisioned use-case for @‍documents is a manifest file that enumerates a list of other files. If the files are e.g. referenced by an &lt;link&gt; element with an @‍href attribute, then &lt;pattern documents="link/@‍href"&gt; would return the sequence of IRIs of the documents you want to validate.