Linking two artifacts using RRC API
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>
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
Hi, We have published an article with sample of using OSLC in RRC : https://jazz.net/library/article/1197
Check :
Check :