<?xml version="1.0" encoding="UTF-8"?>
<!--
// Description : design.xsd
// Author: The SPIRIT Consortium Schema Working Group
// 
// Revision:    $Revision: 1235 $
// Date:        $Date: 2008-04-03 12:08:47 -0500 (Thu, 03 Apr 2008) $
// 
// Copyright (c) 2005, 2006, 2007, 2008 The SPIRIT Consortium.
// 
// This work forms part of a deliverable of The SPIRIT Consortium.
// 
// Use of these materials are governed by the legal terms and conditions
// outlined in the disclaimer available from www.spiritconsortium.org.
// 
// This source file is provided on an AS IS basis.  The SPIRIT
// Consortium disclaims any warranty express or implied including
// any warranty of merchantability and fitness for use for a
// particular purpose.
// 
// The user of the source file shall indemnify and hold The SPIRIT
// Consortium and its members harmless from any damages or liability.
// Users are requested to provide feedback to The SPIRIT Consortium
// using either mailto:feedback@lists.spiritconsortium.org or the forms at 
// http://www.spiritconsortium.org/about/contact_us/
// 
// This file may be copied, and distributed, WITHOUT
// modifications; this notice must be included on any copy.
-->
<xs:schema xmlns:spirit="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.5" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.5" elementFormDefault="qualified" attributeFormDefault="qualified">
    <xs:include schemaLocation="commonStructures.xsd"/>
    <xs:include schemaLocation="subInstances.xsd"/>
    <xs:include schemaLocation="model.xsd"/>
    <xs:include schemaLocation="port.xsd"/>
    <xs:element name="design">
        <xs:annotation>
            <xs:documentation>Root element for a platform design.</xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:group ref="spirit:versionedIdentifier"/>
                <xs:element ref="spirit:componentInstances" minOccurs="0"/>
                <xs:element ref="spirit:interconnections" minOccurs="0"/>
                <xs:element ref="spirit:adHocConnections" minOccurs="0"/>
                <xs:element name="hierConnections" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>A list of hierarchy connections between bus interfaces on component instances and the bus interfaces on the encompassing component.</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="hierConnection" maxOccurs="unbounded">
                                <xs:annotation>
                                    <xs:documentation>Represents a hierarchy connection</xs:documentation>
                                </xs:annotation>
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="interface" type="spirit:interface">
                                            <xs:annotation>
                                                <xs:documentation>Component and bus reference to export to the upper level component.

The componentRef and busRef attributes indicate the instance name and bus interface name (active or monitor) of the hierachical connection.</xs:documentation>
                                            </xs:annotation>
                                        </xs:element>
                                        <xs:element ref="spirit:vendorExtensions" minOccurs="0"/>
                                    </xs:sequence>
                                    <xs:attribute name="interfaceRef" type="xs:Name" use="required">
                                        <xs:annotation>
                                            <xs:documentation>This is the name of the bus interface on the upper level component.</xs:documentation>
                                        </xs:annotation>
                                    </xs:attribute>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element ref="spirit:description" minOccurs="0"/>
                <xs:element ref="spirit:vendorExtensions" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
        <xs:key name="designComponentInstanceKey">
            <xs:selector xpath="spirit:componentInstances/spirit:componentInstance"/>
            <xs:field xpath="spirit:instanceName"/>
        </xs:key>
        <xs:keyref name="designComponentMonitorInstanceRef" refer="spirit:designComponentInstanceKey">
            <xs:selector xpath=".//spirit:monitorInterface"/>
            <xs:field xpath="@spirit:componentRef"/>
        </xs:keyref>
        <xs:keyref name="designInterconnectionActiveInstanceRef" refer="spirit:designComponentInstanceKey">
            <xs:selector xpath="spirit:interconnections/spirit:interconnection/spirit:activeInterface"/>
            <xs:field xpath="@spirit:componentRef"/>
        </xs:keyref>
        <xs:keyref name="designHierConnectionActiveInstanceRef" refer="spirit:designComponentInstanceKey">
            <xs:selector xpath="spirit:hierConnections/spirit:hierConnection/spirit:interface"/>
            <xs:field xpath="@spirit:componentRef"/>
        </xs:keyref>
        <xs:keyref name="designAdhocConnectionActiveInstanceRef" refer="spirit:designComponentInstanceKey">
            <xs:selector xpath="spirit:adHocConnections/spirit:adHocConnection/spirit:internalPortReference"/>
            <xs:field xpath="@spirit:componentRef"/>
        </xs:keyref>
        <xs:unique name="designInterconnectionName">
            <xs:selector xpath=".//spirit:interconnection|.//spirit:monitorInterconnection"/>
            <xs:field xpath="spirit:name"/>
        </xs:unique>
        <xs:unique name="designAdHocName">
            <xs:selector xpath=".//spirit:adHocConnection"/>
            <xs:field xpath="spirit:name"/>
        </xs:unique>
    </xs:element>
</xs:schema>
