Creating links on Windchill issues using OSLC services

The process to create an OSLC link on a Windchill artifact is the following:

  1. Execute a GET request on the Windchill artifact OSLC URL to obtain the current content of the resource.
  2. Modify in memory the content of the artifact to add a new link to a target resource.
  3. Execute a PUT request on the Windchill artifact OSLC URL to inject the new content.

This page provides guidance on how to add a unidirectional link from a Windchill artifact to a remote OSLC resource. The same process is to apply to create the reverse link in the remote OSLC resource to target the Windchill artifact.

To execute those REST requests, you are free to use the REST library of your choice. You may use the MDAccess for OSLC library to ease the execution of requests.

GET the resource

Here is the REST request to obtain the Windchill artifact as an OSLC resource:

<rdf:RDF 
  ...
  <rdf:Description rdf:about="https://SERVER:PORT/Windchill/oslc-connect/cm/changeRequest?changeRequest=OR:wt.change2.WTChangeRequest2:IDENTIFIER">
    <dcterms:title rdf:parseType="Literal">Test</dcterms:title>
    <rdf:type rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
    ...
  </rdf:Description>
</rdf:RDF>

Modify the resource content in memory

The intent is now to add a link targeting an OSLC remote resource in this XML content.

If for example the Windchill artifact is to implement a requirement, the link type to use is http://open-services.net/ns/cm#implementsRequirement and the new resource content should be something like:

<rdf:RDF 
  ...
  <rdf:Description rdf:about="https://SERVER:PORT/Windchill/oslc-connect/cm/changeRequest?changeRequest=OR:wt.change2.WTChangeRequest2:IDENTIFIER">
    <dcterms:title rdf:parseType="Literal">Test</dcterms:title>
    <rdf:type rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
    ...
    <oslc_cm:implementsRequirement rdf:resource="https://REMOTE-SERVER:REMOTE-PORT/myRemoteApp/myRequirement/IDENTIFIER"/>
    ...
  </rdf:Description>
</rdf:RDF>

Refer to the Links across OSLC domains section for details on link types.

PUT the resource

Here is the REST request to update the content of the Windchill artifact: