It's all about the answers!

Ask a question

Fetch an artifact with a specific section from DNG


Reem Kadadihi (133) | asked Dec 15 '21, 4:57 a.m.
retagged Jan 19, 8:13 a.m. by Ian Barnard (1.2k613)
Hello,
I m trying to fetch an artifact fron DNG with a specific section. My module has more than 4000 artifacts and to fetch the whole module and serach for the section I nedd to get is very complex and the paging option is alos not clear for me.
Is it possible to add the section as a query pamaeter in any API for DNG?
What is the right way to read the complete module using the paging possibilty?


The URl I use to fecth the module right now is:
Server/rm/publish/modules/?moduleURI=UUID

Thanks in advance.



Accepted answer


permanent link
Ian Barnard (1.2k613) | answered Dec 16 '21, 7:05 a.m.
JAZZ DEVELOPER
edited Dec 16 '21, 8:30 a.m.

 Hi


That's a big module - you might want to consider splitting it into smaller modules just to make it easier/quicker to view, to manage changes and reduce changeset dependency, etc. And with a smaller module then you won't have so many pages of results so easier to process using whatever API.

Your URL is a call to the DOORS Next Reportable REST API https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI

This returns the entire module structure, which can't be filtered by the API. If the result is paged then each page has a link to the URL for next page in the opening tag as attributes rel="next" and href= url for next page, for example in bold:

                 xmlns:rrm="http://www.ibm.com/xmlns/rrm/1.0/"
                 xmlns:attribute="http://jazz.net/xmlns/alm/rm/attribute/v0.1"
                 xmlns:comments="http://jazz.net/xmlns/alm/rm/comments/v0.1"
                 xmlns:field="http://jazz.net/xmlns/alm/rm/field/v0.1"
                 xmlns:h="http://www.w3.org/1999/xhtml"
                 xmlns:history="http://jazz.net/xmlns/alm/rm/history/v0.1"
                 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/"
                 xmlns:term="http://jazz.net/xmlns/alm/rm/term/v0.1"
                 xmlns:text="http://jazz.net/xmlns/alm/rm/text/v0.1"
                 xmlns:view="http://jazz.net/xmlns/alm/rm/view/v0.1"
                 xmlns:xhtml="http://www.w3.org/1999/xhtml"
                 appId="RRC"
                 rel="next"
                 rrm:totalCount="100"
                 vMajor="70"
                 vMinor="10">

To get more granularity you could use the OSLC APIs. You would find the project/component/configuration, then perhaps search for the module using OSLC Query. Once you've got the module you can get its structure and then selectively retrieve the artifacts you want.

There's a summary/example of how to find project/component/configuration(at the OSLC API level, not code) in my answer here https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area

The Module structure API is documented here: https://jazz.net/wiki/bin/view/Main/DNGModuleAPI

Note the module API doesn't give you section/heading numbers, AFAIK these are calculated not permanently stored, likely because they have to change as you change the structure.

I've found the Module Structure API to be a bit fussy about which headers/query parameters it works with, so ensure that you:
  • Don't construct the structure URL, get it from the module definition by doing a GET on the module URL using the following settings, and also use these settings to retrieve the module structure itself:
  • Provide header (capitalised exactly like this)
    • DoorsRP-Request-Type: public 2.0
  • Do NOT provide header OSLC-Core-Version
  • Provide the configuration using header vvc.configuration and NOT using header Configuration-Context or query ?oslc_config.context - so it must be a local configuration URL not a global configuration

There's an example written in Python of using the module structure API to retrieve the structure in either JSON or RDF and then print a heading-indented view of the module, in my OSS elmclient on github. NOTE the section number calculation hasn't been fully checked/verified in this demo, you'll have to confirm it works for you and fix if necessary. See https://github.com/IBM/ELM-Python-Client/blob/master/elmclient/examples/dn_simple_modulestructure.py

Reem Kadadihi selected this answer as the correct answer

Comments
Reem Kadadihi commented Dec 16 '21, 10:12 a.m.
Hi,

thanks for the asnwer. I got it now with the paging and I am able to read the whole module. I will check you python suggestion.

Your answer


Register or to post your answer.