It's all about the answers!

Ask a question

Is there any way to suppress moduleContext information in the DNG REST API?

Robert Huet (23112076) | asked Feb 07 '17, 11:16 a.m.

 I would expect a "resources" REST call to only return base artifact information, but it turns out to be extremely heavy weight on large modules.  Is there any way to suppress moduleContext information from being returned?

Accepted answer

permanent link
Donald Nong (14.4k314) | answered Feb 08 '17, 12:49 a.m.

Not sure why you think a module should return resources for base artifacts only. A module always refers to module artifacts, while the module artifacts recognize their corresponding base artifact.

If you just want to find out the resource URIs for all the base artifacts in a module, here is what I have found out. When using REST API only, it appears no effective field selection is available for a module. XPath doesn't work (not implemented), and attribute filtering does not work (not available for hierarchical data) either. If you are building an application to process this, the below method should reduce the memory requirement significantly.
1. Use OSLC API (not REST API) to get the module information first. The returned XML should be quite simple and should be easy to process.
2. For each module artifact returned within the module, use the "resources" REST API to find out the corresponding base artifact - its UUID appears in the <rrm:core> attribute.

It can be slow if there are lots of artifacts in the module though.

Robert Huet selected this answer as the correct answer

Robert Huet commented Feb 08 '17, 12:52 p.m. | edited Feb 08 '17, 12:54 p.m.

Sorry, my initial question was not stated very clearly.  I would expect a "resources" query that includes a set of module artifacts to provide a lightweight response with only module-level information for these modules (not the artifacts they contain).  The "modules" query is the one that could be more heavyweight and return the moduleContext for all the artifacts it contains.  I believe that is how "resources" and "collections" queries worked in the early RRC versions.

So I take it from your response that the answer is "No".  There are no REST API that can return just the module level information without all the added moduleContext for all the contained elements.  Also, there is no undocumented flag that would suppress that level of detail.  Is that right?

Donald Nong commented Feb 08 '17, 8:40 p.m.

I'm with you on this one. The "resources" format returns that exact same information as the "modules" format, which does not make sense to me. But that's the current implementation anyway.

The OSLC API returns a lighter version of the content (which I suspect is what you want), but it seems that you're doing something in RPE, so I'm not sure how practical it can be.

As for the flags, "fields" and "attributeURI" are the only ones that I can find in the document, for this particular purpose. Other than those, I am not aware any other flags/parameters.

Your answer

Register or to post your answer.