It's all about the answers!

Ask a question

How to get Baseline Module Artifacts using OSLC


Pratyush Sharma (111) | asked Aug 08 '23, 11:38 a.m.
edited Aug 15 '23, 4:06 a.m. by Ian Barnard (2.0k613)

 Hello,

I wish to get all Module Artifacts for a Baseline, however when I try the approach of first getting the folders related to a baseline and then get the Artifacts related to those folders, I end up getting all the Module Artifacts for the Stream, not for that individual baseline,
Is there a method or function I can use to get all Module Artifacts related to a baseline using OSLC?


Comments
Ian Barnard commented Aug 09 '23, 8:29 a.m. | edited Aug 09 '23, 8:33 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Are you specifying the baseline configuration URL when accessing the OSLC API? Also when accessing the OSLC APIs you must provide headre OSLC-Core-Version: 2.0 with every operation.

If you still need help provide the URL you are accessing complete with all parameters (you can XXX the hostname) and also list all the headers you're providing. And show the response body.


Pratyush Sharma commented Aug 09 '23, 12:19 p.m. | edited Aug 09 '23, 12:26 p.m.

Hello,

I am making this call:
oslcAuthRestClient.getRestClient()
.resource(
https://rtc-rm2-tpd.gm.com:XXXX/rm/folders?oslc.where=public_rm:parent=https%3A%2F%2Frtc-rm2-tpd.gm.com%3A9443%2Frm%2Fprocess%2Fproject-areas%2F_dSOn4M7fEeihvZ3ZnaL_3Q) 
.accept(OslcMediaType.APPLICATION_RDF_XML) .header(OslcRmConstants.OSLC_CORE_VERSION, "2.0") .header(OslcRmConstants.OSLC_CONFIGURATION_CONTEXT_HEADER, https://rtc-rm2-tpd.gm.com:XXXX/rm/cm/baseline/_XcDMgDVWEe6Mk5WLfeaNHA) .header(OslcRmConstants.COMPONENT_URI_HEADER, RmContext.getRmContext()
.getComponentUriOslcHeader().toString()); 


Pratyush Sharma commented Aug 09 '23, 12:23 p.m.

 However, after getting the Folder this response correlates to (the response is a ClientResponse object), we get the Folder that is related to the stream, not to the baseline itself (in other words, the folder has artifacts the baseline shouldn't have captured)


Pratyush Sharma commented Aug 10 '23, 9:39 a.m. | edited Aug 10 '23, 9:43 a.m.

I posted my followup as an answer (even though its not an answer), due to character limit


Pratyush Sharma commented Aug 10 '23, 9:39 a.m. | edited Aug 10 '23, 9:42 a.m.




Pratyush Sharma commented Aug 10 '23, 9:39 a.m. | edited Aug 10 '23, 9:42 a.m.




Ian Barnard commented Aug 10 '23, 10:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This is some java code I'm unaware of so I can't help you with that. But the URL you're using looks like an OSLC Query because it has oslc.where, but the query in oslc.where for public_rm:parent=(a folder url) isn't correctly formatted, the URI MUST be surrounded by < > example below. Also there MUST be a definition of the prefix you've used public_rm in an oslc.prefix= statement


Pratyush Sharma commented Aug 10 '23, 10:20 a.m.

 I got a little stuck using this process and rephrased my question,

The folder itself when I get the root, belongs to the stream, not the baseline,
In my response as a form of an answer, what should be my next step if I have the information below?


Ian Barnard commented Aug 10 '23, 3:48 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If the folder didn't exist in the stream when the baseline was taken then obviously you won't find it in the baseline; it simply won't be there. But you would discover this by trying to find it and failing - very fragile and poor style to hardcode a URL for a folder and then expect it to be there because it might not. 

showing 5 of 9 show 4 more comments

One answer



permanent link
Pratyush Sharma (111) | answered Aug 10 '23, 9:42 a.m.
edited Aug 15 '23, 2:48 p.m.

Let me rephrase it, hopefully this clarifies my position 

Lets say I have this baseline configuration URl 
https://rtc-rm2-tpd.gm.com:XXXX/rm/cm/stream/_BOzHMDVWEe6Mk5WLfeaNHA

And I'm able to get the ResourceShape Service provider which returns this xml file https://rtc-rm2-tpd.gm.com:XXXX/rm/oslc_rm/_dSOn4M7fEeihvZ3ZnaL_3Q/services.xml

Which has this format


<?xml version="1.0" encoding="UTF-8"?>

<oslc_rm:ServiceDescriptor xmlns:oslc_rm="http://open-services.net/xmlns/rm/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdf:about="https://rtc-rm2-tpd.gm.com:XXXX/rm/oslc_rm/_dSOn4M7fEeihvZ3ZnaL_3Q/services.xml">

<oslc_rm:links>

<oslc_rm:LinkCreationServices>

<oslc_rm:validatedByLinkFactory rdf:resource="https://rtc-rm2-tpd.gm.com:XXXX/rm/links/oslc/validatedByLinks"/>

<oslc_rm:implementedByLinkFactory rdf:resource="https://rtc-rm2-tpd.gm.com:XXXX/rm/links/oslc/implementedByLinks"/>

</oslc_rm:LinkCreationServices>

</oslc_rm:links>

<oslc_rm:collections>

<oslc_rm:CollectionSelectionDialog>

<oslc_rm:heightHint>550px</oslc_rm:heightHint>

<oslc_rm:widthHint>800px</oslc_rm:widthHint>

<oslc_rm:widget rdf:resource="https://rtc-rm2-tpd.gm.com:XXXX/rm/pickers/com.ibm.rdm.web.CollectionPicker?projectURL=https%3A%2F%2Frtc-rm2-tpd.gm.com%3AXXXX%2Frm%2Frm-projects%2F_dSOn4M7fEeihvZ3ZnaL_3Q"/>

<dc:title xmlns:dc="http://purl.org/dc/terms/">Collection Selection</dc:title>

</oslc_rm:CollectionSelectionDialog>

</oslc_rm:collections>

<oslc_rm:requirements>

<oslc_rm:SelectionDialog>

<oslc_rm:heightHint>550px</oslc_rm:heightHint>

<oslc_rm:widthHint>800px</oslc_rm:widthHint>

<oslc_rm:widget rdf:resource="https://rtc-rm2-tpd.gm.com:XXXX/rm/pickers/com.ibm.rdm.web.RRCPicker?projectURL=https%3A%2F%2Frtc-rm2-tpd.gm.com%3AXXXX%2Frm%2Frm-projects%2F_dSOn4M7fEeihvZ3ZnaL_3Q"/>

<dc:title xmlns:dc="http://purl.org/dc/terms/">Requirement Selection</dc:title>

</oslc_rm:SelectionDialog>

</oslc_rm:requirements>

<dc:description xmlns:dc="http://purl.org/dc/terms/">Service Descriptor for Project: ECS Sandbox Project (RM2)</dc:description>

<dc:title xmlns:dc="http://purl.org/dc/terms/">ECS Sandbox Project (RM2)</dc:title>

</oslc_rm:ServiceDescriptor>


What should be my next step to get Baseline artifacts?


Comments
Ian Barnard commented Aug 10 '23, 11:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Doesn't make any difference querying for things in a stream or a baseline - you just provide the configuration URL whatever it is.


Cant see any QueryCapability in the XML you show so don't know where you are. You need to use discovery to find the QueryCapability for requirements, see step-by-step here https://jazz.net/forum/questions/266334/dng-oslcfetch-components-from-project-area

Make sure to always have headers OSLC-Core-Version: 2.0 and Accept: application/rdf+xml on every GET.

Then build an OSLC query URL preferably adding an additional parameter &oslc_config.context= and then the config URL suitable URL-encoded. This shouldn't have < > around it. Doing it this way means you can look at the URL to see the configuration you're querying in, as against having to look at a header.

Again use those two headers on the OSLC Query GET.

Decode the results...


Ian Barnard commented Aug 10 '23, 11:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Your answer


Register or 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.