Links are managed in the OSLC AM specification with additional properties in the resource definition. These properties are not defined in this specification, rather their format and usage is.
External Properties
Generic properties can be included in a resource’s representation as simple namespace qualified XML elements. These are not assumed to be resource links unless they specify a rdf:resource
attribute. For example the following property is not considered a resource link.
<acme:accountCode>CUST123</acme:accountCode>
In terns of RDF, this would be asserting the accountCode property of some (unspecified) subject has a literal object value, not a URI to some other object.
Expressing Links
A property with an attribute of rdf:resource
whose value is a URL is considered a resource link. To explain how links are managed lets look at the resource format for an AM resource.
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:oslc="http://open-services.net/xmlns/core#"
xmlns:oslc_am="http://open-services.net/xmlns/am#"
xmlns:acme="http://acme.com/terms/">
<oslc_am:Resource rdf:about="https://acme.com/resources/res1">
<dcterms:title>ServiceInterface</dcterms:title>
<dcterms:identifier>res1</dcterms:identifier>
<dcterms:description>
This may come from the model element's documentation properties.
</dc:description>
<rdf:type rdf:resource="http://www.eclipse.org/uml2/3.0.0/UML/Interface" />
<!-- the following is a generic property, not a resource link -->
<acme:accountCode>CUST123</acme:accountCode>
<!-- The following is a link to another resource -->
<acme:elaborates rdf:resource="https://req.acme.com/reqs/req1"/>
</oslc_am:Resource>
</rdf:RDF>
In this example beyond the normal properries (title, description, type and format) there is the additional property <acme:elaborates>
. This property can be interpreted as a resource link with a link type of elaborates
(in the acme namespace) and an object (target) of https://req.acme.com/reqs/req1
.
We associate properties to the link itself with a <rdf:Description
> element. So if we wanted to associate a property called status and a short description with the link itself (and not the AM or external resource), we would create a <rdf:Description>
element that explicitly provides the additional property to the link property, which is now identified locally with an rdf:id
attribute.
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:oslc="http://open-services.net/xmlns/core#"
xmlns:oslc_am="http://open-services.net/xmlns/am#"
xmlns:acme="http://acme.com/terms/">
<oslc_am:Resource rdf:about="https://acme.com/resources/res1">
<dcterms:title>ServiceInterface</dcterms:title>
<dcterms:description rdf:ID="id2">
This may come from the model element's documentation properties.
</dcterms:description>
<rdf:type rdf:resource="http://www.eclipse.org/uml2/3.0.0/UML/Interface" />
<dcterms:format>application/x-uml+xml</dcterms:format>
<acme:accountCode>CUST123</acme:accountCode>
<!-- The following is a link to another resource -->
<acme:elaborates rdf:ID="id1" rdf:resource="https://req.acme.com/reqs/req1"/>
</oslc_am:Resource>
<rdf:Description rdf:about="#id1">
<acme:status>reviewed</acme:status>
<dcterms:description>This resource covers the intent entirely.</dcterms:description>
</rdf:Description>
<rdf:Description rdf:about="#id2">
<dcterms:creator>jim conallen</dcterms:creator>
</rdf:Description>
</rdf:RDF>
Using the simple query specification we can search for and find all resources that have a particular link type to a particular resource. So for example suppose we want to find all AM resources that have an <acme:elaborates>
relationship to the resource https://req.acme.com/reqs/req1
. The simple query (not URL encoded for readability) is:
http://acme.com/am/query?
oslc.where=elaborates=<https://req.acme.com/reqs/req1>
&oslc;.prefix=acme=<http://acme.com/terms/>
Using a wildcard in the term allows us to make the query to find all resources with any relationship to the specified external resource.
http://acme.com/am/query?oslc.where=*=<https://req.acme.com/reqs/req1>
Discovering available link types
A client can ask the service provider for a list of known link types via a call to the Link Types Resource.