DOORS Next Gen Query API
I'm trying to perform requirement queries that aren't supported/exposed by the OSLC Query Capabilities (like querying by module), and I came across what seems to be a DNG-specific querying endpoint (https://<server>/rm/views on our host). Trying to POST to this endpoint requires a DoorsRP-Request-Type of "private" and uses some sort of XML-based query language. What does the private header mean? Is this endpoint/query language documented? How can we use this seemingly-more-powerful query capability?
If we can't use this endpoint easily/effectively, what other options do we have? How can we query only artifacts that exist in a given module (without having to download each one individually from the module structure)?
2 answers
Modules are exposed as Collections in the OSLC Query API, and any artefacts inside are returned by querying the 'uses' relationship on the Module.
So if you are looking for artifacts inside a Module, use something like this to get the Project:
https://<your server>/rm/views?oslc.query=true&projectURL=<your project URI>
followed by:
&oslc.prefix=oslc_rm=<http://open-services.net/ns/rm%23>&oslc.prefix=dcterms=<http://purl.org/dc/terms/>&oslc.select=oslc_rm:uses&oslc.where=dcterms:title="<your module name>"
or even
oslc.where=dcterms:identifier=<the module ID>
As per the OSLC RM 2.0 spec, the OSLC 'uses' field will return the URIs of all the artefacts used inside the module, which you can then use for further queries. If you're just looking for basic info from the contained artefacts, you can request specific fields with:
&oslc.select=oslc_rm:uses%7Bdcterms:title%7D,oslc_rm:uses%7Bdcterms:identifier%7D
which will pull out the ID and Title of the contained artefacts.This article is a useful resource for this: https://jazz.net/library/article/1197
Comments
Thanks for the response Davyd, it has a lot of useful information! I just tried your solution, but the modules aren't returning any oslc_rm:uses properties when I select for them. I tried the following request:
https://<server>/rm/views?oslc.query=true&projectURL=<project-uri> &oslc.prefix=oslc_rm=<http://open-services.net/ns/rm%23> &oslc.prefix=dcterms=<http://purl.org/dc/terms/> &oslc.prefix=rdf=<http://www.w3.org/1999/02/22-rdf-syntax-ns%23> &oslc.select=oslc_rm:uses,dcterms:title,dcterms:identifier &oslc.where=rdf:type=<http://open-services.net/ns/rm%23RequirementCollection>
and others like it, but the returned collections are only showing their title and identifier. When I go to the module's resource URI, I see that they have oslc_rm:uses tags, they're just not returned by the query. What could cause that disconnect?
Secondary question: Why do I have to separate the oslc.prefix's into multiple query parameters instead of putting them in one comma-separated list like in your linked article? Otherwise I get a 400 Bad Request.
Yeah I had the same problem and found I had to separate them too - that was the reason why I explicitly wrote the query out for you, because the article wasn't quite right.
BTW your query above would return the ID and Title of the module or collection and the IDs of contained artefacts - if you want to return the info of the artefacts themselves you need to use
&oslc.select=oslc_rm:uses{dcterms:title}but with the curly brackets URLEncoded, as in my example above. If you want multiple attributes you have to prefix and bracket each one.
Not sure why you aren't getting any uses info back - can you try with a Collection and see?
The other approach would be to query the requirements artefacts themselves and use an oslc.where clause on the module URI. If you do a simple query for requirements you know are in a module, you'll see you get back one record for each context they are in - one for the global (folder) context and one for each Module. You should be able to easily query those.
1 vote
I don't see any properties on non-module artifacts that show where they are used/what modules they are called in, not even when I poll the resource directly. What sort of where clause would I use to query for requirements based on module?
Also, when I try to select for oslc_rm:uses on raw RequirementCollections, it works perfectly, but for Modules it still doesn't return anything for the query (though that information is still present on the module's resource page). Is this a configuration error? Or is there a problem with DNG?
Thanks for all the input!
You will need to add:
&oslc.prefix=rm=<http://www.ibm.com/xmlns/rdm/rdf/>&oslc.select=*,rm:module
to your query in order to see the field