It's all about the answers!

Ask a question

[GC] Update custom tags in GC baseline using OSLC


Chandan M B (1134184) | asked Jul 12 '22, 5:11 p.m.
Hi,

I am able to create GC baseline via the OSLC.

I have to update the custom tag in GC baseline post baseline creation.
Please suggest some pointers to do update operation on GC baseline to add custom tags

Chandan

Accepted answer


permanent link
David Honey (1.8k17) | answered Jul 13 '22, 4:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 13 '22, 4:33 a.m.
That's because your PUT body doesn't contain all the required RDF statements.The body should be the RDF of the resource in its current state plus the application of any new or removed statements.

In OSLC, and indeed in REST in general, the usage model if you want to modify an existing resource is that you:
  • Perform a GET, and get the RDF representation of a resource, and note the ETag in the response ETag header.
  • Modify the RDF. If you want to add some tags, add RDF statements using dcterms:subject .
  • Perform a PUT with the modifed RDF in the request body, and with an If-match header whose value is the ETag from the previous GET.
See https://jazz.net/gc/doc/scenario?id=UpdateConfiguration for details.

The oslc_config_ext:addRootTag is for the Create baseline operation which, as documented in https://jazz.net/gc/doc/scenario?id=CreateBaseline, is a POST.
Chandan M B selected this answer as the correct answer

3 other answers



permanent link
Ralph Schoon (63.3k33646) | answered Jul 13 '22, 2:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 13 '22, 2:41 a.m.
In OSLC, when you create a baseline you POST to the Creation Factory URI with a POST body that contains the representation of the data (based on the resource shape). The response contains a Location header where you get the created object and an ETAG.

For update of data OSLC is reasonably simple. It expects a PUT to the URI of the object. It expects the request body to contain the representation of the object. In addition it expects an if-match header with the ETAG header of the object when you read it, to be able to compute if there is a conflicting change.. 

OSLC is a standard, you can look up these standards. Here is an entry point: https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=oslc-core 

In the request with the added tag, you would have to modify the JSON or RDF-XML to include the new tag. 

If you want a more compressed introduction into OSLC, here what I have experienced (for CCM, but OSLC is very similar in other domains): https://rsjazz.wordpress.com/2022/02/02/ewm-work-item-oslc-cm-api/

Comments
Chandan M B commented Jul 13 '22, 3:26 a.m.
Response contains the location but there is no ETag for it.
Also, there is no documentation on the URI to be used to update the GC baselines
  1. Status Code: 202 Accepted
  2. keep-alive: timeout=5, max=100
  3. location: https://xxx/gc/activity/__DlpQAJ6Ee2dGMgvWzmIuw

permanent link
David Honey (1.8k17) | answered Jul 13 '22, 4:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you want to add one or more tags to the root baseline, specify one or more oslc_config_ext:addRootTag statements in posted RDF - one for each tag you want to add. Any existing tags will be preserved.

If you want to replace the tags on the root baseline, specify one or more oslc_config_ext:replaceRootTag statements in the posted RDF - one for each tag that you want. Any existing tags that are not specifed by oslc_config_ext:replaceRootTag will be removed.

If you want to remove all tags from the root baseline, specify a oslc_config_ext:replaceRootTag statement with value rdf:nil in the posted RDF -

permanent link
Chandan M B (1134184) | answered Jul 13 '22, 4:12 a.m.
edited Jul 13 '22, 4:12 a.m.
I am performing the update

Type : PUT
Headers
   Accept : application/rdf+xml
   OSLC-Core-Version: 2.0
   Content-Type : application/rdf+xml

Body
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
         xmlns:gc="http://jazz.net/ns/gc#"
         xmlns:process="http://jazz.net/ns/process#"
         xmlns:oslc_acc="http://open-services.net/ns/core/acc#"
         xmlns:oslc_config_ext="http://jazz.net/ns/config_ext#"
         xmlns:dcterms="http://purl.org/dc/terms/"
         xmlns:oslc="http://open-services.net/ns/core#"
         xmlns:owl="http://www.w3.org/2002/07/owl#"
         xmlns:prov="http://www.w3.org/ns/prov#"
         xmlns:oslc_config="http://open-services.net/ns/config#"
         xmlns:foaf="http://xmlns.com/foaf/0.1/"
         xmlns:oslc_auto="http://open-services.net/ns/auto#"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
         xmlns:j.0="https://xxx/gc/type/attribute/"
         xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/">
                <rdf:Description rdf:about="https://xxx/gc/configuration/484">
                               <oslc_config_ext:rootTitle>Example baseline 1</oslc_config_ext:rootTitle>
                               <oslc_config_ext:rootDescription>Baseline description</oslc_config_ext:rootDescription>
                               <oslc_config_ext:rootConfiguration rdf:resource="https://xxx/gc/configuration/392"/>
                               <oslc_config_ext:addRootTag><j.0:_x93toAIhEe2dGMgvWzmIuw rdf:datatype="http://www.w3.org/2001/XMLSchema#string">113656</j.0:_x93toAIhEe2dGMgvWzmIuw></oslc_config_ext:addRootTag>
                </rdf:Description>
</rdf:RDF>

Error : Status Code: 500 CRJGC0500E An internal error occurred: http://www.w3.org/1999/02/22-rdf-syntax-ns#type cause=com.hp.hpl.jena.shared.PropertyNotFoundException

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.