<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="visTrail">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="action" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="tag" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:attribute name="version" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="action">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="notes" minOccurs="0" maxOccurs="unbounded"/>
        <xs:choice>
          <xs:element name="addModule" ref="object" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="addConnection" ref="connect" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="changeParameter" ref="set" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="changeAnnotation" ref="set" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="addModulePort" ref="addPort" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="moveModule" ref="move" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="deleteModule" ref="module" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="deleteConnection" ref="connection" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="deleteFunction" ref="function" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="deleteAnnotation" ref="annotation" minOccurs="0" maxOccurs="unbounded"/>
          <xs:element name="deleteModulePort" ref="deletePort" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
      </xs:sequence>
      <xs:attribute name="time" type="xs:int"/>
      <xs:attribute name="parent" type="xs:int"/>
      <xs:attribute name="user" type="xs:string"/>
      <xs:attribute name="what" type="xs:string"/>
      <xs:attribute name="date" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="tag">
    <xs:complexType>
      <xs:attribute name="time" type="xs:int"/>
      <xs:attribute name="name" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="object">
    <xs:complexType>
      <xs:attribute name="id" type="xs:int"/>
      <xs:attribute name="cache" type="xs:int"/>
      <xs:attribute name="name" type="xs:string"/>
      <xs:attribute name="x" type="xs:float"/>
      <xs:attribute name="y" type="xs:float"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="connect">
    <xs:complexType>
      <xs:attribute name="id" type="xs:int"/>
      <xs:attribute name="destinationId" type="xs:int"/>
      <xs:attribute name="destinationModule" type="xs:string"/>
      <xs:attribute name="destinationPort" type="xs:string"/>
      <xs:attribute name="sourceId" type="xs:int"/>
      <xs:attribute name="sourceModule" type="xs:string"/>
      <xs:attribute name="sourcePort" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="set">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
      <xs:attribute name="alias" type="xs:string"/>
      <xs:attribute name="functionId" type="xs:int"/>
      <xs:attribute name="function" type="xs:string"/>
      <xs:attribute name="parameterId" type="xs:int"/>
      <xs:attribute name="parameter" type="xs:string"/>
      <xs:attribute name="type" type="xs:string"/>
      <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="set">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
      <xs:attribute name="key" type="xs:string"/>
      <xs:attribute name="value" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="addPort">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
      <xs:attribute name="portType" type="xs:string"/>
      <xs:attribute name="portName" type="xs:string"/>
      <xs:attribute name="portSpec" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="move">
    <xs:complexType>
      <xs:attribute name="id" type="xs:int"/>
      <xs:attribute name="dx" type="xs:float"/>
      <xs:attribute name="dy" type="xs:float"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="module">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="connection">
    <xs:complexType>
      <xs:attribute name="connectionId" type="xs:int"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="function">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
      <xs:attribute name="functionId" type="xs:int"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="annotation">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
      <xs:attribute name="key" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="deletePort">
    <xs:complexType>
      <xs:attribute name="moduleId" type="xs:int"/>
      <xs:attribute name="portType" type="xs:string"/>
      <xs:attribute name="portName" type="xs:string"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
