Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Background

To query large outputs or large number of fragments across all anchors, we need to provide pagination for Query API( query data nodes across all anchors). it will help client to fetch limited set of data per request. below is possible solutions for further discussions. 

Pagination over fragments 

Implementation

API : GET http://<IP>:<PORT>/cps/api/v2/dataspaces/{dataspace-name}/nodes/query?cps-path={cps-path}&descendants={descendants}&pageIndex={pageIndex}&pageSize={pageSize}

Request Parameters:

ParameterisRequiredDescription
cps-pathyesnode path to be queried
descendantsnoNumber of descendants to be queried. default is none
pageIndexnopage index starting from 1. 
pageSizenonumber of fragments per page starting from 1 (TBD). 

Query

QueryDescriptionDecision 
SELECT id, anchor_id AS anchorId, xpath, parent_id AS parentId, CAST(attributes AS TEXT) AS attributes FROM FRAGMENT WHERE xpath ~ :xpathRegex ORDERED BY id LIMIT :pageSize OFFSET : pageIndex + 1Query limited fragments in order of fragment id



Pagination over anchors

we can provide pagination over anchors where client can chose number of anchors per request to fetch fragments from. 

Implementation

API : GET http://<IP>:<PORT>/cps/api/v2/dataspaces/{dataspace-name}/nodes/query?cps-path={cps-path}&descendants={descendants}&pageIndex={pageIndex}&anchorSize={anchorSize}

Request Parameters:

ParameterisRequiredDescription
cps-pathyesnode path to be queried
descendantsnoNumber of descendants to be queried. default is none
pageIndexnopage index starting from 1. 
anchorSizenonumber of anchors per page starting from 1 (TBD). 

Query:

QueryDescriptionDecision
SELECT anchor_id FROM anchor ordered by anchor_id LIMIT : anchorSize OFFSET : pageIndex +1query number of anchors to query from fragment table



  • No labels