It's all about the answers!

Ask a question

Linking two artifacts using RRC API


Brati Sankar Ghosh (633) | asked Sep 12 '12, 7:14 a.m.
Is it possible to link two artifacts in RRC using the rest service APIs?

3 answers



permanent link
Gabriel Ruelas (1.1k13) | answered Sep 12 '12, 9:51 a.m.
It is possible to link two artifact using an OSLC defined link type. Linking with an internal link type is not supported.

Comments
Brati Sankar Ghosh commented Sep 13 '12, 7:18 a.m.

Hi Gabriel, can you please guide us to some examples/documents on the above topic.


permanent link
Gabriel Ruelas (1.1k13) | answered Sep 13 '12, 11:43 a.m.
Assuming that you already got the artifact URL of both artifacts to be linked:
Note: Following headers must be specified:
    Accept=application/rdf+xml
    OSLC-Core-Version=2.0

1) Do an OSLC GET to one artifact.
2) Add to the returned information :
    2.1 : In the artifact body
          <oslc_rm:implementedBy rdf:ID="n0" rdf:resource="YOUR ARTIFACT URL"/>

  2.1 Outside the artifact body ( but inside the RDF ):

      <rdf:Description rdf:about="#n0">
           <dc:title rdf:parseType="Literal">LINKLNAME</dc:title>
      </rdf:Description>

3) Do an OSLC PUT to the artifact with this new body. The content-type must be set to application/rdf+xml and also add the header : If-Match using the vale of the etag header returned in the OSLC GET


An example of the body will looks like :

<rdf:RDF
    .
    .
    .
<rdf:Description rdf:about="">
            .
            .
            .
    <oslc_rm:implementedBy rdf:ID="n0" rdf:resource="YOUR ARTIFACT URL"/>
            .
            .
            .
 </rdf:Description>
  <rdf:Description rdf:about="#n0">
      <dc:title rdf:parseType="Literal">LINKNAME</dc:title>
 </rdf:Description>
</rdf:RDF>




Comments
Samanwita Majumdar commented Jan 02 '13, 3:56 a.m.

I tried the approach. But the XML is not well formed and hence the linking does not happen. I tried tweaking the XML but that does not help.
I am pasting the portion of my XML. Could you please help me understand what needs to be corrected in the same.

<oslc_rm:implementedby rdf:ID="n0" rdf:resource="https://sowb-clm.dst.ibm.com:9443/rm/resources/_RfcrASTQEeKRXOX1D-rc1A" <a="" href="rdf:ID=" n0&quot"="" target="_blank"> />

and after close of requirement tag

</rdf:description>
  <rdf:description <a="" href="rdf:about=" #n0"&gt"="" target="_blank">rdf:about="#n0">;
      <dc:title <a="" href="rdf:parseType=" Literal"="">Associated</dc:title&gt">rdf:parseType="Literal">Associated</dc:title&gt<>;
 </rdf:description>


permanent link
Gabriel Ruelas (1.1k13) | answered Jan 07 '13, 11:04 a.m.
Hi,  We have published an article with sample of using OSLC in RRC : https://jazz.net/library/article/1197 
Check :

6. Adding and removing links


Comments
Binoy D'costa commented Apr 19 '13, 12:51 p.m.

Does this link exists? I get : "The library item that you requested cannot be found. It might have been removed, or is temporarily unavailable."

Thanks,
Binoy


Gabriel Ruelas commented Apr 19 '13, 1:51 p.m.

There is an extra space at the end of the link, Try :
https://jazz.net/library/article/1197


Binoy D'costa commented May 08 '13, 12:06 p.m.

Are any of the other link types like Extracter From, Link to etc supported? I can't seem to update them through the REST API.


Gabriel Ruelas commented May 08 '13, 1:20 p.m.

Extracted From and Link To are internal RM links, Those can not be created/modified using OSLC API.  The only link types allowed to create/modify are the ones defined in the OSLC spec ( like validatedBy, implementedBy etc )

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.