It's all about the answers!

Ask a question

Can I find out the number of Modules in a DNG Repository using a SPARQL query? if it is so, do you know what is the artifact type for a module?

Hugo Hernandez (56) | asked May 05 '22, 4:50 p.m.
edited May 05 '22, 5:02 p.m.

 I am trying to find out the number of DNG Modules in our production environment using SPARQL.

Ian Barnard commented May 10 '22, 5:35 a.m.

What version of DOORS Next are you using? SPARQL won't get much in 7.x as Jena not used for artifacts. OSLC Query is probably the best way to get the information you want (and will work for 6.x or 7.x) 

Hugo Hernandez commented May 10 '22, 10:02 a.m.

Thanks Ian. We are using 6.x version. Hopefully, we will be using 7.x soon. 

Accepted answer

permanent link
Ian Barnard (1.9k613) | answered May 11 '22, 5:27 a.m.
edited May 11 '22, 5:31 a.m.
Hi Hugo

I'd suggest moving away from SPARQL because it won't produce any results for 7.x - more detail on two alternatives below.

NOTE all these queries can place a large load on your server so be careful about the impact on other users.

1. Using SPARQL yes modules can be identified by their type, but then you'd have to list all the types you want to count. Probably simpler to check for the artifact format being Module - only consideration being that module templates have the same artifact format as normal modules, so will be included in totals. This SPARQL seems to count modules and templates, lists them by project area, but you MUST confirm for yourself that the count of modules is accurate for your needs! Not sure if this is the most efficient way to identify modules, but it works for my small test environment.

PREFIX jazz_rm: <>

SELECT DISTINCT ?context ( count(?artifact) as ?artifactCount ) ( count(?binding) as ?bindingCount ) ( count (?link) as ?linkCount ) ( count (?mod) as ?modCount )
?artifact rdf:type rm:Artifact .
OPTIONAL{?artifact rm:boundArtifact ?boundArt .}
FILTER (!BOUND(?boundArt)) .
?artifact jfs:resourceContext ?context
?binding rdf:type rm:Artifact .
?binding rm:boundArtifact ?boundArt .
?binding jfs:resourceContext ?context
?mod rmTypes:ArtifactFormat ?af .
?af owl:sameAs jazz_rm:Module .
?mod jfs:resourceContext ?context
?link rdf:type rm:Link .
?link jfs:resourceContext ?context
GROUP BY ?context
ORDER BY ASC (?context )

2. You can also count modules by using the Reportable REST API which will work for 6.x or 7.x, for example


NOTE the results may be more than one page, you'll have to collect them all, then you'll have to count the modules in the XML - there's one <ds:artifact...> tag per module

For more info on the DNG Reportable REST API see

3. Or use OSLC Query also works for 6.x and 7.x, but AFAIK you will have to query each project individually because DOORS Next doesn't have an application-wide query capability.

The query would also look for the artifact format being Module, i.e.:

* oslc.where=rdm_types:ArtifactFormat=jazz_rm:Module

A fully encoded OSLC Query URL against (in this case) an opt-out project looks like:

Again results may be several pages - then you'll have to count the modules in the result XML and sum it across all projects.

For more detail on how to do OSLC Query, search this forum, or there's an old but useful article here

Hugo Hernandez selected this answer as the correct answer

Hugo Hernandez commented May 11 '22, 1:34 p.m.


Thank you so much for your help. Hopefully, we will move to 7.x soon, so we don't have to deal with the SPARQL anymore...


One other answer

permanent link
Erica Tran (1.4k7) | answered May 05 '22, 5:12 p.m.

 Hi Hugo,

There are some example sparql queries in this article:

There is a sparql that counts for an artifact type. So you could use the artifact type of the modules.

I hope this helps.


Hugo Hernandez commented May 09 '22, 11:42 a.m.

Thanks Erica for replying back. Unfortunately those queries don't show the Artifact type for Modules. I also tried to run this query, but it did not work. It does not do anything.

PREFIX rdf: <>
PREFIX jfs: <>
PREFIX rm: <>
PREFIX dc: <>

SELECT ?url ?uniqueId ?title ?module WHERE { ?url rdf:type rm:BaselineMetadata . ?url rm:module ?module . ?url rm:uniqueId ?uniqueId . ?url dc:title ?title }

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.