How to fetch only streams from a component using GC API
Hi,
I am not able to filter configurations based on streams. Is there a way we get only stream url from a configuration.
GC Url used to fetch configuration,
i am trying to filter based on stream using this oslc_config:stream parameter as mentioned in https://jazz.net/sandbox01-gc/doc/scenario?id=QueryConfigurations
Please let me know, how can i get all streams from a component / configuration and not baselines. Currently if we try to get configurations for a component it gives streams and baselines. i am finding difficult to get only stream urls beacuse both uses rdf:type.
Thank you
Regards,
Thiru
|
Accepted answer
Ian Barnard (2.3k●7●14)
| answered May 12 '22, 11:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited May 12 '22, 12:45 p.m. You don't say what version/ifix you're using.
Your query URL doesn't look correct because a) there's no oslc.where, and b) the query value(s) aren't URL encoded, c) it's oslc_config:Stream not oslc_config:stream (and the document you link to shows oslc_config:Stream). and d) you haven't specified the oslc_config prefix using oslc.prefix=...
This GET query for configurations in a project works for me in 7.0.2 iFix009:
with headers:
OSLC-Core-Version: 2.0
Accept: application/rdf+xml
The URL un-encoded and broken into parts is:
?oslc.select=rdf:type,dcterms:identifier
&oslc.where=rdf:type=<http://open-services.net/ns/config#Stream>
You could do exactly the same thing with prefixes by adding oslc_config.to oslc.prefix and then use oslc_config as a prefix in the oslc.where, something like this (untested):
&oslc.where=rdf:type=oslc_config:Stream
&oslc.prefix=oslc_config=<http://open-services.net/ns/config#>
(with the appropriate URL encoding for the oslc.prefix vaue, of course)
This returns just the 8 streams I expect.
A similar application-wide query looks like:
But in general it's best to avoid such wide queries because they will place a load on the server that you should preferably avoid, or at least take great care to ensure your queries doesn't impact on all the other users.
Postscript:
Looking at the query results when the rdf:type is included, it seems each result entry has multiple values for rdf:type, e.g. for a stream:
<rdf:type rdf:resource="http://open-services.net/ns/config#Configuration"/>
<rdf:type rdf:resource="http://jazz.net/ns/config_ext#SharedStream"/>
<rdf:type rdf:resource="http://open-services.net/ns/config#Stream"/>
or for a baseline:
<rdf:type rdf:resource="http://open-services.net/ns/config#Configuration"/>
<rdf:type rdf:resource="http://open-services.net/ns/config#Baseline"/>
but when using oslc.where=rdf:type=oslc_config:Stream the results do seem correctly be just the streams.
I'm no RDF expert, but I assume this means that the result is (compatible with) all of the types in its entry. Painful to filter at the XML level, though, so much easier to get the OSLC Query to work it out for you :-)
HTH
Ian
Thiruvenkadam Dhanaraj selected this answer as the correct answer
|
One other answer
David Honey (1.8k●1●7)
| answered May 12 '22, 11:32 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The URI you mentioned isn't an OSLC query capability. In GCM, all the query capability base URIs are under /gc/oslc-query. However, you shouldn't hard code these, but instead use OSLC discovery to find them.
The correct usage is described in https://jazz.net/gc/doc/scenario?id=QueryConfigurations.
Regarding
Comments
Thiruvenkadam Dhanaraj
commented May 13 '22, 1:17 a.m.
Thank you David for this detailed answer. Now i am able to understand better. The GC documentation is a pleasure to refer to, David. https://jazz.net/gc/doc/scenario?id=QueryConfigurations - I wish the other apps had something equally good.
Re: prefixes, I found I had to avoid providing prefix definitions for dcterms, oslc, rdf because they result in the query being rejected because these are already defined. Didn't have that problem with oslc_config.
|
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.