A link is a resource which describes some relationship amongst other resources. We focus here on binary relationships - those involving exactly two resources, oftern referred to as "source" and "target". The source and target can be related in many different ways, for example, a requirement resource might be linked to a test case resource; a requirement might be linked to a change request resource. These links are have a different purpose (they are used in different ways, for instance). The nature of the relationship is captured by the "type" of the link. The type is essentially a name which describes the semantics of the link.
A link is represented by an RDF resource with type "oslc_rm:Link" having properties which describe the source, target and type of the link. Collections of links have a different media type but are simply aggregations of individual link resources.
Namespaces
The source, target and type of a link are described by the URIs of those resources using an RDF resource of type "oslc:Link" having the properties described in the table below.
The media type used for this RDF/XML representation MUST be application/x-oslc-common-link+xml.
The following properties are defined on an OSLC RM link resource:
Property | Required on Read | Required on Write | Read-only | Represents |
---|---|---|---|---|
rdf:subject | Yes | Yes | Yes | The source of the link |
rdf:object | Yes | Yes | Yes | The target of the link |
rdf:predicate | Yes | Yes | Yes | The type of the link |
dc:description | No | No | No | Some description of the link |
dc:creator | No | No | Yes | Who created the link. The value of this element is free form text, or may a FOAF Person element. If the user has a URI it should be represented as a rdf:resource attribute of this element. |
dc:created | No | No | Yes | When the link was created. Can be expressed as free form text, or in a standard form. When in a form that can be automated, the rdf:datatype attribute with a public date time URI should be present to assist the client in parsing the value (i.e. http://www.w3.org/2001/XMLSchema#dateTime). |
dc:contributor | No | No | Yes | Who last modified the link. The value of this element is free form text, or may a FOAF Person element. If the user has a URI it should be represented as a rdf:resource attribute of this element. |
dc:modified | No | No | Yes | When the link was last modified. MAY be expressed as free form text, or in a standard form. When in a form that can be automated, the rdf:datatype property with a public date time URI should be present to assist the client in parsing the value (i.e. http://www.w3.org/2001/XMLSchema#dateTime). |
In this example the link resource describes an "implementedBy" relation between a workitem (which is the target of the link) and a requirement (the source).
GET http://www.example.com/resources/links/link1 Accept: application/x-oslc-common-link+xml <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:oslc="http://open-services.net/xmlns/common/1.0/" xmlns:dc="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <oslc:Link rdf:about="http://www.example.com/resources/links/link1"> <rdf:subject rdf:resource="http://www.example.com/resources/requirement55"/> <rdf:object rdf:resource="http://www.example.com/resources/workitem24"/> <rdf:predicate rdf:resource="http://www.example.com/types/implementedBy"/> <dc:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"> 2009-10-20T19:49:47-04:00 </dc:created> <dc:creator>Ian Green</dc:creator> <dc:contributor> <foaf:Person> <foaf:name>A. N. Other</foaf:name> <foaf:mbox rdf:resource="mailto:another@example.com" /> <foaf:img rdf:resource="https://example.com/users/another/photo"/> </foaf:Person> </dc:contributor> </oslc:Link> </rdf:RDF>
A link collection resource describes a multiplicity (a number of) of links that are in some way related. A common usage of a link collection resource is to describe the link resources which are associated with a requirement or requirement collection. A link collection is described by a resource of rdf:type "rdf:Bag" which providers must be able to represent as an RDF/XML document having media type application/x-oslc-common-link-collection+xml. A link collection is an rdf:Bag containing the inlined representation of link in that collection. The special case of a link collection which does not contain any links is represented as rdf:Bag that does not contain any <rdf:li> properties.
The following table describes the RDF properties whose meaning is defined by this specification:
Property | Required on Read | Required on Write | Read-only | Represents |
---|---|---|---|---|
rdf:li | No | No | No | RDF list item addressing each of the collected resources. |
The representation of a link collection is the aggregation of the representations of each of the links in that collection.
This example shows the two links that are associated with a resource "requirement55".
GET http://example.com/requirements/24/links Accept: application/x-oslc-common-link-collection+xml <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:rm="http://open-services.net/xmlns/rm/1.0/" xmlns:oslc="http://open-services.net/xmlns/common/1.0/" xmlns:dc="http://purl.org/dc/terms/"> <rdf:Bag rdf:about="http://example.com/requirements/24/links"> <rdf:li> <oslc:Link rdf:about="http://www.example.com/resources/links/link1"> <rdf:subject rdf:resource="http://www.example.com/resources/requirement55"/> <rdf:object rdf:resource="http://www.example.com/resources/workitem24"/> <rdf:predicate rdf:resource="http://www.example.com/types/implementedBy"/> <dc:modified>29 August 2009</dc:modified> <dc:creator>Ian Green</dc:creator> </oslc:Link> </rdf:li> <rdf:li> <oslc:Link rdf:about="http://www.example.com/resources/links/link2"> <rdf:subject rdf:resource="http://www.example.com/resources/requirement1"/> <rdf:object rdf:resource="http://www.example.com/resources/requirement55"/> <rdf:predicate rdf:resource="http://www.example.com/types/satisfiedBy"/> <dc:modified>1 January 2000</dc:modified> </oslc:Link> </rdf:li> </rdf:Bag> </rdf:RDF>