Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NotesDecisions

 

  • As per discussion with Lukasz Rajewski the following decisions were made:
    • The approach to have a custom logic to retrieve all the list items seems to be most appropriate to make Get Data Node API consistent with Query API
    • The approach to use a special character, asterisk(*) does not address the problem of inconsistency. As we would like to have the xpath in request consistent with that in Query API
      • Example: 

        Code Block
        /v2/dataspaces/my-dataspace/anchors/multipleTop/node?xpath=/bookstore/categories&descendants=3


    • The approach to Redirect the request to Query API does not seem to be a feasible approach.

 

More research needs to be done for the first proposed approach and need to document it in detail.

 

As per discussion with Daniel Hanrahan and Lee Anjella Macabuhay it was decided to change the Query for retrieveing the data nodes such that it can get all data nodes that fall under a given list. The query change is based on an internal PoC prepared by Daniel through which we can retrieve all the list items by specifying the xpath of list without impacting the performance.

Change the Query to retrieve all the list items under a given list using its xPath

Inconsistent response when retrieving data nodes.

...

"id""xpath""attributes"

"parent_id"

200"/bookstore/categories[@book-category='Kids']""{""name"": ""Kids book"", ""price"": 5000, ""stock"": true, ""book-category"": ""Kids""}"

198

199"/bookstore/categories[@book-category='SciFi']""{""name"": ""Test book"", ""price"": 1000, ""stock"": false, ""book-category"": ""SciFi""}"198
198"/bookstore""{""store-name"": ""My Bookstore"", ""store-owner"": ""ABC""}"null


Code Block
titleSegment from the Old query to match the xpath
WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)

...

Code Block
titleCurrent Response
collapsetrue
collapsetrue
[
    {
        "stores:bookstore": {
		 	"store-name": "My Bookstore",[
    {
        "stores:bookstorestore-owner": {"ABC",
            "categories": [
                {
                    "name": "Test book",
                    "price": 1000,
                    "stock": false,
                    "book-category": "SciFi"
                },
                {
                    "name": "Kids book",
                    "price": 5000,
                    "stock": true,
                    "book-category": "Kids"
                }
            ],
			"store-name": "My Bookstore",
            "store-owner": "ABC"
        }
    }
]

Here we can see that in the response we get a parent node bookstore and the list named "categories", as its child, and the list items identified by keys "SciFi" and "Kids" respectively. 

...