Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

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

0 votes

Comments

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) 

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

1 vote


Accepted answer

Permanent link
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: <http://jazz.net/ns/rm#>

SELECT DISTINCT ?context ( count(?artifact) as ?artifactCount ) ( count(?binding) as ?bindingCount ) ( count (?link) as ?linkCount ) ( count (?mod) as ?modCount )
WHERE {
{
?artifact rdf:type rm:Artifact .
OPTIONAL{?artifact rm:boundArtifact ?boundArt .}
FILTER (!BOUND(?boundArt)) .
?artifact jfs:resourceContext ?context
}
UNION
{
?binding rdf:type rm:Artifact .
?binding rm:boundArtifact ?boundArt .
?binding jfs:resourceContext ?context
}
UNION
{
?mod rmTypes:ArtifactFormat ?af .
?af owl:sameAs jazz_rm:Module .
?mod jfs:resourceContext ?context
}
UNION {
?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

https://SERVER:PORT/rm/publish/modules/*

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 https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI


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 https://jazz.net/library/article/1197

Hugo Hernandez selected this answer as the correct answer

0 votes

Comments

Ian,


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...

Hugo.


One other answer

Permanent link

 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.

Regards,
Erica

1 vote

Comments

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: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX jfs: <http://jazz.net/xmlns/foundation/1.0/>
PREFIX rm: <http://www.ibm.com/xmlns/rdm/rdf/>
PREFIX dc: <http://purl.org/dc/terms/>

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: May 05 '22, 4:50 p.m.

Question was seen: 1,546 times

Last updated: May 11 '22, 1:34 p.m.

Confirmation Cancel Confirm