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

OSLC query to fetch RM artifacts by an enumerated attribute

Our Jazz Installation = v7.0.2


We have a module that contains several artifacts of all types (Information, Data...). Some of these artifacts ("Data", for example) contain an "Owner" attribute which is a list of enumerated values (Value A, Value B, Value C...).

The stream containing the module is included in a global configuration.

In the work we have already started, we have already retrieved the list of enumerated values with their URIs:


We are looking for an OSLC query that would allow us to retrieve the artifacts contained in the module, in a given global configuration, for which the "Owner" attribute has a given value (example: "Owner" = "Value B").

Can anyone help us on constructing such a query ?

Regards

0 votes


Accepted answer

Permanent link

Hi Jean-Francois


For an overview of using OSLC Query see this article (although note it doesn't talk about specifying the configuration): https://jazz.net/library/article/1197

As mentioned in that article you must make sure to dynamically discover the query capability i.e. don't hardcode the query URL. There's a walkthrough of discovering query capability, component and configurations here https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area/266667

The ELM OSLC APIs all need headers Accept: application/rdf+xml and OSLC-Core-Version: 2.0 with the request, and the configuration to be specified using header Configuration-Context or parameter oslc_config.context

To query for results from a particular configuration, GC or local, provide the configuration URL as e.g. header Configuration-Context or parameter oslc_config.context

To query for artifacts with a specific enum value in an attribute, use e.g.:

oslc.where=rp0:AD_P5g5EHdKEe6_cqbXTlHS4A in [<https://ibm.com/valueb>]

where prefix rp0 (actual name not critical) is defined in oslc.prefix e.g. oslc.prefix=rp0=<https://jazz.ibm.com:9443/rm/types/>
and rp0:AD_P5g5EHdKEe6_cqbXTlHS4A is the URL of the attribute definition
and https://ibm.com/valueb is the uri of the enumeration value

To get only artifacts in a module you'll have to a) include rm_nav:parent in oslc.select and b) postprocess the OSLC Query results to retain only the ones without a value for rm_nav:parent because these are the ones in a module.

If you want to filter for a specific module then you might have to do one query to find all the artifacts in the module, then another query to get artifacts with the enum value(s) you want, and filter it to get only the results in the specific module.

If you are able to run Python you might be interested in my OSS elmclient https://github.com/IBM/ELM-Python-Client which has an example command-line oslc query application which would let you very simply make the enum value query for module artifacts without you having to identify all the URLs, for example this command queries for artifacts with attribute AnEnum with value 'Value B' (which has a URI) and postprocess the results to write just the module artifacts to csv:
  • oslcquery -p rm_optin_p1 -s AnEnum -O b.csv -q "AnEnum in ['Value B']" -n rm_nav:parent
BUT note this is not an IBM or supported app, you'll have to ensure it does what you need, you can modify the source code if you want to enhance/fix it and you can contribute code back to the OSS :-)

If you add -V to the command it shows you the full query URL, that's what I used to create the example oslc.where at the top, i.e.:
Here's the related query to get the artifacts in a particular module (the repeated " are to satisfy Windows cmd needs for quoting):
  • oslcquery -p rm_optin_p1 -O c.csv -V -q "rm:module=^""AMR Stakeholder Requirements Specification"""
in the -q query the ^ notation says to get the URL of the named module, so this turns into:
HTH
Ian

Jean-François CHAPELLE selected this answer as the correct answer

0 votes

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
× 12,019
× 139

Question asked: Oct 24 '23, 8:08 a.m.

Question was seen: 704 times

Last updated: Nov 02 '23, 11:53 a.m.

Confirmation Cancel Confirm