You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Split into separate statements. For every statement:
Replace Apath shorthand notation with xpath: [id1] to [@archetype_node_id = ‘id1’], etc.
Replace symbolic form of operators with the textual form
Replace for_all … In … … with ‘every $var in /path satisfies …’
Replaces implies with ‘if … then …’
Replace exists(expression) with count(expression) > 0
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.
The text was updated successfully, but these errors were encountered:
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
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:
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.
The text was updated successfully, but these errors were encountered: