It's all about the answers!

Ask a question

How to add artifacts in collection using OSLC


Sanitha Pillai (61910) | asked Mar 06 '13, 4:31 a.m.
Need to add artifacts in a collection. Tried the following steps:-
1) Did a get on the artifact
2) Updated the RDF with the following line :-
<oslc_rm:uses rdf:resource="https://clm20124.accenture.com/rm/resources/_wtD10IYxEeKDfYJELFVegw"/>

But this didnt update the artifact.

2 answers



permanent link
Edgar Ignacio Velazquez Mar (7225) | answered Mar 06 '13, 10:56 a.m.
JAZZ DEVELOPER
 Make sure you have the following headers:
OSLC-Core-Version=2.0
Accept=application/rdf+xml
If-Match= "_C9-QgYZ2EeKEQsxslOt1-g"

If-Match header is the etag header you get by doing a GET on the artifact.
Also check the RDF like you add is inside the
  <rdf:Description rdf:about="https://server:port/rm/resources/_Ef2S1HbnEeK9wNdPpoPpMw">
...
  </rdf:Description>

Comments
Sanitha Pillai commented Mar 06 '13, 10:25 p.m.

Hi,

Yes, I had used the above mentioned headers and added the tag inside the <rdf:description>  tag. But still i am unable to add the artifact in the collection.


permanent link
Gabriel Ruelas (1.1k13) | answered Mar 06 '13, 6:44 p.m.
Hi,

a couple of questions ?
Which is the HTTP rc returned from the PUT ?
When you do a GET to the Collection ( your step 1 ) Does the body returned contains other oslc_rm:uses ( assuming your Collection contains other artifacts.?

Comments
Sanitha Pillai commented Mar 06 '13, 10:33 p.m.

Hi,

I am doing a GET on the artifact and not on the collection . I  updated the RDF content and added the  content :-<oslc_rm:uses rdf:resource="https://clm20124.accenture.com/rm/resources/_wtD10IYxEeKDfYJELFVegw"/>;
and did a PUT on the artifact.

These steps are given in the article :- https://jazz.net/library/article/1197/ 

Section 7 :-

7. Adding artifacts to and removing them from a collection

Requirements that belong to a collections are exposed as entries of the "oslc_rm:uses" type. A complete sample entry is as follows:

<oslc_rm:uses rdf:resource="https://grarrc.ibm.com:9443/rm/resources/_mLHpsbrhEeG3OKR6fZ1svQ"/>;

To add artifacts to or remove artifacts from a collection, follow these steps:

  1. Obtain, or get, the collection.
  2. Either add or remove the "oslc_rm:uses" entries in the RDF.
  3. Update (Put ) the resource back in with the modified RDF.


1
Gabriel Ruelas commented Mar 07 '13, 9:56 a.m.

Hi,
The GET should be done to the Collection and add the oslc:uses to the Collection RDF.

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.