tosca-community-contributions icon indicating copy to clipboard operation
tosca-community-contributions copied to clipboard

Change TOSCA Path relationship traversal semantics

Open lauwers opened this issue 2 years ago • 1 comments

The current draft of the TOSCA v2.0 spec states the following with respect to node and relationship indices:

Note that both the indexes can either be a non-negative integer, the keyword ALL, or missing. If it is a non-negative integer, 0 represents the first index and so on incrementally. If the index is missing, the semantic meaning is that the first index (index with value 0) is used. If it is the keyword ALL, then we return the result for all possible indices (further resolved separately) as a list. If the there are multiple ALL keywords in the definition, then all the results shall be merged into a single list.

I propose to change the semantics such that if the index is missing, the meaning is that all the nodes or all the relationships are specified. This feels more natural and less arbitrary, and is more consistent with the "entity referral" interpretation of TOSCA Path. It is also more consistent with the use of lists in programming languages, where the name of a list without an index refers to the entire list rather than to the first element in the list.

lauwers avatar Oct 27 '23 20:10 lauwers

Alternatively, we could take count_range into account to determine the default:

  • if the upper bound of count_range is 1, then the default is to return the single element with index 0
  • if the upper bound of count_range is greater than 1, then the default is to return the entire list

lauwers avatar Oct 27 '23 20:10 lauwers