[GC] Update custom tags in GC baseline using OSLC
Hi,
I am able to create GC baseline via the OSLC.
This link helped me a lot : https://jazz.net/gc/doc/scenario?id=CreateBaseline
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
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.
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.
3 other answers
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
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
- Status Code: 202 Accepted
- keep-alive: timeout=5, max=100
- location: https://xxx/gc/activity/__DlpQAJ6Ee2dGMgvWzmIuw
This is documented in https://jazz.net/gc/doc/scenario?id=CreateBaseline
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
If you want to remove all tags from the root baseline, specify a
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 -
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>
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