<?xml version="1.0" encoding="utf-8"?>
<!--
     OData Version 4.0
     Committee Specification Draft 03 / Public Review Draft 03
     03 October 2013
     Copyright (c) OASIS Open 2013. All Rights Reserved.
     Source: http://docs.oasis-open.org/odata/odata/v4.0/csprd03/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">
    <xs:complexType>
      <xs:choice minOccurs="1" 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 ref="edm:Annotation" />
      </xs:choice>
      <xs:attribute name="Namespace" type="edm:TNamespaceName" use="required" />
      <xs:attribute name="Alias" type="edm:TSimpleIdentifier" use="optional" />
    </xs:complexType>
  </xs:element>
  <!--
        types of the top level elements 
    -->
  <xs:complexType name="TEntityType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="Key" type="edm:TEntityKeyElement" minOccurs="0" maxOccurs="1" />
      <xs:element name="Property" type="edm:TProperty" />
      <xs:element name="NavigationProperty" type="edm:TNavigationProperty" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <xs:attributeGroup ref="edm:TDerivableTypeAttributes" />
    <xs:attribute name="OpenType" type="xs:boolean" use="optional" default="false" />
    <xs:attribute name="HasStream" 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:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="Property" type="edm:TProperty" />
      <xs:element name="NavigationProperty" type="edm:TNavigationProperty" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <xs:attributeGroup ref="edm:TDerivableTypeAttributes" />
    <xs:attribute name="OpenType" type="xs:boolean" use="optional" default="false" />
  </xs:complexType>
  <xs:complexType name="TProperty">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TCommonPropertyAttributes" />
  </xs:complexType>
  <xs:complexType name="TTypeDefinition">
    <xs:sequence>
      <xs:element ref="edm:Annotation" 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:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="ReferentialConstraint" type="edm:TReferentialConstraint" />
      <xs:element name="OnDelete" type="edm:TOnDelete" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <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:TPath" use="optional" />
    <xs:attribute name="ContainsTarget" type="xs:boolean" use="optional" />
  </xs:complexType>
  <xs:complexType name="TReferentialConstraint">
    <xs:sequence>
      <xs:element ref="edm:Annotation" 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 ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Action" type="edm:TOnDeleteAction" use="required" />
  </xs:complexType>
  <xs:complexType name="TEnumType">
    <xs:choice minOccurs="1" maxOccurs="unbounded">
      <xs:element name="Member" type="edm:TEnumTypeMember" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <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 ref="edm:Annotation" 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="required" />
    <xs:attribute name="Nullable" type="xs:boolean" 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 ref="edm:Annotation" />
      </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 ref="edm:Annotation" />
      </xs:choice>
      <xs:element name="ReturnType" type="edm:TActionFunctionReturnType" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TFunctionAttributes" />
  </xs:complexType>
  <xs:complexType name="TActionFunctionParameter">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attributeGroup ref="edm:TActionFunctionParameterAttributes" />
  </xs:complexType>
  <!--
        vocabulary annotations
  -->
  <xs:complexType name="TTerm">
    <xs:sequence>
      <xs:element ref="edm:Annotation" 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="BaseTerm" type="edm:TQualifiedName" 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 ref="edm:Annotation" minOccurs="1" 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:element name="Annotation">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
        <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:element>
  <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:TEnumMemberList" />
      <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="AnnotationPath" type="edm:TPathExpression" />
      <xs:element name="Apply" type="edm:TApplyExpression" />
      <xs:element name="Cast" type="edm:TCastOrIsOfExpression" />
      <xs:element name="Collection" type="edm:TCollectionExpression" />
      <xs:element name="If" type="edm:TIfExpression" />
      <xs:element name="Eq" type="edm:TTwoChildrenExpression" />
      <xs:element name="Ne" type="edm:TTwoChildrenExpression" />
      <xs:element name="Ge" type="edm:TTwoChildrenExpression" />
      <xs:element name="Gt" type="edm:TTwoChildrenExpression" />
      <xs:element name="Le" type="edm:TTwoChildrenExpression" />
      <xs:element name="Lt" type="edm:TTwoChildrenExpression" />
      <xs:element name="And" type="edm:TTwoChildrenExpression" />
      <xs:element name="Or" type="edm:TTwoChildrenExpression" />
      <xs:element name="Not" type="edm:TOneChildExpression" />
      <xs:element name="IsOf" type="edm:TCastOrIsOfExpression" />
      <xs:element name="LabeledElement" type="edm:TLabeledElementExpression" />
      <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="UrlRef" type="edm:TOneChildExpression" />
    </xs:choice>
  </xs:group>
  <xs:attributeGroup name="GInlineExpressions">
    <!-- Constant Expressions -->
    <xs:attribute name="Binary" type="edm:binary" use="optional" />
    <xs:attribute name="Bool" type="edm: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:TEnumMemberList" 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="AnnotationPath" type="edm:TPathWithTermSegments" use="optional" />
    <xs:attribute name="NavigationPropertyPath" type="edm:TPathWithTermSegments" use="optional" />
    <xs:attribute name="Path" type="edm:TPathWithTermSegments" use="optional" />
    <xs:attribute name="PropertyPath" type="edm:TPathWithTermSegments" use="optional" />
    <xs:attribute name="UrlRef" type="xs:anyURI" use="optional" />
  </xs:attributeGroup>
  <!-- 
        Constant Expressions
  -->
  <xs:complexType name="TBinaryConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm:binary" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TBoolConstantExpression">
    <xs:simpleContent>
      <xs:extension base="edm: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 ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
    <xs:attribute name="Function" type="edm:TClientFunction" use="optional" />
  </xs:complexType>
  <xs:complexType name="TCastOrIsOfExpression">
    <xs:sequence>
      <xs:element ref="edm:Annotation" 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:choice minOccurs="0" maxOccurs="unbounded">
      <xs:group ref="edm:GExpression" />
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="TIfExpression">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
      <!-- Condition, Then, optional Else -->
      <xs:group ref="edm:GExpression" minOccurs="2" maxOccurs="3" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TOneChildExpression">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TTwoChildrenExpression">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="2" maxOccurs="2" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TLabeledElementExpression">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
      <xs:group ref="edm:GExpression" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attributeGroup ref="edm:GInlineExpressions" />
  </xs:complexType>
  <xs:complexType name="TLabeledElementReferenceExpression">
    <xs:simpleContent>
      <xs:extension base="edm:TQualifiedName" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TNullExpression">
    <xs:sequence>
      <xs:element ref="edm:Annotation" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="TPathExpression">
    <xs:simpleContent>
      <xs:extension base="edm:TPathWithTermSegments" />
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="TRecordExpression">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="PropertyValue" type="edm:TPropertyValue" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <xs:attribute name="Type" type="edm:TQualifiedName" use="optional" />
  </xs:complexType>
  <xs:complexType name="TPropertyValue">
    <xs:sequence>
      <xs:element ref="edm:Annotation" 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>
  <!-- 
        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:attributeGroup ref="edm:TFacetAttributes" />
  </xs:attributeGroup>
  <xs:attributeGroup name="TActionAttributes">
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="EntitySetPath" type="edm:TPath" use="optional" />
    <xs:attribute name="IsBound" 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="EntitySetPath" type="edm:TPath" use="optional" />
    <xs:attribute name="IsBound" 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:choice minOccurs="1" 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="Singleton" type="edm:TSingleton" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <xs:attribute name="Name" type="edm:TSimpleIdentifier" use="required" />
    <xs:attribute name="Extends" type="edm:TQualifiedName" use="optional" />
  </xs:complexType>
  <xs:complexType name="TEntitySet">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="NavigationPropertyBinding" type="edm:TNavigationPropertyBinding" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <xs:attributeGroup ref="edm:TEntitySetAttributes" />
  </xs:complexType>
  <xs:complexType name="TNavigationPropertyBinding">
    <xs:attribute name="Path" type="edm:TPath" use="required" />
    <xs:attribute name="Target" type="edm:TPath" 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="TSingleton">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="NavigationPropertyBinding" type="edm:TNavigationPropertyBinding" />
      <xs:element ref="edm:Annotation" />
    </xs:choice>
    <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 ref="edm:Annotation" 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 ref="edm:Annotation" 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:TPath" use="optional" />
    <xs:attribute name="IncludeInServiceDocument" type="xs:boolean" use="optional" default="false" />
  </xs:attributeGroup>
  <!-- 
        general purpose simple types 
    -->
  <xs:simpleType name="TSimpleIdentifier">
    <xs:restriction base="xs:NCName">
      <xs:maxLength value="128" />
      <!-- ECMAScript identifiers not starting with a '$' -->
      <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>
  <xs:simpleType name="TNamespaceName">
    <xs:restriction base="xs:NCName">
      <xs:maxLength value="511" />
      <!-- one or more SimpleIdentifiers separated by dots -->
      <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:NCName">
      <!-- a NamespaceName followed by a dot and a SimpleIdentifier -->
      <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="TEnumMemberList">
    <xs:list itemType="edm:TPath" />
  </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 the ECMAScript 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 the ECMAScript 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="TPathWithTermSegments">
    <!-- Note: this pattern is overly generous, for the strict definition see http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part3-csdl.html -->
    <xs:restriction base="xs:string">
      <!-- The below pattern represents the allowed identifiers in the ECMAScript 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,}(/$count)?" />
    </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:enumeration value="Collection(Edm.Binary)" />
          <xs:enumeration value="Collection(Edm.Boolean)" />
          <xs:enumeration value="Collection(Edm.Byte)" />
          <xs:enumeration value="Collection(Edm.Date)" />
          <xs:enumeration value="Collection(Edm.DateTimeOffset)" />
          <xs:enumeration value="Collection(Edm.Duration)" />
          <xs:enumeration value="Collection(Edm.TimeOfDay)" />
          <xs:enumeration value="Collection(Edm.Decimal)" />
          <xs:enumeration value="Collection(Edm.Double)" />
          <xs:enumeration value="Collection(Edm.Single)" />
          <xs:enumeration value="Collection(Edm.GeographyPoint)" />
          <xs:enumeration value="Collection(Edm.GeographyLineString)" />
          <xs:enumeration value="Collection(Edm.GeographyPolygon)" />
          <xs:enumeration value="Collection(Edm.GeographyMultiPoint)" />
          <xs:enumeration value="Collection(Edm.GeographyMultiLineString)" />
          <xs:enumeration value="Collection(Edm.GeographyMultiPolygon)" />
          <xs:enumeration value="Collection(Edm.GeographyCollection)" />
          <xs:enumeration value="Collection(Edm.GeometryPoint)" />
          <xs:enumeration value="Collection(Edm.GeometryLineString)" />
          <xs:enumeration value="Collection(Edm.GeometryPolygon)" />
          <xs:enumeration value="Collection(Edm.GeometryMultiPoint)" />
          <xs:enumeration value="Collection(Edm.GeometryMultiLineString)" />
          <xs:enumeration value="Collection(Edm.GeometryMultiPolygon)" />
          <xs:enumeration value="Collection(Edm.GeometryCollection)" />
          <xs:enumeration value="Collection(Edm.Guid)" />
          <xs:enumeration value="Collection(Edm.Int16)" />
          <xs:enumeration value="Collection(Edm.Int32)" />
          <xs:enumeration value="Collection(Edm.Int64)" />
          <xs:enumeration value="Collection(Edm.String)" />
          <xs:enumeration value="Collection(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.PrimitiveType" />
      <xs:enumeration value="Edm.Geography" />
      <xs:enumeration value="Edm.Geometry" />
      <xs:enumeration value="Edm.AnnotationPath" />
      <xs:enumeration value="Edm.NavigationPropertyPath" />
      <xs:enumeration value="Edm.PropertyPath" />
      <xs:enumeration value="Collection(Edm.ComplexType)" />
      <xs:enumeration value="Collection(Edm.EntityType)" />
      <xs:enumeration value="Collection(Edm.PrimitiveType)" />
      <xs:enumeration value="Collection(Edm.Geography)" />
      <xs:enumeration value="Collection(Edm.Geometry)" />
      <xs:enumeration value="Collection(Edm.AnnotationPath)" />
      <xs:enumeration value="Collection(Edm.NavigationPropertyPath)" />
      <xs:enumeration value="Collection(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="Annotation" />
          <xs:enumeration value="Apply" />
          <xs:enumeration value="Cast" />
          <xs:enumeration value="ComplexType" />
          <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="If" />
          <xs:enumeration value="IsOf" />
          <xs:enumeration value="LabeledElement" />
          <xs:enumeration value="Member" />
          <xs:enumeration value="NavigationProperty" />
          <xs:enumeration value="Null" />
          <xs:enumeration value="OnDelete" />
          <xs:enumeration value="Parameter" />
          <xs:enumeration value="Property" />
          <xs:enumeration value="PropertyValue" />
          <xs:enumeration value="Record" />
          <xs:enumeration value="Reference" />
          <xs:enumeration value="ReferentialConstraint" />
          <xs:enumeration value="Schema" />
          <xs:enumeration value="Singleton" />
          <xs:enumeration value="Term" />
          <xs:enumeration value="TypeDefinition" />
          <xs:enumeration value="UrlRef" />
        </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>
  <!-- binary data in base64url encoding -->
  <xs:simpleType name="binary">
    <xs:restriction base="xs:string">
      <xs:pattern value="([A-Za-z0-9_\-]{4})*([A-Za-z0-9_\-]{3}[A-Za-z0-9_\-]|[A-Za-z0-9_\-]{2}[AEIMQUYcgkosw048]=?|[A-Za-z0-9_\-][AQgw](==)?)?" />
    </xs:restriction>
  </xs:simpleType>
  <!--boolean without 0 and 1 -->
  <xs:simpleType name="boolean">
    <xs:restriction base="xs:boolean">
      <xs:pattern value="true|false" />
    </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>