diff options
author | Rudrangi Anupriya <ra00745022@techmahindra.com> | 2023-04-25 13:13:16 +0530 |
---|---|---|
committer | Rudrangi Anupriya <ra00745022@techmahindra.com> | 2023-04-25 21:45:40 +0530 |
commit | c58a0f44bb4c7ea26143371fbe04a01974507e1c (patch) | |
tree | 9711550936276caf2f92cd9256e84cb158fb89e2 /docs | |
parent | 2de9389a61f0feb37f0bcc22d6269e36dcfbd47c (diff) |
Ordering of leaf elements to support combination of AND/OR in cps-path
Issue-ID: CPS-1629
Change-Id: Ib9df87e8171f4d53c49d80d27e3c6cf75aa3b209
Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/cps-path.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/cps-path.rst b/docs/cps-path.rst index f321adfa99..252310dc0c 100644 --- a/docs/cps-path.rst +++ b/docs/cps-path.rst @@ -1,6 +1,7 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 .. Copyright (C) 2021-2022 Nordix Foundation +.. Modifications Copyright (C) 2023 TechMahindra Ltd .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING .. _path: @@ -222,7 +223,7 @@ descendant-path leaf-conditions --------------- -**Syntax**: ``<xpath> '[' @<leaf-name1> '=' <leaf-value1> ( ' and ' @<leaf-name> '=' <leaf-value> )* ']'`` +**Syntax**: ``<xpath> '[' @<leaf-name1> '=' <leaf-value1> ( ' <and|or> ' @<leaf-name> '=' <leaf-value> )* ']'`` - ``xpath``: Absolute or descendant or xpath to the (list) node which elements will be queried. - ``leaf-name``: The name of the leaf which value needs to be compared. - ``leaf-value``: The required value of the leaf. @@ -232,10 +233,13 @@ leaf-conditions - ``//categories[@name="Kids"]`` - ``//categories[@name='Kids']`` - ``//categories[@code='1']/books/book[@title='Dune' and @price=5]`` + - ``//categories[@code='1']/books/book[@title='xyz' or @price=15]`` - ``//categories[@code=1]`` **Limitations** - Only the last list or container can be queried leaf values. Any ancestor list will have to be referenced by its key name-value pair(s). - - Multiple attributes can only be combined using ``and``. ``or`` and bracketing is not supported. + - When mixing ``and/or`` operators, ``and`` has precedence over ``or`` . So ``and`` operators get evaluated first. + - Bracketing is not supported. + - Leaf names are not validated so ``or`` operations with invalid leaf names will silently be ignored. - Only leaves can be used, leaf-list are not supported. - Only string and integer values are supported, boolean and float values are not supported. - The key should be supplied with correct data type for it to be queried from DB. In the last example above the attribute code is of type |