Linking two artifacts using RRC API
![]()
Is it possible to link two artifacts in RRC using the rest service APIs?
|
3 answers
![]()
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 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.
|
![]()
Hi, We have published an article with sample of using OSLC in RRC : https://jazz.net/library/article/1197
Check : 6. Adding and removing linksComments Does this link exists? I get : "The library item that you requested cannot be found. It might have been removed, or is temporarily unavailable."
There is an extra space at the end of the link, Try :
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.
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 )
|