It's all about the answers!

Ask a question

REST query to DNG returns incorrect ordering


Sam Briggs (3769) | asked Jan 29 '15, 2:14 p.m.
Good evening,

I have been using RPE to publish reports from DNG (5.0.0) for a while now with good results.

However as artifacts have been added to the modules I'm publishing, I have noticed a problem develop.

Previously I would use a REST query for all resources found within a particular module, i.e:
.../rm/publish/resources?moduleURI=xxxxxxxxxxxxx

This has always returned the artifacts in the book order of the module, perfect for publishing. However I now see a smattering of artifacts, all at different positions within the module, created by different users, of different artifact types, that are returned at the end of the REST query, after the artifacts that should be the final ones. Specifically 10 artifacts out of the 522 in the module, appear out of book order, after the other artifacts that appear in the correct ordering.

I decided that there must be no guarantee that artifacts using this query are returned in book order so I turned to something I assumed to be more robust: using a view. The view definitely shows the artifacts in book order. I use the query of the form:
.../rm/publish/resources?moduleURI=xxx&projectURI=xxx&viewURI=xxx

To my surprise this continues to return the same 10 artifacts out of book order, as do other views. This unpredictable behaviour is a real disaster for my document generation.

Has anyone found this issue before?

Sam

Comments
Alastair Beadle commented Jan 30 '15, 4:52 a.m. | edited Jan 30 '15, 4:54 a.m.

It sounds like you are at a similar stage to me in CLM/RPE work but I have not yet seen this problem. I just re-ran my in-progress RPE template (uses the view as the main query) from a large module and the artefacts all appear to be in the correct order. But that module to date has only been edited by one user.

I am also on 5.0.0 but have fix 006 installed - I do not recall seeing any fixes relating to this specific problem but there were a few REST ones that I didn't pay much attention to at the time. It may be worth applying the patch if you have not already.

Edit: Another thought - have you tried one of the out-of-the-box RPE module templates to eliminate a template specific issue?


Sam Briggs commented Jan 30 '15, 5:46 a.m.

Hi Alastair,

Thanks for your response. Applying iFixes would be great, unfortunately I do not have access to our DNG server and IBM have spent the past 2 months trying to set up our 5.0.2 production server so I'm reluctant to persuade people to update our server for what may turn out to be only a fortnight.

Furthermore this is NOT an RPE issue (although I discovered it this way). when I retrieve the XML in my web browser using the REST query the data is returned in this incorrect ordering, be it with resources OR view.

Thanks for your suggestions

Sam

Accepted answer


permanent link
Donald Nong (14.5k614) | answered Feb 01 '15, 7:45 p.m.
edited Feb 01 '15, 7:45 p.m.
I did some debugging and re-read your post, and realized that you may hit the limitation of the API. When you use the "resources" API, RM sends a SPARQL query to the server with a "limit 512" (probably due to performance concern). For the returned artifacts, it sorts them by "bookorder", and that's why you can see them in perfect book order. It then sends another query to get the rest (if necessary, another 512), and sorts them, and so on. In your case, I suppose the 10 of them "out of order" are actually in order within the group of 10, right? I have not found a way to increase this limit to overcome this unfortunately.

RM does not impose such a limit with the "modules" API.

Without knowing the actual design, I cannot say for sure whether it's limitation or a bug. I suggest you get in touch with Support and get a definite answer.
Sam Briggs selected this answer as the correct answer

Comments
Sam Briggs commented Feb 02 '15, 7:07 a.m.

Aha! I think that must be what is going on! I have checked and the REST query DOES indeed pass back 512 artifacts in ascending book order and then a further 10 artifacts - missing from the first chunk - in ascending book order.

Can't thank you enough, would NEVER have found that on my own. I'll contact support somehow...


Alastair Beadle commented Feb 03 '15, 12:06 p.m.

Do you know if the 'views' API has a similar limit? I assume not as the example quitPrintModule templates use that as the data source. I ask as my templates are based on 'views' and although I have not seen this problem I don't think I have reached 512 objects yet and am concerned we will get the same issue eventually!
Ali


1
Donald Nong commented Feb 04 '15, 11:04 p.m.

I don't see any LIMIT passed on to the "views" API. You can use the "size" request parameter to cap the result though, if you wish.


Sam Briggs commented Jul 31 '15, 6:53 a.m.

Defect reported here 94418: REST API: RM sends a SPARQL query to the server with a "limit 512". This has been a known problem for some time (see related defect here 91574: module view wrong in create link to rows in module menu)

Another example of bug/unexpected behaviour that DNG is riddled with and unlikely to fix in existing versions of the product. We bought this product WAY to early in its development, it has a long way to go before its advantages outweigh its buggy behaviour.

2 other answers



permanent link
Donald Nong (14.5k614) | answered Jan 30 '15, 5:14 a.m.
I am not sure whether the "resources" API guarantees order (note that you have a "book" only with a module) as you can put all sorts of filters with the API. If book order is critical to you, I suggest you use the "modules" API instead, and you will find <rrm:bookOrder> in the output.

Comments
Sam Briggs commented Jan 30 '15, 5:54 a.m.

Hi Donald,

You are correct, the "modules" query will return the artifacts in the correct order, and if I wanted to be super-safe I could even sort on book order.

However "modules" query does not return most of the information that "resources" does...for example the 'traceability' entry is completely omitted, as are the attributes. Of course I could use "modules" to obtain the 'about' of the artifact and then use a data source configuration to obtain the "resources" information but then this requires a reconfiguration every iteration which takes a very long time in a >500 artifact document with a complex RPE template.

I wouldn't have assumed that "resources?moduleURI=" returned artifacts in book order if it hadn't worked for months already, with a project full of people applying changes every day concurrently.

My question is an appeal if someone who knows if "resources?moduleURI=" is supposed to return book order so that I know if I've been lucky until now, or if this is unexpected behaviour.

Thank you for your suggestion.


permanent link
Subramanya Prasad Pilar (4.6k16) | answered Jan 30 '15, 5:41 a.m.
Hi Sam,
Does sorting on Module Artifact "about" help? If so, you can use RPE's sort.

Comments
Sam Briggs commented Jan 30 '15, 5:58 a.m.

Hi Subramanya,

I haven't tried this, however I don't see how it would? As far as I can see "about" is the full URL to reach the resource, with the specific artifact indicated by its URI, e.g:
https://[host]:[port]/rm/resources/_1da2f623be39418a83ba183007710a37

These URIs are a combination of numbers and letters, and surely cannot be linked to book order as the URI is unique and constant throughout an artifact's life, whereas I could move the artifact indicated by the above "about" entry right now from position 3 to position 2.

However thank you for your help


Subramanya Prasad Pilar commented Jan 30 '15, 6:08 a.m. | edited Jan 30 '15, 6:10 a.m.

Thanks Sam. I did not realize what is returned for "about". It should be <rrm:bookOrder> or something else. Sorry about that.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.