Cannot obtain nextPage URL for EWM Query, multiple "ResponseInfo" tags in the query result

Hello everyone,

I’m trying to use the lyo library to query for some workitems. The result has multiple pages, so I’m trying to fetch the next page from the OslcQueryResult using

OslcQuery query = new OslcQuery(oslcClient, queryCapability, pageSize, queryParams);
OslcQueryResult result = query.submit();
//fetch the workitems from the first page
//...
if (result.hasNext()) { //trying to fetch the next page
      result = result.next();
}

However, the hasNext() method returns always false even though I have multiple pages:

So I tried to debug and these are my conclusions:

I tested the same sample code with a QM query and in that case it works, I am able to fetch the nextPage URL, because the “ResponseInfo” tag is unique:

Did you encounter use cases like this in the past? Can this be a bug?

Waiting for your feedback

Thanks,
Ana

Hi @anamr

Isn’t it odd that your response contains multiple responseInfo entries?

I cannot see the overall structure of the response, but is there some hierarchy of these resources? Can you somehow identify yourself which ResponseInfo resource is correct?

We might need to modify the logic to (somehow) identify this topLevel resource.

Jad

@anamr What version of Lyo are you using?

Hi @andrew, we were using ver 4.1.0, but I increased the version to 5.1.1.Final to test this issue. It’s the same behavior in both versions.

Hi @jad, yes, I can identify which response info is correct, it’s the only one containing “nextPage” in it:

The rest “ResponseInfo” resources are mostly details about the “rtc_cm:subscribers” field and another custom attribute field. For subscribers field there’s one individual “ResourceInfo” entry for each work item which has subscribers:

One more thing, the initial query was made to return all the work item attributes (oslc.select=*), if I somehow try to exclude the “rtc_cm:subscribers” (and the other problematic custom attribute) then there’s a single “ResponseInfo” and the nextPage can be fetched (e.g.: I tested for oslc.select=dcterms:title). But the problem here is that we want to fetch all the details for each work item. We could maybe make a workaround and try to exclude the problematic ones, but I think it’s kinda hard to build the oslc.select for this case and it still does not guarantee that the same issue cannot happen for other attributes in the future.

@anamr please try feat: handle multiple ResponseInfo obj in Query response by berezovskyi · Pull Request #606 · eclipse/lyo · GitHub and tell us if it works for you (PR review comments would be welcome too!). I don’t have the full response from Jazz to write a test for it, so we will need your help in testing before we merge. Sadly, the spec is not clear enough in whether one ResponseInfo, in presence of multiple of them in the response, can be assumed to have the same URI as the query URI.

If you could help me repro the situation you are getting in our EWM sample, I can try to test it better using one of our 3 Jazz servers.

Hi @andrew,

I looked in the pull request, it looks good, but I don’t know how I can test it on my side.

How can we reproduce the response in the EWM sample? Somehow we should alter the OslcQueryResult to contain more than one “ResourceInfo” and I’m not sure how to do that.

If you could prepare a new alpha version containing this change, it would be very easy for us to test it by simply changing the dependency version. We have Jazz test environments with both Jazz ver. 7.0.2 and 7.0.3.

Thanks for your support!

Hi @anamr,

We try to verify every PR before merging it. Releasing an alpha would require us to merge and even push untested code to Maven Central.

Could you please instead clone the Lyo git repo, switch to the pull request branch b605-multiple-responseinfos, and run mvn clean install in the root dir of the repo? This will install locally into your .m2 folder that you can test by changing Lyo version in your project to 6.0.0-SNAPSHOT.

Thanks,
Andrew

Hi @andrew,

Sorry for the delayed response, I got carried away with some other stuff.

I tested the pull request and Jad is somehow right, the queryURL does not match exactly the nextPageURL. The nextPageURL has some additional parameters at the end:

//queryURL:
https://[server]/ccm[X]/oslc/contexts/[projectAreaItemId]/workitems?_resultToken=[token]&oslc.pageSize=49&oslc.select=*&_startIndex=49
//actual nextPageURL:
https://[server]/ccm[X]/oslc/contexts/[projectAreaItemId]/workitems?_resultToken=[token]&oslc.pageSize=49&oslc.select=*&_startIndex=49&oslc.paging=true&oslc.pageSize=49

Additionally, I just wanted to point out that with this new version, I also had to fix some imports (because of the jakarta upgrade - package name has changed from ‘javax’ to ‘jakarta’) and I had to upgrade the org.glassfish.jersey dependencies. Luckily, I looked in your pom.xml file and I could figure out the correct versions.

Thank you,
Ana

@anamr, thank you for testing the PR! I will reply on the PR.

@jad, we should also collect notes on Lyo 6 migration guidance:

Noted. I hope someone can help keep the documentation updated. It has been a while.

I believe ResponseInfo was only intended to be used for resource paging and there was intended to be only one in a response that had paging support. At least that’s my reading of OSLC core paging and OSLC Query. Subscribers and other related resources would typically be part of the RDF entity response body.