Query for specific tagged workitem by OSLC dcterms:subject
![]() Hello,
I'm using the OSLC to fetch the expected tagged workitems with
like format, which is one example in example6. My URL is like https://rb-alm-20-p.de.bosch.com/ccm/oslc/contexts/_QjsBsp5aEeq2u-M0ATM71Q/workitems/bugv2.0?oslc.where=dc:subject in ["stability"]&oslc.prefix=dcterms=<http://purl.org/dc/terms/> Does someone know how to fix this by OSLC or REST API of RTC? |
2 answers
![]()
David Honey (1.7k●1●7)
| answered Apr 22 '22, 11:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER I assume you are using an OSLC query capability - see https://docs.oasis-open-projects.org/oslc-op/query/v3.0/os/oslc-query.html.
Comments Hi David,
Thanks for your answer. But i did encode all the parameter in the URL like the following:
oslc.where%3Ddcterms%3Asubject%20in%20%5B%22sop5_bug%22%5D%26oslc.prefix%3Ddcterms%3D%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%26oslc.select%3D%2A%26oslc.paging%3Dtrue%26oslc.pageSize%3D200, which uses UTf-8.
It still gives back all the items without tags filtered.
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
That's not correct - you are encoding more than each parameter value Assuming you're trying to use the following parameters:
the correct encoding in a request would be:
|
![]()
Ian Barnard (1.8k●6●13)
| answered Apr 22 '22, 12:46 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Apr 25 '22, 5:16 a.m.
I don't know where/how you got your query base URL but my 7.0.2 iFix009 test env doesn't have any query capability with bugv2.0 in it. YMMV.
For my test environment the project-specific work items query URL base for my project is https://jazz.ibm.com:9443/ccm/oslc/contexts/_pag-MkB1EeuDvqpPB-fV1g/workitems
This is discovered starting from rootservices, details after the Discovery heading below.
Then the full OSLC Query URL in this case for tags"asd" and "mobile":
With headers:
OSLC-Core-Version: 2.0
Accept: application/rdf+xml
With the encoding removed and with the query parameters broken out this looks like:
The paging and pagesize are optional - but your code needs to be prepared for paging of results even if you don't specify these :-)
NOTE using oslc.select=* increases the load on the server so avoid if at all possible, to minimize the impact of your queries on users.
.
Discovery of OSLC Query base URL
I'm using 7.0.2 iFix009 - although AFAIK the steps below would work back to at least 6.0.2.
For all requests below you MUST provide headers:
* OSLC-Core-Version: 2.0
* Accept: application/rdf+xml
If you don't provide these headers then the sequence below won't work because you'll get different (non-OSLC 2.0) responses.
The querybases (there are two in my test environment) are in the project's services.xml., in my case this is at https://jazz.ibm.com:9443/ccm/oslc/contexts/_pag-MkB1EeuDvqpPB-fV1g/workitems/services.xml
You discover this starting from rootservices:
(this request doesn't require you to be authenticated)
Look for the entry:
<oslc_cm:cmServiceProviders
xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
rdf:resource="https://jazz.ibm.com:9443/ccm/oslc/workitems/catalog" />
Then:
(your client code will have to be authenticated to get the catalog and any other requests from now on, if your user doesn't have permission to access then you won't get the data)
This is the catalog of projects on your server. Find the project by looking for the dcterms:title tag with title of your project, then the services catalog for that project is in the rdf:about of the containing oslc:ServiceProvider tag:
<oslc:serviceProvider>
<oslc:ServiceProvider rdf:about="https://jazz.ibm.com:9443/ccm/oslc/contexts/_pag-MkB1EeuDvqpPB-fV1g/workitems/services.xml">
<dcterms:title rdf:parseType="Literal">My Project</dcterms:title>
<oslc:details rdf:resource="https://jazz.ibm.com:9443/ccm/process/project-areas/_pag-MkB1EeuDvqpPB-fV1g"/>
<jfs_proc:supportLinkDiscoveryViaLinkIndexProvider rdf:parseType="Literal">false</jfs_proc:supportLinkDiscoveryViaLinkIndexProvider>
<jfs_proc:supportContributionsToLinkIndexProvider rdf:parseType="Literal">true</jfs_proc:supportContributionsToLinkIndexProvider>
<jfs_proc:globalConfigurationAware rdf:parseType="Literal">compatible</jfs_proc:globalConfigurationAware>
<jazz_disc:messageReceiver rdf:resource="https://jazz.ibm.com:9443/ccm/web/com/ibm/team/workitem/web/EWMWorkitemsCopyHandler.html"/>
<jfs_proc:consumerRegistry rdf:resource="https://jazz.ibm.com:9443/ccm/process/project-areas/_pag-MkB1EeuDvqpPB-fV1g/links"/>
</oslc:ServiceProvider>
</oslc:serviceProvider>
Use the <oslc:ServiceProvider rdf:about="https://jazz.ibm.com:9443/ccm/oslc/contexts/_pag-MkB1EeuDvqpPB-fV1g/workitems/services.xml">
Then to find the correct query base URL search for an oslc:QueryCapability tag containing a tag oslc:resourceType for http://open-services.net/ns/cm#ChangeRequest, and the query base is the oslc:queryBase tag alongside it.
<oslc:queryCapability>
<oslc:QueryCapability>
<dcterms:title rdf:parseType="Literal">Change request queries</dcterms:title>
<oslc:usage rdf:resource="http://open-services.net/ns/core#default"/>
<oslc:resourceType rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
<oslc:resourceShape rdf:resource="https://jazz.ibm.com:9443/ccm/oslc/context/_pag-MkB1EeuDvqpPB-fV1g/trs/shapes/workitems/query"/>
<oslc:queryBase rdf:resource="https://jazz.ibm.com:9443/ccm/oslc/contexts/_pag-MkB1EeuDvqpPB-fV1g/workitems"/>
</oslc:QueryCapability>
</oslc:queryCapability>
HTH
Ian
Comments Hi Ian,
Thanks for your answer!
What I discovered from the 'Discovery Mechanism' is like below
<oslc_cm:factory oslc_cm:default="true" calm:id="defect">
<dc:title>Location for creation of Bug change requests </dc:title>
<oslc_cm:url>https://rb-alm-20-p.de.bosch.com/ccm/oslc/contexts/_QjsBsp5aEeq2u-M0ATM71Q/workitems/bugv2.0</oslc_cm:url>
</oslc_cm:factory>
This is from https://rb-alm-20-p.de.bosch.com/ccm/oslc/contexts/_QjsBsp5aEeq2u-M0ATM71Q/workitems/services.xml, and I didn't see a tag named oslc:queryBase you described.
I use the select and page setup as yours but the result is still the same where no filter on tags.
![]() FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
That URL definitely won't work as query because, as it shows in your XML, it's the "Location for creation of Bug change requests", and it's in a oslc_cm:factory tag, i.e. it isn't a OSLC Query base URL.
You're probably not providing the header OSLC-Core-Version: 2.0 - this is required.
I added to my answer details of how to find the correct query base URL for work items.
I would suggest to have a look here: https://rsjazz.wordpress.com/2022/02/22/ewm-oslc-query-api/ this also covers the discovery process. I agree with the statements with respect to the URL as well as the headers. |