The overall process for creating a link from a DM resource to another OSLC backed resource is to simply update (PUT) the DM resource with a simple property that is registered as a link type for the DM project that 'owns' the resource.
We use the OSLC Simple Query interface to query for a specific DM resource. The resource is of type diagram, and has the title "JKE Overview"
Request:
Query Parameters
GET https://example.com:9435/dm/oslcquery/_ATqQYvddEeGIbrXzZZZ7PA?oslc.where=rdf%3Atype%3D%3Chttp%3A%2F%2Fjazz.net%2Fns%2Fdm%2Frsa%2Fuml%2Fnotation%23UMLDiagram%3E+and+dcterms%3Atitle%3D%22JKE+Overview%22 HTTP/1.1
Headersoslc.where=rdf:type=<http://jazz.net/ns/dm/rsa/uml/notation#UMLDiagram> and dcterms:title="JKE Overview"
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Response:
Headers
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/rdf+xml
Content-Length: 989
Date: Thu, 27 Sep 2012 13:39:32 GMT
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> <rdf:Description rdf:about="https://example.com:9435/dm/oslcquery/_ATqQYvddEeGIbrXzZZZ7PA"> <rdfs:member rdf:resource="https://example.com:9435/dm/models/30"/> </rdf:Description> <rdf:Description rdf:about="https://example.com:9435/dm/oslcquery/_ATqQYvddEeGIbrXzZZZ7PA?page=0&pageToken=&oslc.where=rdf%3Atype%3D%3Chttp%3A%2F%2Fjazz.net%2Fns%2Fdm%2Frsa%2Fuml%2Fnotation%23UMLDiagram%3E+and+dcterms%3Atitle%3D%22JKE+Overview%22"> <oslc:totalCount rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</oslc:totalCount> <dcterms:title>OSLC AM Query Response</dcterms:title> <rdf:type rdf:resource="http://open-services.net/ns/core#ResponseInfo"/> </rdf:Description> </rdf:RDF>
The query returned the a matching resource with the uri: https://example.com:9435/dm/models/30
Now with the URI of DM resource, and the URI of a work item, we can create a link between the two by PUTing the new link in the DM resource. We begin by GETing the most recent OSLC representatiom of the diagram. Be sure to grab the ETag from the headers.
Request:
Headers
GET https://example.com:9435/dm/models/30 HTTP/1.1
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Response:
Headers
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ETag: e6c0b6374e180529161e549e5a088367
Location: https://example.com:9435/dm/models/30
OSLC-Core-Version: 2.0
Last-Modified: Thu, 27 Sep 2012 13:39:35 GMT
Content-Type: application/rdf+xml
Content-Length: 2936
Date: Thu, 27 Sep 2012 13:39:34 GMT
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:acp="http://jazz.net/ns/acp#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dmcore="http://jazz.net/ns/dm/core#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:j.0="http://jazz.net/xmlns/rmps/index/1.0/" xmlns:j.1="http://jazz.net/ns/dm/diagram#" xmlns:j.2="http://jazz.net/ns/dm/linktypes#" xmlns:jfs="http://jazz.net/xmlns/foundation/1.0/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_am="http://open-services.net/ns/am#" xmlns:oslc_rm2="http://open-services.net/ns/rm#Requirement" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rsa_uml="http://jazz.net/ns/dm/rsa/uml#"> <rdf:Description rdf:about="https://example.com:9435/dm/models/30"> <rdf:type rdf:resource="http://jazz.net/ns/dm/diagram#Diagram"/> <oslc:serviceProvider rdf:resource="https://example.com:9435/dm/oslc_am/_ATqQYvddEeGIbrXzZZZ7PA"/> <j.2:derives rdf:resource="https://example.com:9435/rm/resources/_I1rUwfddEeGawIUDtsNoKw"/> <acp:accessControl rdf:resource="https://example.com:9435/dm/acp/project/_ATqQYvddEeGIbrXzZZZ7PA"/> <dcterms:title>JKE Overview</dcterms:title> <dcterms:identifier>30</dcterms:identifier> <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-05T13:33:32.810Z</dcterms:created> <dcterms:contributor rdf:resource="https://example.com:9435/jts/users/dm_user"/> <dcterms:creator rdf:resource="https://example.com:9435/jts/users/dm_user"/> <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-05T13:33:51.013Z</dcterms:modified> <rdf:type rdf:resource="http://open-services.net/ns/am#Resource"/> <j.2:derives rdf:resource="https://example.com:9435/rm/resources/_J_-kuvddEeGawIUDtsNoKw"/> </rdf:Description> <rdf:Description rdf:nodeID="A0"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#derives"/> <rdf:object rdf:resource="https://example.com:9435/rm/resources/_I1rUwfddEeGawIUDtsNoKw"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>Mandatory set of requirements.</dcterms:description> </rdf:Description> <rdf:Description rdf:nodeID="A1"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#derives"/> <rdf:object rdf:resource="https://example.com:9435/rm/resources/_J_-kuvddEeGawIUDtsNoKw"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>Additional requirements, prioritized.</dcterms:description> </rdf:Description> </rdf:RDF>
To add a link from the DM resource to the work item we insert a simple property with a reference to the work item. In this example the predicate of the link is http://jazz.net/ns/dm/linktypes#elaborates
. DM allows you to add description property to the link itself. This is displayed in the UI just under the link. The description is added using a reified statement. In the example below the simple property is added to the diagram resource URI. The reified statement points back to that property and contains a dcterms:description property.
<?xml version="1.0"?> <rdf:RDF xmlns:j.0="http://jazz.net/xmlns/rmps/index/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:j.1="http://jazz.net/ns/dm/diagram#" xmlns:acp="http://jazz.net/ns/acp#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:jfs="http://jazz.net/xmlns/foundation/1.0/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dmcore="http://jazz.net/ns/dm/core#" xmlns:rsa_uml="http://jazz.net/ns/dm/rsa/uml#" xmlns:oslc_rm2="http://open-services.net/ns/rm#Requirement" xmlns:j.2="http://jazz.net/ns/dm/linktypes#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:oslc_am="http://open-services.net/ns/am#"> <rdf:Description rdf:about="https://example:9443/dm/models/256"> <rdf:type rdf:resource="http://open-services.net/ns/am#Resource" /> <dcterms:title>JKE Overview</dcterms:title> <!-- other properties ommitted for clarity --> <j.2:elaborates rdf:resource="https://example:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/67" /> </rdf:Description> <!-- the following is a reified statement that is used to attach an optional description property to the link. --> <rdf:Description rdf:nodeID="A0"> <rdf:subject rdf:resource="https://example:9443/dm/models/256" /> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#elaborates" /> <rdf:object rdf:resource="https://example:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/67" /> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" /> <dcterms:description>A sample OSLC link.</dcterms:description> </rdf:Description> </rdf:RDF>
Request:
Headers
PUT https://example.com:9435/dm/models/30 HTTP/1.1
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
If-Match: e6c0b6374e180529161e549e5a088367
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:acp="http://jazz.net/ns/acp#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dmcore="http://jazz.net/ns/dm/core#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:j.0="http://jazz.net/xmlns/rmps/index/1.0/" xmlns:j.1="http://jazz.net/ns/dm/diagram#" xmlns:j.2="http://jazz.net/ns/dm/linktypes#" xmlns:jfs="http://jazz.net/xmlns/foundation/1.0/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_am="http://open-services.net/ns/am#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rsa_uml="http://jazz.net/ns/dm/rsa/uml#"> <rdf:Description rdf:nodeID="A0"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#elaborates"/> <rdf:object rdf:resource="https://example.com:9435/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/79"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>A sample description on a link.</dcterms:description> </rdf:Description> <rdf:Description rdf:about="https://example.com:9435/dm/models/30"> <rdf:type rdf:resource="http://jazz.net/ns/dm/diagram#Diagram"/> <oslc:serviceProvider rdf:resource="https://example.com:9435/dm/oslc_am/_ATqQYvddEeGIbrXzZZZ7PA"/> <j.2:derives rdf:resource="https://example.com:9435/rm/resources/_I1rUwfddEeGawIUDtsNoKw"/> <acp:accessControl rdf:resource="https://example.com:9435/dm/acp/project/_ATqQYvddEeGIbrXzZZZ7PA"/> <dcterms:title>JKE Overview</dcterms:title> <dcterms:identifier>30</dcterms:identifier> <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-05T13:33:32.810Z</dcterms:created> <dcterms:contributor rdf:resource="https://example.com:9435/jts/users/dm_user"/> <dcterms:creator rdf:resource="https://example.com:9435/jts/users/dm_user"/> <j.2:elaborates rdf:resource="https://example.com:9435/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/79"/> <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-05T13:33:51.013Z</dcterms:modified> <rdf:type rdf:resource="http://open-services.net/ns/am#Resource"/> <j.2:derives rdf:resource="https://example.com:9435/rm/resources/_J_-kuvddEeGawIUDtsNoKw"/> </rdf:Description> <rdf:Description rdf:nodeID="A1"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#derives"/> <rdf:object rdf:resource="https://example.com:9435/rm/resources/_I1rUwfddEeGawIUDtsNoKw"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>Mandatory set of requirements.</dcterms:description> </rdf:Description> <rdf:Description rdf:nodeID="A2"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#derives"/> <rdf:object rdf:resource="https://example.com:9435/rm/resources/_J_-kuvddEeGawIUDtsNoKw"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>Additional requirements, prioritized.</dcterms:description> </rdf:Description> </rdf:RDF>Response:
Headers
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ETag: 2d81a7237d662268713b73d9dca4e052
OSLC-Core-Version: 2.0
Content-Length: 0
Date: Thu, 27 Sep 2012 13:39:41 GMT
Request:
Headers
GET https://example.com:9435/dm/models/30 HTTP/1.1
Accept: application/rdf+xml
OSLC-Core-Version: 2.0
Response:
Headers
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ETag: 709f7c0b529f51d93d19872004cfddb9
Location: https://example.com:9435/dm/models/30
OSLC-Core-Version: 2.0
Last-Modified: Thu, 27 Sep 2012 13:39:44 GMT
Content-Type: application/rdf+xml
Content-Length: 3564
Date: Thu, 27 Sep 2012 13:39:44 GMT
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:acp="http://jazz.net/ns/acp#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dmcore="http://jazz.net/ns/dm/core#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:j.0="http://jazz.net/xmlns/rmps/index/1.0/" xmlns:j.1="http://jazz.net/ns/dm/diagram#" xmlns:j.2="http://jazz.net/ns/dm/linktypes#" xmlns:jfs="http://jazz.net/xmlns/foundation/1.0/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_am="http://open-services.net/ns/am#" xmlns:oslc_rm2="http://open-services.net/ns/rm#Requirement" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rsa_uml="http://jazz.net/ns/dm/rsa/uml#"> <rdf:Description rdf:about="https://example.com:9435/dm/models/30"> <rdf:type rdf:resource="http://jazz.net/ns/dm/diagram#Diagram"/> <oslc:serviceProvider rdf:resource="https://example.com:9435/dm/oslc_am/_ATqQYvddEeGIbrXzZZZ7PA"/> <j.2:derives rdf:resource="https://example.com:9435/rm/resources/_I1rUwfddEeGawIUDtsNoKw"/> <acp:accessControl rdf:resource="https://example.com:9435/dm/acp/project/_ATqQYvddEeGIbrXzZZZ7PA"/> <dcterms:title>JKE Overview</dcterms:title> <dcterms:identifier>30</dcterms:identifier> <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-05T13:33:32.810Z</dcterms:created> <dcterms:contributor rdf:resource="https://example.com:9435/jts/users/dm_user"/> <dcterms:creator rdf:resource="https://example.com:9435/jts/users/dm_user"/> <j.2:elaborates rdf:resource="https://example.com:9435/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/79"/> <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2012-09-05T13:33:51.013Z</dcterms:modified> <rdf:type rdf:resource="http://open-services.net/ns/am#Resource"/> <j.2:derives rdf:resource="https://example.com:9435/rm/resources/_J_-kuvddEeGawIUDtsNoKw"/> </rdf:Description> <rdf:Description rdf:nodeID="A0"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#derives"/> <rdf:object rdf:resource="https://example.com:9435/rm/resources/_I1rUwfddEeGawIUDtsNoKw"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>Mandatory set of requirements.</dcterms:description> </rdf:Description> <rdf:Description rdf:nodeID="A1"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#derives"/> <rdf:object rdf:resource="https://example.com:9435/rm/resources/_J_-kuvddEeGawIUDtsNoKw"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>Additional requirements, prioritized.</dcterms:description> </rdf:Description> <rdf:Description rdf:nodeID="A2"> <rdf:subject rdf:resource="https://example.com:9435/dm/models/30"/> <rdf:predicate rdf:resource="http://jazz.net/ns/dm/linktypes#elaborates"/> <rdf:object rdf:resource="https://example.com:9435/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/79"/> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement"/> <dcterms:description>A sample description on a link.</dcterms:description> </rdf:Description> </rdf:RDF>
Notice that the ETag value for the resource has changed from e6c0b6374e180529161e549e5a088367
to 709f7c0b529f51d93d19872004cfddb9
. Changes in OSLC links affect the ETag of the resource.