<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:tns="http://docs.oasis-open.org/s-ramp/ns/s-ramp-v1.0" 
  xmlns:s-ramp="http://docs.oasis-open.org/s-ramp/ns/s-ramp-v1.0" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://docs.oasis-open.org/s-ramp/ns/s-ramp-v1.0" 
  elementFormDefault="qualified" version="1.0">
  <!--
      (c) 2010 Hewlett-Packard Company (HP), International Business Machines
      Corporation (IBM), Software AG (SAG) and TIBCO Software Inc. All
      rights reserved. Permission to copy and display the SOA Repository
      Artifact Model and Protocol (the “Specification”), in any medium
      without fee or royalty is hereby granted by Hewlett-Packard Company
      (HP), International Business Machines Corporation (IBM), Software AG
      (SAG) and TIBCO Software Inc. (collectively, the "Authors"), provided
      that you include the following on ALL copies of this document or
      portions thereof, that you make: 
      
      1. A link or URL to this document at this location:
      http://docs.oasis-open.org/s-ramp/ns/s-ramp-v1.0/serviceimplementationmodel.xsd
       
      2. The copyright notice as shown in the Specification. 
      
      The Authors each agree to grant you a royalty-free license, under
      reasonable, non-discriminatory terms and conditions to their
      respective patents that they deem necessary to implement the "SOA
      Repository Artifact Model and Protocol” Specification, including all
      its constituent documents. THIS DOCUMENT IS PROVIDED "AS IS," AND THE
      AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
      INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS
      FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
      CONTENTS OF THIS DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE
      IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY
      PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. THE AUTHORS WILL NOT
      BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR
      CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR
      DISTRIBUTION OF THIS DOCUMENT.
  -->

  <xsd:include schemaLocation="coremodel.xsd" />
  <xsd:include schemaLocation="soamodel.xsd" />

  <xsd:simpleType name="serviceImplementationModelEnum">
    <xsd:restriction base="s-ramp:baseArtifactEnum">
      <xsd:enumeration value="ServiceInstance" />
      <xsd:enumeration value="ServiceOperation" />
      <xsd:enumeration value="ServiceEndpoint" />
      <xsd:enumeration value="ServiceOperation" />
    </xsd:restriction>
  </xsd:simpleType>
  
  <xsd:simpleType name="serviceInstanceEnum">
    <xsd:restriction base="s-ramp:serviceImplementationModelEnum">
      <xsd:enumeration value="ServiceInstance" />
    </xsd:restriction>
  </xsd:simpleType>
  
  <xsd:simpleType name="serviceOperationEnum">
    <xsd:restriction base="s-ramp:serviceImplementationModelEnum">
      <xsd:enumeration value="ServiceOperation" />
    </xsd:restriction>
  </xsd:simpleType>
  
  <!-- All Service Implementation Model artifacts inherit from ServiceImplementationModelType. 
       Service Implementation Model Artifacts can have associated documents. 
       
       Service Implementation Model Artifacts can have dependencies upon other Service 
       Implementation Model Artifacts. -->

  <!-- Service Model Artifact Type -->
  <xsd:complexType name="ServiceImplementationModelType" abstract="true">
    <xsd:complexContent>
      <xsd:extension base="s-ramp:BaseArtifactType">
        <xsd:sequence>
          <!-- Modeled Relationship(s) to documentArtifactType: -->
          <xsd:element name="documentation" type="s-ramp:documentArtifactTarget" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:anyAttribute namespace="##any" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <!-- Organization artifact Type. Used primarily in Service Model -->
  <xsd:complexType name="Organization">
    <xsd:complexContent>
      <xsd:extension base="s-ramp:Actor">
        <xsd:sequence>
          <!-- Modeled Relationship(s) to ServiceImplementationModelType: -->
          <xsd:element name="provides" type="s-ramp:serviceImplementationModelTarget" minOccurs="0" maxOccurs="unbounded" />
          <xsd:element name="extension" type="tns:ExtensionType" minOccurs="0" />
          <xsd:element name="end" type="xsd:string" minOccurs="1" maxOccurs="1" />
          <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:anyAttribute namespace="##any" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="ServiceInstance">
    <xsd:complexContent>
      <xsd:extension base="tns:ServiceImplementationModelType">
        <xsd:sequence>
          <!-- Modeled Relationship(s) to ServiceInstance(s): -->
          <xsd:element name="uses" type="s-ramp:serviceInstanceTarget" minOccurs="0" maxOccurs="unbounded" />
          <!-- Modeled Relationship(s) to ServiceEndpoint(s): -->
          <xsd:element name="describedBy" type="s-ramp:serviceInstanceTarget" minOccurs="0" maxOccurs="unbounded" />
          <xsd:element name="extension" type="tns:ExtensionType" minOccurs="0" />
          <xsd:element name="end" type="xsd:string" minOccurs="1" maxOccurs="1" />
          <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:anyAttribute namespace="##any" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="ServiceOperation">
    <xsd:complexContent>
      <xsd:extension base="tns:ServiceImplementationModelType">
        <xsd:sequence>
          <!-- Modeled Relationship to the DerivedArtifactType that defines this ServiceOperation: -->
          <xsd:element name="operationDefinedBy" type="s-ramp:derivedArtifactTarget" minOccurs="0" maxOccurs="1" />
          <xsd:element name="extension" type="tns:ExtensionType" minOccurs="0" />
          <xsd:element name="end" type="xsd:string" minOccurs="1" maxOccurs="1" />
          <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:anyAttribute namespace="##any" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="ServiceEndpoint">
    <xsd:complexContent>
      <xsd:extension base="tns:ServiceImplementationModelType">
        <xsd:sequence>
          <!-- Modeled Relationship with DerivedArtifactType which defines this ServiceEndpoint: -->
          <xsd:element name="endpointDefinedBy" type="s-ramp:derivedArtifactTarget" minOccurs="0" maxOccurs="1" />
          <xsd:element name="extension" type="tns:ExtensionType" minOccurs="0" />
          <xsd:element name="end" type="xsd:string" minOccurs="1" maxOccurs="1" />
          <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:attribute name="url" type="xsd:anyURI" />
        <xsd:anyAttribute namespace="##any" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <!-- Generic Extension Type for all un-used element extension points in tns -->
  <xsd:complexType name="ExtensionType">
    <xsd:sequence>
      <xsd:any processContents="lax" minOccurs="1" maxOccurs="unbounded" namespace="##targetNamespace" />
    </xsd:sequence>
    <xsd:anyAttribute namespace="##any" />
  </xsd:complexType>

  <!-- Relationship referencing the artifact's UUID, to reference a ServiceImplementationModel. -->
  <xsd:complexType name="serviceImplementationModelTarget">
    <xsd:complexContent>
      <xsd:extension base="s-ramp:target">
        <xsd:attribute name="artifactType" type="s-ramp:serviceImplementationModelEnum" use="required" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Relationship referencing the artifact's UUID, to reference a ServiceInstance. -->
  <xsd:complexType name="serviceInstanceTarget">
    <xsd:complexContent>
      <xsd:extension base="s-ramp:target">
        <xsd:attribute name="artifactType" type="s-ramp:serviceInstanceEnum" use="required" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <!-- Relationship referencing the artifact's UUID, to reference a ServiceOperation. -->
  <xsd:complexType name="serviceOperationTarget">
    <xsd:complexContent>
      <xsd:extension base="s-ramp:target">
        <xsd:attribute name="artifactType" type="s-ramp:serviceOperationEnum" use="required" />
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:schema>	