schematron-quickfix / sqf

Schematron Quick Fixes
25 stars 6 forks source link

Specify the Order of Activity Elements Execution #21

Open nkutsche opened 5 years ago

nkutsche commented 5 years ago

We need to add strict and stable rules to the spec to specify how more than one activity elements should be executed (order, dependenies, conflicts).

I wrote down a concept, how I think it should work. I think with these rules we get the most intuitive result. Please let me know how you think about it.

Action Order in sqf:fix

Basic principes

  1. Delete = empty replace.
  2. All actions should be executed based on the original source document
  3. Created nodes should be inserted once and no more been touched by other actions
  4. Inserted nodes should not have an effect on other actions
  5. A replacing can have the effect that other actions are skipped.
  6. The order of the actions should only have an effect at the result, if two actions are pointing to the same node.

Rules

  1. All nodes will get an unique ID (-> as meta data in XDM?).
    1. A copy of a node does not copy the ID
  2. Convert the XPaths (in match attribute) of the action elements into ID references
    1. An action will be executed only on the node with the referred ID
  3. Execute the actions in any order, only the following rules needs to be respected.
  4. If more than one action are pointing at the same anchor node:
    1. Handle the actions in this order:
      1. All add actions with position before or after
      2. All the replace action(s)
      3. Any other add action (skip if a replace exists, see 2.1.)
    2. If more than one add action are pointing at the same anchor node:
      1. Execute all, depending on the order of the actions elements and there position attribute (open discussion what this exactly means)
    3. If more than one replace action are pointing at the same anchor node, there is a conflict
  5. If more than one action create for the same element more than one attribute with same names, there is a conflict