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

Struggling with RM OSLC API

Is there a way in oslc to query and find all artifacts that have a certain custom attribute (a string attribute named 'UID') set to something other than blank?


If not, even just knowing how to get this custom attribute's value for all artifacts of type X would be helpful. I am new to the RM OSLC API and am struggling to understand the documentation...

Thank you!
Dave

0 votes



One answer

Permanent link

 Have you checked this article? It describes some ways to do the queries: https://jazz.net/library/article/1197

0 votes

Comments

 Thank you Gabriel, yes. I have read that article and several others. I have failed to find out if its even possible to query for what I need. I have authentication working and have successfully found an artifact by id in my javascript.

Using the following URL (with the OSLC headers), this has got to be SO close:


URL:
<queryBase from project's services.xml>
&oslc.prefix=rt=<namespace for rt from services.xml>
&oslc.select=
&oslc.where=rt:attributeId>0

But this returns success, but no results. How would I specify the oslc.where to find a non-blank string? >0 Does not work. I also tried more...
These get me ALL artifacts:
="" (this is a * in quotes, but the forum won't show it)

These get me NO artifacts:
!=""
!="NULL"

Also, I found the attribute id was found from an OSLC query of a specific artifact....can I get this in an easier way?

 AFAIK if this is a string attribute then you can only use = and != also note that DOORS Next doesn't support the use of wildcards _ and % described (and optional) in the OSLC Query specification.


I don't think there is a way to query "where attribute is empty (or non-empty)" so I guess you will have to get all candidates with the attribute value included in the results by adding the attribute to the oslc.select and then postprocess.

Updated:

> &oslc.where=rt:attributeId>0

rt:attributeId must be the URI of the attribute definition, e.g. for my test env where my custom attribute type definition is https://SERVER:9443/rm/types/_i9G_YQ4AEeuyn_ocqKJ0aA then the prefix rt would be declared in oslc.prefix as https://SERVER:9443/rm/types/ and attributeId is _i9G_YQ4AEeuyn_ocqKJ0aA

You say the attribute is a string so you'll have to compare with a string, i.e. >0 won't work - but you can use >"" to match any attribute with a non-empty value, then postprocess.

You can use rt:attributeId in ["a","b","c"] to match specific values.

Note that DOORS Next doesn't support the use of wildcards _ and % described (and optional) in the OSLC Query specification.

You should add rt:attributeId to oslc.select to get the value in the results - prefer this to using oslc.select=* because of reduced server load when returning less data.

1 vote

 As a debugging method to show you're on the right lines, set oslc.select to * and then check a specific id e.g. 12345 then set the oslc.where to dcterms:identifier=12345 then you can check you're getting the custom attribute in the results - obviously it will only appear where the attribute has a value on the artifact. dcterms:identifier in [12345,123,99] also works



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
× 10,935
× 515
× 233
× 139
× 60

Question asked: Oct 13 '20, 3:08 p.m.

Question was seen: 2,190 times

Last updated: Oct 14 '20, 8:00 a.m.

Confirmation Cancel Confirm