Uploaded image for project: 'Configuration Persistence Service'
  1. Configuration Persistence Service
  2. CPS-231

E2E - DataNode Query with AnchorName, xpath and leafname and value

XMLWordPrintable

      Get DataNodes by anchor name, xpath, property name and value

      • xpath can be at any level of the tree even just '\' (blank probably should be accepted too)
        (in SQL this translates to a check that the xpath starts with the given path)
        the xpath can be used to limit the scope of the query. if it is broad it is possible that DataNodes of different 'types' are returned that happen to have the same property nam and value...
      • full xpath to parent (of the list) node expected
      • use json-query tools to only get the 'fragment' that contain required name-value pair
        (probably need native-query annotation)

      Out of scope 

      • xpath (syntax) validation
      • property name or value validation
      • If a non-existing xpath, property or value is queried then the system will return no results.

      See spike on query - CPS-226

       

      • Create a bookstore xml so it can be tested with online xpath testers (just do categories - code and name) 

       

      <?xml version="1.0" encoding="UTF-8"?> 
      <root> 
          <bookstore> 
              <bookstore-name>Chapters</bookstore-name> 
              <categories code="01" name="SciFi" /> 
              <categories code="02" name="kids" /> 
          </bookstore>
       </root>
      

       

      • /root/bookstore/categories[@code='01']  returns  Element='<categories code="01" name="SciFi"/>'

       

      • /bookstore/categories[@code='02'] - need to use regular expression to split the
        • xpath = /bookstore/categories
        • property name = code
        • property value = '02'
      • On the API and SPI interface the xpath should be renamed to cpsPath

       

       

       

      Example of query and return value 

      Datanode that is stored in the fragment table

      id | xpath     | leaves
      1 | /bookstore | {"bookstore-name": "Chapters"}
      

       

      Cps path will look like this:

      /bookstore[@bookstore-name='Chapters'] 

       

      This will return the datanode in the response body 
      [
          {
              "xpath": "/bookstore",
              "leaves": 

      {             "bookstore-name": "Chapters"         }

      ,
              "childDataNodes": []
          }
      ]
       

            niamhcore niamhcore
            niamhcore niamhcore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: