HistoryViewLinks to this page 2012 September 7 | 02:25 pm

In this scenario a client adds a new link type to the list of know link types that the service provider can provide to clients. The expectation is that this link type is used in links from architecture resources to other resources.

This scenario requires that the client has already discovered the Link Type Service URI via the service catalog.

The client has a URI reference to an AM link type service ( https://am.acme.com/linktypes/project1).

1. The client performs a POST on the link type service URI with an link type description resource. The content type MUST be application/atom+xml.

If successful the service provider returns a 201 Created response with the Location and ETag header of the newly created resource. These values are used to modify this resource in the future. The server returns the OSLC Link Type resource, optionally including the read only creator and created properties. The service provider MAY use simple text for these properties or use the FOAF vocabulary to define the creator, and/or provide a formatted, machine readable date time ( See resource format definition).

Request

POST https://am.acme.com/linktypes/project1
Content-Type: application/x-oslc-am-linktype+xml 

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:dc="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <oslc:LinkType rdf:about="http://acme.com/linktype/implements">
        <dc:title>Implements</dc:title>
        <dc:description>
            The subject resource provides an implementation of the subject resource.
        </dc:description>
   </oslc:LinkType>
</rdf:RDF>  

Response

201 Created
ETag: "_Hsosakwidja2kas9alabdk"
Location: https://am.acme.com/linktypes/project1/_asdi23orisgksqw34ls
Content-Type: application/x-oslc-am-linktype+xml

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:dc="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <oslc:LinkType rdf:about="http://acme.com/linktype/implements">
        <dc:title>Implements</dc:title>
        <dc:description>
            The subject resource provides an implementation of the subject resource.
        </dc:description>
        <dc:creator>Jim Conallen</dc:creator>
        <dc:created>18-Jan-2010</dc:created>
   </oslc:LinkType>

</rdf:RDF>

In this example the client attempts to add a new link type definition, however a definition already exists for this link type.

The client has a URI reference to an AM link type service ( https://am.acme.com/linktypes/project1).

1. The client performs a POST on the link type service URI with an link type description resource. The content type MUST be application/atom+xml.

If the link type predicate is already in use the server responds with a 403 Forbidden and includes a description of the error in the response.

Request

POST https://am.acme.com/linktypes/project1
Content-Type: application/x-oslc-am-linktype+xml

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:dc="http://purl.org/dc/terms/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <oslc:LinkType rdf:about="http://acme.com/linktype/implements">
        <dc:title>Implements</dc:title>
        <dc:description>
            The subject resource provides an implementation of the subject resource.
        </dc:description>
   </oslc:LinkType>
</rdf:RDF>  

Response

403 Forbidden
Content-Type: application/rdf+xml

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:oslc="http://open-services.net/xmlns/common/1.0/">
    <oslc:Error>
        <oslc:statusCode>403</oslc:statusCode>
        <oslc:message>The link type <http://acme.com/linktype/implements> is already defined.</oslc:message>
    </oslc:Error>
</rdf:RDF>