<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.omg.com/dd/1.0.0" xmlns:dd="http://www.omg.com/dd/1.0.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:element name="namedElement" type="dd:NamedElement"/>
  <xsd:element name="package" type="dd:Package"/>
  <xsd:element name="viewDefinition" type="dd:ViewDefinition" abstract="true"/>
  <xsd:element name="nodeDefinition" type="dd:NodeDefinition" substitutionGroup="dd:viewDefinition"/>
  <xsd:element name="connectorDefinition" type="dd:ConnectorDefinition" substitutionGroup="dd:viewDefinition"/>
  <xsd:element name="diagramDefinition" type="dd:DiagramDefinition" substitutionGroup="dd:viewDefinition"/>
  <xsd:element name="childDefinition" type="dd:ChildDefinition"/>
  <xsd:element name="styleDefinition" type="dd:StyleDefinition"/>
  <xsd:element name="constraint" type="dd:Constraint"/>
  
  <xsd:complexType abstract="true" name="NamedElement">
    <xsd:attribute name="name" type="xsd:NCName" use="required"/>
  </xsd:complexType>
  
  <xsd:complexType name="Package">
    <xsd:complexContent>
      <xsd:extension base="dd:NamedElement">
        <xsd:sequence>
          <xsd:element maxOccurs="unbounded" minOccurs="0" ref="dd:viewDefinition"/>
        </xsd:sequence>
        <xsd:attribute name="nsURI" type="xsd:anyURI" use="required"/>
        <xsd:attribute name="nsPrefix" type="xsd:NCName" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType abstract="true" name="ViewDefinition">
    <xsd:complexContent>
      <xsd:extension base="dd:NamedElement">
        <xsd:sequence>
          <xsd:element maxOccurs="unbounded" minOccurs="0" ref="dd:constraint"/>
          <xsd:element maxOccurs="unbounded" minOccurs="0" ref="dd:styleDefinition"/>
          <xsd:element maxOccurs="unbounded" minOccurs="0" ref="dd:childDefinition"/>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:NCName" use="required"/>
        <xsd:attribute name="abstract" type="xsd:boolean"/>
        <xsd:attribute name="superDefinition" type="xsd:QName"/>
        <xsd:attribute name="contextType" type="xsd:QName"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <xsd:complexType name="NodeDefinition">
    <xsd:complexContent>
      <xsd:extension base="dd:ViewDefinition"/>
    </xsd:complexContent>
  </xsd:complexType>
  
  <xsd:complexType name="ConnectorDefinition">
    <xsd:complexContent>
      <xsd:extension base="dd:ViewDefinition">
        <xsd:attribute name="sourceDefinition" type="xsd:QName" use="required"/>
        <xsd:attribute name="targetDefinition" type="xsd:QName" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <xsd:complexType name="DiagramDefinition">
    <xsd:complexContent>
      <xsd:extension base="dd:ViewDefinition"/>
    </xsd:complexContent>
  </xsd:complexType>
  
  <xsd:complexType name="ChildDefinition">
    <xsd:complexContent>
      <xsd:extension base="dd:NamedElement">
        <xsd:attribute name="lowerBound" type="xsd:int" default="0" />
        <xsd:attribute name="upperBound" type="xsd:int" default="-1"/>
        <xsd:attribute name="typeDefinition" type="xsd:QName" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <xsd:complexType name="StyleDefinition">
    <xsd:complexContent>
      <xsd:extension base="dd:NamedElement">
        <xsd:attribute name="default" type="xsd:string"/>
        <xsd:attribute name="inherited" type="xsd:boolean" default="false"/>
        <xsd:attribute name="type" type="xsd:QName" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
  
  <xsd:complexType name="Constraint">
    <xsd:complexContent>
      <xsd:extension base="dd:NamedElement">
        <xsd:attribute name="condition" type="xsd:string" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

</xsd:schema>