The process to create an OSLC link on a Windchill artifact is the following:
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.
Here is the REST request to obtain the Windchill artifact as an OSLC resource:
GET
Authorization
: Windchill user and password encoded as BASIC authenticationAccept
: application/rdf+xml
OSLC-Core-Version
: 2.0
ETag
: resource version identifier<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>
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.
Here is the REST request to update the content of the Windchill artifact:
PUT
Authorization
: Windchill user and password encoded as BASIC authenticationAccept
: application/rdf+xml
OSLC-Core-Version
: 2.0
If-Match
: The value of the ETag
header received in the GET response