# NAME s1kd-appcheck - Validate applicability of S1000D CSDB objects # SYNOPSIS s1kd-appcheck [options] [...] # DESCRIPTION The *s1kd-appcheck* tool validates the applicability of S1000D CSDB objects, detecting potential errors that could occur when the object is filtered. By default, the tool validates an object against only the product attribute and condition values which are explicitly used within the object. The products check (-t) and full check (-a) modes allow objects to be checked for issues with implicit applicability, that is, product attribute or condition values which are not explicitly used within an object, but may still affect it. The s1kd-instance and s1kd-validate tools are used by default to perform the actual validation. # OPTIONS - \-A, --act \ Specify the ACT to read product attributes from, and to use to find the CCT or PCT. This will override the ACT reference within the individual objects being validated. - \-a, --all Validate objects against all possible combinations of relevant product attribute and condition values as defined in the ACT and CCT. Relevant product attributes and conditions are those that are used by an object with any value. - \-b, --brexcheck Validate objects with a BREX check (using the s1kd-brexcheck tool) in addition to the schema check. - \-C, --cct \ Specify the CCT to read conditions from. This will override the CCT reference within the ACT. - \-c, --custom Perform a customized check. The default standalone applicability check is disabled. This can then be combined with the -s option, to only check that all product attributes and conditions are defined in the ACT and CCT respectively, and/or the -n option, to only check nested applicability annotations. If neither of these options are specified, no checks will be performed. - \-D, --duplicate Check for duplicate annotations. - \-d, --dir \ The directory to start searching for ACT/CCT/PCT data modules in. By default, the current directory is used. - \-e, --exec \ The commands used to validate objects. Multiple commands can be used by specifying this option multiple times. The objects will be passed to each command on stdin, and the exit status of the command will be used to determine if the object is valid (with a non-zero exit status indicating it is invalid). This overrides the default commands (s1kd-validate, and s1kd-brexcheck if -b is specified). - \-F, --valid-filenames Print the filenames of valid objects. - \-f, --filenames Print the filenames of invalid objects. - \-h, -?, --help Show help/usage message. - \-K, --filter \ The command used to filter objects prior to validation. The objects will be passed to the command on stdin, and the filters will be supplied as arguments in the form of "`-s :=`". This overrides the default command (s1kd-instance). - \-k, --args \ The arguments to the filter command when filtering objects prior to validation. - \-l, --list Treat input as a list of CSDB objects to validate. - \-N, --omit-issue Assume that the issue/inwork numbers are omitted from object filenames (they were created with the -N option). - \-n, --nested Check that all product attribute and condition values used in nested applicability annotations are subsets of the values used in their parents. - \-o, --output-valid Output valid CSDB objects to stdout. - \-P, --pct \ Specify the PCT to read product instances from. This will override the PCT reference in the ACT. - \-p, --progress Display a progress bar. - \-q, --quiet Quiet mode. Error messages will not be printed. - \-R, --redundant Check for redundant annotations. - \-r, --recursive Search for the ACT/CCT/PCT recursively. - \-s, --strict Check whether product attributes and conditions used by an object are declared in the ACT and CCT respectively. - \-T, --summary Print a summary of the check after it completes, including statistics on the number of objects that passed/failed the check. - \-t, --products Validate objects against the defined product instances within the PCT. - \-v, --verbose Verbose output. Specify multiple times to increase the verbosity. - \-x, --xml Print an XML report of the check. - \-\~, --dependencies Check with CCT dependency tests added to assertions which use the dependant values. - \-^, --remove-deleted Validate objects with elements that have a change type of "delete" removed. - \--version Show version information. - \--zenity-progress Print progress information in the zenity --progress format. - \... Object(s) to validate. In addition, the following options allow configuration of the XML parser: - \--dtdload Load the external DTD. - \--huge Remove any internal arbitrary parser limits. - \--net Allow network access to load external DTD and entities. - \--noent Resolve entities. - \--parser-errors Emit errors from parser. - \--parser-warnings Emit warnings from parser. - \--xinclude Do XInclude processing. - \--xml-catalog \ Use an XML catalog when resolving entities. Multiple catalogs may be loaded by specifying this option multiple times. # EXIT STATUS - 0 The check completed successfully, and all CSDB objects were valid. - 1 The check completed successfully, but some CSDB objects were invalid. - 2 One or more CSDB objects could not be read. - 3 The number of CSDB objects specified exceeded the available memory. - 4 The commands used to filter and/or validate objects failed to be executed. # EXAMPLES ## Standalone validation Consider the following data module snippet: ... Version: A or Version: B ... ... Features of version B ... ... More information ... Refer to . ... There are two versions of the product, A and B, and the data module is meant to apply to both. By itself, the data module is valid: $ s1kd-validate -v s1kd-validate: SUCCESS: validates against schema Checking it with this tool, however, reveals an issue: $ s1kd-appcheck s1kd-appcheck: ERROR: is invalid when: s1kd-appcheck: ERROR: prodattr version = A When the data module is filtered for version A, the first levelled paragraph will be removed, which causes the reference to it in the second levelled paragraph to become broken. ## Full validation Consider the following data module snippet: ... All ... ... Locate the handle. Put on gloves prior to touching the handle. Grab the handle and turn it clockwise. ... Remove the gloves you put on in . ... Once again, this data module is valid by itself: $ s1kd-validate -v s1kd-validate: SUCCESS: validates against schema This time, however, it also initially appears valid when this tool is used: $ s1kd-appcheck -v s1kd-appcheck: SUCCESS: passed the applicability check. However, now consider this snippet from the CCT: ... Weather type Possible types of weather conditions. ... Weather The current weather conditions. ... There is a third value for the `weather` condition which is not explicitly used within the data module, and therefore will not be validated against in the default standalone check. When `weather` has a value of `Normal`, the cross-reference in the last step in the example above becomes broken. To catch errors with implicit applicability, the full check (-a) can be used instead, which reads the values to check not from the data module itself, but from the ACT and CCT referenced by the data module: $ s1kd-appcheck -a s1kd-appcheck: ERROR: is invalid when: s1kd-appcheck: ERROR: condition weather = Normal This can also be fixed by making the applicability of the data module explicit: Weather: Normal or Weather: Icy or Weather: Hot In which case, the standalone check will now also detect the error: $ s1kd-appcheck s1kd-appcheck: ERROR: is invalid when: s1kd-appcheck: ERROR: condition weather = Normal ## Nested applicability annotations Consider the following data module snippet: ... Version: A, B ... Version: C ... Step A Step B Step C ... Here, the whole data module is applicable to versions A and B, but an individual step has been made applicable to version C. Normally, this is not reported as an error, since the removal of this step would not cause the data module to become invalid: $ s1kd-appcheck -v s1kd-appcheck: SUCCESS: passed the applicability check However, the content is essentially useless, since it will never appear. The -n option will report when the applicability of an element is incompatible with the applicability of any parent elements or the whole object: $ s1kd-appcheck -n s1kd-appcheck: ERROR: : proceduralStep on line 62 is applicable when prodattr version = C, which is not a subset of the applicability of the whole object. ## Redundant applicability annotations Consider the following data module snippet: Step A
...
This is technically correct, but the annotation on the figure can be considered redundant, since it has the same applicability as its ancestor, and the applicability of an element is already inherited by all its descendants automatically. The -R (--redundant) option will report when the applicability of a nested element is redundant: $ s1kd-appcheck -R s1kd-appcheck: ERROR: : figure on line 85 has the same applicability as its parent proceduralStep on line 83 (app-A)
Currently, this check only detects when the exact same annotation (with the same ID) is nested within itself. In the future, this should also detect redundant logic between different nested annotations.
## Duplicate applicability annotations Consider the following data module snippet: These annotations have duplicate logic, meaning only one is necessary. The -D (--duplicate) option will report when an applicability annotation is a duplicate of another annotation: $ s1kd-appcheck -D s1kd-appcheck: ERROR: : Annotation on line 47 is a duplicate of annotation on line 24.