<?xml version="1.0" encoding="utf-8"?>
<!--
     OData Version 4.0
     Committee Specification Draft 01 / Public Review Draft 01
     26 April 2013
     Copyright (c) OASIS Open 2013. All Rights Reserved.
	 Source: http://docs.oasis-open.org/odata/odata/v4.0/csprd01/schemas/
-->
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"  
           xmlns:edm="http://docs.oasis-open.org/odata/ns/edm" 
           targetNamespace="http://docs.oasis-open.org/odata/ns/edm">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      Entity Data Model part of the Common Schema Definition Language
    </xs:documentation>
  </xs:annotation>
  <xs:element name="Schema" type="edm:TSchema" />
  <xs:complexType name="TSchema">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="ComplexType" type="edm:TComplexType" />
        <xs:element name="EntityType" type="edm:TEntityType" />
        <xs:element name="TypeDefinition" type="edm:TTypeDefinition" />
        <xs:element name="EnumType" type="edm:TEnumType" />
        <xs:element name="Action" type="edm:TAction" />
        <xs:element name="Function" type="edm:TFunction" />
        <xs:element name="Term" type="edm:TTerm" />
        <xs:element name="Annotations" type="edm:TAnnotations" />
        <xs:element name="EntityContainer" type="edm:TEntityContainer" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="Namespace" type="edm:TNamespaceName" use="optional" />
    <xs:attribute name="Alias" type="edm:TSimpleIdentifier" use="optional" />
  </xs:complexType>
  <!-- 
        types of the top level elements 
    -->
  <xs:complexType name="TEntityType">
    <xs:sequence>
      <xs:element name="Key" type="edm:TEntityKeyElement" minOccurs="0" maxOccurs="1" />
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Property" type="edm:TProperty" />
        <xs:element name="NavigationProperty" type="edm:TNavigationProperty" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="edm:TDerivableTypeAttributes" />
    <xs:attribute name="HasStream" type="xs:boolean" use="optional" default="false" />
    <xs:attribute name="OpenType" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>
  <xs:complexType name="TEntityKeyElement">
    <xs:sequence>
      <xs:element name="PropertyRef" type="edm:TPropertyRef" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TPropertyRef">
    <xs:attribute name="Name" type="edm:TPath" use="required" />
    <xs:attribute name="Alias" type="edm:TSimpleIdentifier" use="optional" />
  </xs:complexType>
  <xs:complexType name="TComplexType">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Property" type="edm:TProperty" />
        <xs:element name="NavigationProperty" type="edm:TNavigationProperty" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="edm:TDerivableTypeAttributes" />
  </xs:complexType>
  <xs:complexType name="TProperty">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TCommonPropertyAttributes" />
  </xs:complexType>
  <xs:complexType name="TTypeDefinition">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="UnderlyingType" type="edm:TPrimitiveType" use="required" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
    <xs:attributeGroup ref="edm:TPropertyFacetAttributes" />
  </xs:complexType>
  <xs:complexType name="TNavigationProperty">
    <xs:sequence>
      <xs:element name="ReferentialConstraint" type="edm:TReferentialConstraint" minOccurs="0" maxOccurs="1" />
      <xs:element name="OnDelete" type="edm:TOnDelete" minOccurs="0" maxOccurs="1" />
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Type" type="edm:TTypeName" use="required" />
    <xs:attribute name="Nullable" type="xs:boolean" use="optional" />
    <xs:attribute name="Partner" type="edm:TSimpleIdentifier" use="optional" />
    <xs:attribute name="ContainsTarget" type="xs:boolean" use="optional" />
  </xs:complexType>
  <xs:complexType name="TReferentialConstraint">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Property" type="edm:TPath" use="required" />
    <xs:attribute name="ReferencedProperty" type="edm:TPath" use="required" />
  </xs:complexType>
   <xs:complexType name="TOnDelete">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Action" type="edm:TOnDeleteAction" use="required" />
  </xs:complexType>
  <xs:complexType name="TEnumType">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Member" type="edm:TEnumTypeMember" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="edm:TTypeAttributes" />
    <xs:attribute name="IsFlags" type="xs:boolean" use="optional" />
    <xs:attribute name="UnderlyingType" type="edm:TTypeName" use="optional" />
  </xs:complexType>
  <xs:complexType name="TEnumTypeMember">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Value" type="xs:long" use="optional" />
  </xs:complexType>
  <xs:complexType name="TActionFunctionReturnType">
    <xs:attribute name="Type" type="edm:TTypeName" use="optional" />
    <xs:attribute name="EntitySetPath" type="edm:TPath" use="optional" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
  </xs:complexType>  
  <xs:complexType name="TAction">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Parameter" type="edm:TActionFunctionParameter" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
      <xs:element name="ReturnType" type="edm:TActionFunctionReturnType" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TActionAttributes" />
  </xs:complexType>          
  <xs:complexType name="TFunction">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Parameter" type="edm:TActionFunctionParameter" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
      <xs:element name="ReturnType" type="edm:TActionFunctionReturnType" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TFunctionAttributes" />
  </xs:complexType>          
  <xs:complexType name="TActionFunctionParameter">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TActionFunctionParameterAttributes" />
  </xs:complexType>
  <!--
        vocabulary annotations
  -->
  <xs:complexType name="TTerm">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Type" type="edm:TTypeName" use="optional" />
    <xs:attribute name="Nullable" type="xs:boolean" use="optional" />
    <xs:attribute name="DefaultValue" type="xs:string" use="optional" />
    <xs:attribute name="AppliesTo" type="edm:TAppliesTo" use="optional" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
  </xs:complexType>
  <xs:complexType name="TAnnotations">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Target" type="edm:TPath" use="required" />
    <xs:attribute name="Qualifier" type="edm:TSimpleIdentifier" use="optional" />
  </xs:complexType>
  <xs:complexType name="TAnnotation">
    <xs:sequence>
      <xs:group ref="edm:GExpression" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Term" type="edm:TQualifiedName" use="required" />
    <xs:attribute name="Qualifier" type="edm:TSimpleIdentifier" use="optional" />
    <xs:attributeGroup ref="edm:GInlineExpressions" />
  </xs:complexType>
  <xs:group name="GExpression">
    <xs:choice>
      <!-- Constant Expressions -->
      <xs:element name="Binary" type="edm:TBinaryConstantExpression" />
      <xs:element name="Bool" type="edm:TBoolConstantExpression" />
      <xs:element name="Date" type="edm:TDateConstantExpression" />
      <xs:element name="DateTimeOffset" type="edm:TDateTimeOffsetConstantExpression" />
      <xs:element name="Decimal" type="edm:TDecimalConstantExpression" />
      <xs:element name="Duration" type="edm:TDurationConstantExpression" />
      <xs:element name="EnumMember" type="edm:TQualifiedNameList" />
      <xs:element name="Float" type="edm:TFloatConstantExpression" />
      <xs:element name="Guid" type="edm:TGuidConstantExpression" />
      <xs:element name="Int" type="edm:TIntConstantExpression" />
      <xs:element name="String" type="edm:TStringConstantExpression" />
      <xs:element name="TimeOfDay" type="edm:TTimeOfDayConstantExpression" />
      <!-- Dynamic Expressions -->
      <xs:element name="Apply" type="edm:TApplyExpression" />
      <xs:element name="AssertType" type="edm:TAssertTypeExpression" />
      <xs:element name="Collection" type="edm:TCollectionExpression" />
      <xs:element name="If" type="edm:TIfExpression" />
      <xs:element name="IsType" type="edm:TIsTypeExpression" />
      <xs:element name="LabeledElement" type="edm:TLabeledElement" />
      <xs:element name="LabeledElementReference" type="edm:TLabeledElementReferenceExpression" />
      <xs:element name="Null" type="edm:TNullExpression" />
      <xs:element name="NavigationPropertyPath" type="edm:TPathExpression" />
      <xs:element name="Path" type="edm:TPathExpression" />
      <xs:element name="PropertyPath" type="edm:TPathExpression" />
      <xs:element name="Record" type="edm:TRecordExpression" />
      <xs:element name="Url" type="edm:TUrlExpression" />
    </xs:choice>
  </xs:group>
  <xs:attributeGroup name="GInlineExpressions">
    <!-- Constant Expressions -->
    <xs:attribute name="Binary" type="xs:hexBinary" use="optional" />
    <xs:attribute name="Bool" type="xs:boolean" use="optional" />
    <xs:attribute name="Date" type="edm:date" use="optional" />
    <xs:attribute name="DateTimeOffset" type="edm:dateTimeStamp" use="optional" />
    <xs:attribute name="Decimal" type="xs:decimal" use="optional" />
    <xs:attribute name="Duration" type="edm:dayTimeDuration" use="optional" />
    <xs:attribute name="EnumMember" type="edm:TQualifiedNameList" use="optional" />
    <xs:attribute name="Float" type="xs:double" use="optional" />
    <xs:attribute name="Guid" type="edm:TGuidLiteral" use="optional" />
    <xs:attribute name="Int" type="xs:integer" use="optional" />
    <xs:attribute name="String" type="xs:string" use="optional" />
    <xs:attribute name="TimeOfDay" type="edm:time" use="optional" />
    <!-- Dynamic Expressions -->
    <xs:attribute name="NavigationPropertyPath" type="edm:TPathWithTermCast" use="optional" />
    <xs:attribute name="Path" type="edm:TPathWithTermCast" use="optional" />
    <xs:attribute name="PropertyPath" type="edm:TPathWithTermCast" use="optional" />
  </xs:attributeGroup>
  <!-- 
        Constant Expressions
  -->
  <xs:complexType name="TBinaryConstantExpression">
    <xs:simpleContent>
      <xs:extension base="xs:hexBinary"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TBoolConstantExpression">
    <xs:simpleContent>
      <xs:extension base="xs:boolean"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TDateConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm:date"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TDateTimeOffsetConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm:dateTimeStamp"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TDecimalConstantExpression">
    <xs:simpleContent>
      <xs:extension base="xs:decimal"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TDurationConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm:dayTimeDuration"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TFloatConstantExpression">
    <xs:simpleContent>
      <xs:extension base="xs:double"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TGuidConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm:TGuidLiteral"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:simpleType name="TGuidLiteral">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="TIntConstantExpression">
    <xs:simpleContent>
      <xs:extension base="xs:integer"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TStringConstantExpression">
    <xs:simpleContent>
      <xs:extension base="xs:string"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TTimeOfDayConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm:time"/>
    </xs:simpleContent>
  </xs:complexType>
  <!--
        Dynamic Expressions
  -->
  <xs:complexType name="TApplyExpression">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Function" type="edm:TClientFunction" use="optional" />
  </xs:complexType>
  <xs:complexType name="TAssertTypeExpression">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Type" type="edm:TTypeName" use="optional" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
  </xs:complexType>
  <xs:complexType name="TCollectionExpression">
    <xs:sequence>
      <xs:choice  minOccurs="0" maxOccurs="unbounded">
        <xs:element name="Annotation" type="edm:TAnnotation" />
        <xs:group ref="edm:GExpression" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TIfExpression">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <!-- Test, IfTrue, IfFalse -->
      <xs:group ref="edm:GExpression" minOccurs="3" maxOccurs="3" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TIsTypeExpression">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Type" type="edm:TTypeName" use="optional" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
  </xs:complexType>
  <xs:complexType name="TLabeledElement">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
  </xs:complexType>
  <xs:complexType name="TLabeledElementReferenceExpression">
    <xs:simpleContent>
      <xs:extension base="edm:TSimpleIdentifier"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TNullExpression">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TPathExpression">
    <xs:simpleContent>
      <xs:extension base="edm:TPathWithTermCast"/>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TRecordExpression">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="PropertyValue" type="edm:TPropertyValue" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="Type" type="edm:TQualifiedName" use="optional" />
  </xs:complexType>
  <xs:complexType name="TPropertyValue">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Property" type="edm:TSimpleIdentifier" use="required" />
    <xs:attributeGroup ref="edm:GInlineExpressions" />
  </xs:complexType>
  <xs:complexType name="TUrlExpression">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <!-- 
        attributes  
    -->
  <xs:attributeGroup name="TFacetAttributes">
    <xs:attribute name="MaxLength" type="edm:TMaxLengthFacet" use="optional" />
    <xs:attribute name="Precision" type="edm:TPrecisionFacet" use="optional" />
    <xs:attribute name="Scale" type="edm:TScaleFacet" use="optional" />
    <xs:attribute name="SRID" type="edm:TSridFacet" use="optional" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TPropertyFacetAttributes">
    <xs:attribute name="Unicode" type="edm:TUnicodeFacet" use="optional" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TCommonPropertyAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Type" type="edm:TTypeName" use="required" />
    <xs:attribute name="Nullable" type="xs:boolean" default="true" use="optional" />
    <xs:attribute name="DefaultValue" type="xs:string" use="optional" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
    <xs:attributeGroup ref="edm:TPropertyFacetAttributes" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TActionFunctionParameterAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Type" type="edm:TTypeName" use="required" />
    <xs:attribute name="Nullable" type="xs:boolean" use="optional" />
    <xs:attribute name="DefaultValue" type="xs:string" use="optional" />
    <xs:attributeGroup ref="edm:TFacetAttributes" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TActionAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="ReturnType" type="edm:TTypeName" use="optional" />
    <xs:attribute name="EntitySetPath" type="edm:TPath" use="optional" />
    <xs:attribute name="IsBindable" type="xs:boolean" use="optional" default="false" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TFunctionAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="ReturnType" type="edm:TTypeName" use="optional" />
    <xs:attribute name="EntitySetPath" type="edm:TPath" use="optional" />
    <xs:attribute name="IsBindable" type="xs:boolean" use="optional" default="false" />
    <xs:attribute name="IsComposable" type="xs:boolean" use="optional" default="false" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TTypeAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TDerivableTypeAttributes">
    <xs:attributeGroup ref="edm:TTypeAttributes" />
    <xs:attribute name="BaseType" type="edm:TQualifiedName" use="optional" />
    <xs:attribute name="Abstract" type="xs:boolean" use="optional" default="false" />
  </xs:attributeGroup>
  <!--
        container constructs 
    -->
  <xs:complexType name="TEntityContainer">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="EntitySet" type="edm:TEntitySet"/>
        <xs:element name="ActionImport" type="edm:TActionImport" />
        <xs:element name="FunctionImport" type="edm:TFunctionImport" />
        <xs:element name="Entity" type="edm:TEntity" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Extends" type ="edm:TSimpleIdentifier" use="optional" />
    <xs:attribute name="IsDefaultEntityContainer" type ="xs:boolean" use="optional" />
  </xs:complexType>
  <xs:complexType name="TEntitySet">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="NavigationPropertyBinding" type="edm:TNavigationPropertyBinding" />
        <xs:element name="Annotation" type="edm:TAnnotation" />
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="edm:TEntitySetAttributes" />
  </xs:complexType>
  <xs:complexType name="TNavigationPropertyBinding">
    <xs:attribute name="Path" type="edm:TPath" use="required" />
    <xs:attribute name="EntitySet" type="edm:TOptionallyQualifiedName" use="required" />
  </xs:complexType>
  <xs:attributeGroup name="TEntitySetAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="EntityType" type="edm:TQualifiedName" use="required" />
    <xs:attribute name="IncludeInServiceDocument" type="xs:boolean" use="optional" default="true" />
  </xs:attributeGroup>
  <xs:complexType name="TEntity">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Type" type="edm:TQualifiedName" use="required" />
  </xs:complexType>
  <xs:complexType name="TActionImport">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Action" type="edm:TQualifiedName" use="required" />
    <xs:attributeGroup ref="edm:TActionFunctionImportAttributes" />
  </xs:complexType>
  <xs:complexType name="TFunctionImport">
    <xs:sequence>
      <xs:element name="Annotation" type="edm:TAnnotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Function" type="edm:TQualifiedName" use="required" />
    <xs:attributeGroup ref="edm:TActionFunctionImportAttributes" />
  </xs:complexType>
  <xs:attributeGroup name="TActionFunctionImportAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="EntitySet" type="edm:TOptionallyQualifiedName" use="optional" />
    <xs:attribute name="IncludeInServiceDocument" type="xs:boolean" use="optional" default="false" />
  </xs:attributeGroup>
  <!-- 
        general purpose simple types 
    -->
  <xs:simpleType name="TNamespaceName">
    <xs:restriction base="edm:TOptionallyQualifiedName">
      <xs:maxLength value="511" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TSimpleIdentifier">
    <xs:restriction base="xs:string">
      <xs:maxLength value="128" />
      <!-- The below pattern represents the allowed identifiers in ECMA specification -->
      <xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}" />
    </xs:restriction>
  </xs:simpleType>
  <!-- TODO: where do we need this? -->
  <xs:simpleType name="TOptionallyQualifiedName">
    <xs:restriction base="xs:string">
      <!-- The below pattern represents the allowed identifiers in ECMA specification plus the '.' for namespace qualification  -->
      <xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TQualifiedName">
    <xs:restriction base="xs:string">
      <!-- The below pattern represents the allowed identifiers in ECMA specification plus the '.' for namespace qualification  -->
      <xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){1,}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TQualifiedNameList">
    <xs:list itemType="edm:TQualifiedName"/>
  </xs:simpleType>
  <xs:simpleType name="TTypeName">
    <xs:union memberTypes="edm:TPrimitiveType edm:TAbstractType edm:TQualifiedName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <!-- The below pattern represents the allowed identifiers in ECMA specification plus the '.' for namespace qualification and the Collection() wrapper  -->
          <xs:pattern value="Collection\([\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){1,}\)" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  <xs:simpleType name="TPath">
    <xs:restriction base="xs:string">
      <!-- The below pattern represents the allowed identifiers in ECMA specification plus the '.' for namespace qualification and the '/' for path segment separation -->
      <xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}([\./][\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TPathWithTermCast">
    <!-- Note: this pattern is overly generous: 
          - segments starting with @ must contain at least one dot
          - # is only allowed after segments starting with @ and containing at least one dot
          - at most one # is allowed per slash-separated segment 
    -->
    <xs:restriction base="xs:string">
      <!-- The below pattern represents the allowed identifiers in ECMA specification plus the '/' for path segment separation and
           the '.' for namespace qualification inside the segments. -->
      <xs:pattern value="@?[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}([\./#][@$]?[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TClientFunction">
    <xs:union memberTypes="edm:TQualifiedName">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="odata.concat" />
          <xs:enumeration value="odata.fillUriTemplate" />
          <xs:enumeration value="odata.uriEncode" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  <xs:simpleType name="TPrimitiveType">
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="Edm.Binary" />
          <xs:enumeration value="Edm.Boolean" />
          <xs:enumeration value="Edm.Byte" />
          <xs:enumeration value="Edm.Date" />
          <xs:enumeration value="Edm.DateTimeOffset" />
          <xs:enumeration value="Edm.Duration" />
          <xs:enumeration value="Edm.TimeOfDay" />
          <xs:enumeration value="Edm.Decimal" />
          <xs:enumeration value="Edm.Double" />
          <xs:enumeration value="Edm.Single" />
          <xs:enumeration value="Edm.GeographyPoint" />
          <xs:enumeration value="Edm.GeographyLineString" />
          <xs:enumeration value="Edm.GeographyPolygon" />
          <xs:enumeration value="Edm.GeographyMultiPoint" />
          <xs:enumeration value="Edm.GeographyMultiLineString" />
          <xs:enumeration value="Edm.GeographyMultiPolygon" />
          <xs:enumeration value="Edm.GeographyCollection" />
          <xs:enumeration value="Edm.GeometryPoint" />
          <xs:enumeration value="Edm.GeometryLineString" />
          <xs:enumeration value="Edm.GeometryPolygon" />
          <xs:enumeration value="Edm.GeometryMultiPoint" />
          <xs:enumeration value="Edm.GeometryMultiLineString" />
          <xs:enumeration value="Edm.GeometryMultiPolygon" />
          <xs:enumeration value="Edm.GeometryCollection" />
          <xs:enumeration value="Edm.Guid" />
          <xs:enumeration value="Edm.Int16" />
          <xs:enumeration value="Edm.Int32" />
          <xs:enumeration value="Edm.Int64" />
          <xs:enumeration value="Edm.String" />
          <xs:enumeration value="Edm.SByte" />
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="Edm\..+" />
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  <xs:simpleType name="TAbstractType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Edm.ComplexType" />
      <xs:enumeration value="Edm.EntityType" />
      <xs:enumeration value="Edm.Geography" />
      <xs:enumeration value="Edm.Geometry" />
      <xs:enumeration value="Edm.PrimitiveType" />
      <xs:enumeration value="Edm.NavigationPropertyPath" />
      <xs:enumeration value="Edm.PropertyPath" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TAppliesTo">
    <xs:list> 
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="Action" />
          <xs:enumeration value="ActionImport" />
          <xs:enumeration value="Annotations" />
          <xs:enumeration value="Documentation" />
          <xs:enumeration value="ComplexType" />
          <xs:enumeration value="Entity" />
          <xs:enumeration value="EntityContainer" />
          <xs:enumeration value="EntitySet" />
          <xs:enumeration value="EntityType" />
          <xs:enumeration value="EnumType" />
          <xs:enumeration value="Function" />
          <xs:enumeration value="FunctionImport" />
          <xs:enumeration value="Member" />
          <xs:enumeration value="NavigationProperty" />
          <xs:enumeration value="OnDelete" />
          <xs:enumeration value="Parameter" />
          <xs:enumeration value="Property" />
          <xs:enumeration value="ReferentialConstraint" />
          <xs:enumeration value="Schema" />
          <xs:enumeration value="Term" />
        </xs:restriction>
      </xs:simpleType>
    </xs:list>
  </xs:simpleType>
  <xs:simpleType name="TMax">
    <xs:restriction base="xs:string">
      <xs:enumeration value="max" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="TVariable">
    <xs:restriction base="xs:string">
      <xs:enumeration value="variable" />
    </xs:restriction>
  </xs:simpleType>
  <!-- Facets for Primitive types -->
  <xs:simpleType name="TMaxLengthFacet">
    <xs:union memberTypes="edm:TMax xs:nonNegativeInteger" />
  </xs:simpleType>
  <xs:simpleType name="TPrecisionFacet">
    <xs:restriction base="xs:nonNegativeInteger" />
  </xs:simpleType>
  <xs:simpleType name="TScaleFacet">
    <xs:union memberTypes="edm:TVariable xs:nonNegativeInteger" />
  </xs:simpleType>
  <xs:simpleType name="TSridFacet">
    <xs:union memberTypes="edm:TVariable xs:nonNegativeInteger" />
  </xs:simpleType>
  <xs:simpleType name="TUnicodeFacet">
    <xs:restriction base="xs:boolean" />
  </xs:simpleType>
  <xs:simpleType name="TOnDeleteAction">
    <xs:restriction base="xs:token">
      <xs:enumeration value="Cascade" />
      <xs:enumeration value="None" />
      <xs:enumeration value="SetDefault" />
      <xs:enumeration value="SetNull" />
    </xs:restriction>
  </xs:simpleType>
  <!-- date and time without offset -->
  <xs:simpleType name="date">
    <xs:restriction base="xs:date">
      <xs:pattern value="[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="time">
    <xs:restriction base="xs:time">
      <xs:pattern value="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]{1,12})?"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- Copy of xs:dateTimeStamp from XML Schema 1.1, see http://www.w3.org/TR/xmlschema11-2/#dateTimeStamp -->
  <xs:simpleType name="dateTimeStamp">
    <xs:restriction base="xs:dateTime">
      <xs:pattern value=".*([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]{1,12})?(Z|(\+|-)[0-9][0-9]:[0-9][0-9])"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- Copy of xs:dayTimeDuration from XML Schema 1.1, see http://www.w3.org/TR/xmlschema11-2/#dayTimeDuration -->
  <xs:simpleType name="dayTimeDuration">
    <xs:restriction base="xs:duration">
      <xs:pattern value="[^YM]*[DT].*"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>