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

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

Open
pieterbos opened this issue Jul 5, 2016 · 0 comments

Comments

@pieterbos
Copy link

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.

@pieterbos pieterbos changed the title expression language: closely related to xpath. perhaps link to their specs? Expression language: closely related to xpath. perhaps link to their specs? Jul 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant