Skip to content

Expression language: closely related to xpath. perhaps link to their specs? #4

Description

@pieterbos

The expression language is closely related to xpath. We could link to their specs at https://www.w3.org/TR/xpath/ or https://www.w3.org/TR/xpath20/ or https://www.w3.org/TR/xpath-30/ in several places. It would be nice to make this link explicit, for ease of implementation and validation of the specs.

We could also show how you can make a relatively easy conversion to valid xpath. Then you can use either the grammar for parsing, or evaluate the language by applying the xpath conversion, then running on an existing xpath conversion.

To do this, you would currently need to do something like this:

  1. Split into separate statements. For every statement:
  2. Replace Apath shorthand notation with xpath: [id1] to [@archetype_node_id = ‘id1’], etc.
  3. Replace symbolic form of operators with the textual form
  4. Replace for_all … In … … with ‘every $var in /path satisfies …’
  5. Replaces implies with ‘if … then …’
  6. Replace exists(expression) with count(expression) > 0
  7. replace matches {...} with a custom defined function implementing this functionality, and change the syntax

Then, get an Xpath implementation that works on your reference model, or just convert to XML first. Then for every assertion, evaluate the expression to a boolean. For every variable declaration, evaluate the expression to the type given in the variable declaration and store it under the given name.
Then implement the standard functions and variables defined in the expressions spec. Some will already be present, like sum() and count(). Functions and variables are part of standard Xpath, and so is defining your own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions