You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ra...@apache.org on 2019/05/15 06:00:47 UTC

[olingo-odata4] branch master updated: [OLINGO-1062] Code improvements for support of annotations

This is an automated email from the ASF dual-hosted git repository.

ramyav pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/olingo-odata4.git


The following commit(s) were added to refs/heads/master by this push:
     new c41d10e  [OLINGO-1062] Code improvements for support of annotations
     new 0c7460a  Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4.git
c41d10e is described below

commit c41d10e8dcc09fb357ff146fe2e482104794420a
Author: ramya vasanth <ra...@sap.com>
AuthorDate: Wed May 15 11:29:01 2019 +0530

    [OLINGO-1062] Code improvements for support of annotations
---
 .../client/core/edm/ClientCsdlEdmProvider.java     |   2 +-
 .../apache/olingo/client/core/MetadataTest.java    | 543 +++++++++++++++--
 .../org/apache/olingo/client/core/$metadata.xml    | 209 ++++++-
 .../org/apache/olingo/client/core/Capabilities.xml | 559 +++++++++++++++++
 .../org/apache/olingo/client/core/Integration.xml  |  77 +++
 .../org/apache/olingo/client/core/annotations.xml  |  40 +-
 .../olingo/commons/core/edm/AbstractEdm.java       |   8 +
 .../commons/core/edm/EdmEntityContainerImpl.java   | 662 ++++++++++++++-------
 .../olingo/commons/core/edm/EdmProviderImpl.java   | 619 +++++++++++++------
 .../olingo/commons/core/edm/EdmSchemaImpl.java     |   7 +
 10 files changed, 2259 insertions(+), 467 deletions(-)

diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
index 7ebb8c8..f683a68 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/ClientCsdlEdmProvider.java
@@ -202,7 +202,7 @@ public class ClientCsdlEdmProvider extends CsdlAbstractEdmProvider {
   public CsdlAnnotations getAnnotationsGroup(FullQualifiedName targetName, String qualifier) throws ODataException {
     CsdlSchema schema = xmlSchemas.get(targetName.getNamespace());
     if (schema != null) {
-      return schema.getAnnotationGroup(targetName.getName(), qualifier);
+      return schema.getAnnotationGroup(targetName.getFullQualifiedNameAsString(), qualifier);
     }
     return null;
   }
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
index 3fc21d9..76872c1 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/MetadataTest.java
@@ -42,6 +42,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
 import org.apache.olingo.commons.api.edm.EdmEnumType;
 import org.apache.olingo.commons.api.edm.EdmFunction;
 import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.edm.EdmMember;
 import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.EdmProperty;
@@ -50,6 +51,9 @@ import org.apache.olingo.commons.api.edm.EdmSingleton;
 import org.apache.olingo.commons.api.edm.EdmTerm;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.annotation.EdmCollection;
+import org.apache.olingo.commons.api.edm.annotation.EdmConstantExpression;
+import org.apache.olingo.commons.api.edm.annotation.EdmDynamicExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmExpression;
 import org.apache.olingo.commons.api.edm.annotation.EdmPropertyValue;
 import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
@@ -546,7 +550,7 @@ public class MetadataTest extends AbstractTest {
        new FullQualifiedName("SEPMRA_SO_MAN2", "SEPMRA_C_SalesOrderCustCntctVHType"));
    EdmAnnotation annotation = entity1.getAnnotations().get(0);
    assertNotNull(annotation);
-   assertEquals(5, entity1.getAnnotations().size());
+   assertEquals(6, entity1.getAnnotations().size());
    assertEquals("FieldGroup", annotation.getTerm().getName());
    assertEquals("ContactPerson", annotation.getQualifier());
    EdmExpression expression = annotation.getExpression();
@@ -563,7 +567,7 @@ public class MetadataTest extends AbstractTest {
    assertEquals("Label", propertyValues.get(1).getProperty());
    assertEquals("Contact Person", propertyValues.get(1).getValue().asConstant().asPrimitive());
    
-   assertEquals(1, entity1.getNavigationProperty("to_Customer").getAnnotations().size());
+   assertEquals(2, entity1.getNavigationProperty("to_Customer").getAnnotations().size());
    EdmNavigationProperty navProperty = entity1.getNavigationProperty("to_Customer");
    assertEquals("ThingPerspective", navProperty.
        getAnnotations().get(0).getTerm().getName());
@@ -588,7 +592,7 @@ public class MetadataTest extends AbstractTest {
    assertNotNull(edm);
    EdmEntityContainer container = edm.getEntityContainer();
    EdmActionImport actionImport = container.getActionImport("AIRTString");
-   assertEquals(3, actionImport.getAnnotations().size());
+   assertEquals(4, actionImport.getAnnotations().size());
    assertEquals("Description", actionImport.getAnnotations().get(0).getTerm().getName());
    assertEquals("HeaderInfo", actionImport.getAnnotations().get(2).getTerm().getName());
  }
@@ -599,15 +603,18 @@ public class MetadataTest extends AbstractTest {
    assertNotNull(edm);
    EdmEntityContainer container = edm.getEntityContainer();
    EdmSingleton singleton = container.getSingleton("SINav");
-   assertEquals(1, singleton.getAnnotations().size());
-   assertEquals("HeaderInfo", singleton.getAnnotations().get(0).getTerm().getName());
-   
+   assertEquals(2, singleton.getAnnotations().size());
+   FullQualifiedName termName = new FullQualifiedName("UI", "HeaderInfo");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = singleton.getAnnotation(term, null);
+   assertNotNull(annotation);
+
    EdmEntityType singletonET = singleton.getEntityType();
-   EdmProperty singlComplexProp = (EdmProperty)singletonET.getProperty("ComplexProperty");
+   EdmProperty singlComplexProp = (EdmProperty) singletonET.getProperty("ComplexProperty");
    EdmComplexType singlCompType = (EdmComplexType) singlComplexProp.getTypeWithAnnotations();
-   EdmNavigationProperty singlNavProp = (EdmNavigationProperty) singlCompType.
-       getNavigationProperty("NavPropertyDraftAdministrativeDataType");
-   assertEquals(1, singlNavProp.getAnnotations().size());
+   EdmNavigationProperty singlNavProp = (EdmNavigationProperty) singlCompType.getNavigationProperty(
+       "NavPropertyDraftAdministrativeDataType");
+   assertEquals(2, singlNavProp.getAnnotations().size());
    assertEquals("AdditionalInfo", singlNavProp.getAnnotations().get(0).getTerm().getName());
  }
  
@@ -616,15 +623,26 @@ public class MetadataTest extends AbstractTest {
    final Edm edm = fetchEdm();
    assertNotNull(edm);
    List<String> parameterNames = new ArrayList<String>();
-   EdmFunction function = edm.getBoundFunction(new FullQualifiedName("SEPMRA_SO_MAN2", "_FC_RTTimeOfDay_"), 
-       new FullQualifiedName("Edm","TimeOfDay"), false, parameterNames);
-   assertEquals(1, function.getAnnotations().size());
+   EdmFunction function = edm.getBoundFunction(new FullQualifiedName("SEPMRA_SO_MAN2", "_FC_RTTimeOfDay_"),
+       new FullQualifiedName("Edm", "TimeOfDay"), false, parameterNames);
+   assertEquals(2, function.getAnnotations().size());
    assertEquals("HeaderInfo", function.getAnnotations().get(0).getTerm().getName());
+
+   FullQualifiedName termName =
+       new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = function.getAnnotation(term, null);
+   assertNotNull(annotation);
    
    // Annotations on Bound Function parameter
-   assertEquals(1, function.getParameter("ParameterTimeOfDay").getAnnotations().size());
+   assertEquals(2, function.getParameter("ParameterTimeOfDay").getAnnotations().size());
    assertEquals("HeaderInfo", function.getParameter("ParameterTimeOfDay")
        .getAnnotations().get(0).getTerm().getName());
+   termName =
+       new FullQualifiedName("UI", "AdditionalInfo");
+   term = edm.getTerm(termName);
+   annotation = function.getParameter("ParameterTimeOfDay").getAnnotation(term, null);
+   assertNotNull(annotation);
  }
  
  @Test
@@ -633,8 +651,8 @@ public class MetadataTest extends AbstractTest {
    assertNotNull(edm);
    EdmSchema schema = edm.getSchema("sepmra_so_man2_anno_mdl.v1");
    assertNotNull(schema);
-   assertEquals(112, schema.getAnnotationGroups().size());
-   
+   assertEquals(117, schema.getAnnotationGroups().size());
+
    EdmAnnotations annotations = edm.getSchema("SEPMRA_SO_MAN2").getAnnotationGroups().get(22);
    assertEquals("SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType", annotations.getTargetPath());
    assertEquals(1, annotations.getAnnotations().size());
@@ -648,8 +666,8 @@ public class MetadataTest extends AbstractTest {
    final Edm edm = fetchEdm();
    assertNotNull(edm);
    EdmEntityContainer container = edm.getEntityContainer();
-   assertEquals(1, container.getAnnotations().size());
-   assertEquals("HeaderInfo", container.getAnnotations().get(0).getTerm().getName());
+   assertEquals(5, container.getAnnotations().size());
+   assertEquals("HeaderInfo", container.getAnnotations().get(1).getTerm().getName());
  }
  
  @Test
@@ -658,17 +676,22 @@ public class MetadataTest extends AbstractTest {
    assertNotNull(edm);
    EdmComplexType complexType = edm.getComplexTypeWithAnnotations(
        new FullQualifiedName("SEPMRA_SO_MAN2", "CTPrim"));
-   assertEquals(1, complexType.getAnnotations().size());
+   assertEquals(2, complexType.getAnnotations().size());
    assertEquals("HeaderInfo", complexType.getAnnotations().get(0).getTerm().getName());
    // Annotations on complex type property
    EdmProperty complexTypeProp = (EdmProperty) complexType.getProperty("PropertyInt16");
    assertEquals(1, complexTypeProp.getAnnotations().size());
    assertEquals("HeaderInfo", complexTypeProp.getAnnotations().get(0).getTerm().getName());
    // Annotations on complex type navigation property
-   EdmNavigationProperty complexTypeNavProp = complexType.
-       getNavigationProperty("NavPropertyDraftAdministrativeDataType");
+   EdmNavigationProperty complexTypeNavProp = complexType.getNavigationProperty(
+       "NavPropertyDraftAdministrativeDataType");
    assertEquals(1, complexTypeNavProp.getAnnotations().size());
    assertEquals("HeaderInfo", complexTypeNavProp.getAnnotations().get(0).getTerm().getName());
+   
+   FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = complexType.getAnnotation(term, null);
+   assertNotNull(annotation);
  }
  
  @Test
@@ -676,23 +699,28 @@ public class MetadataTest extends AbstractTest {
    final Edm edm = fetchEdm();
    assertNotNull(edm);
    EdmTypeDefinition typeDefn = edm.getTypeDefinition(new FullQualifiedName("SEPMRA_SO_MAN2", "TDString"));
-   assertEquals(1, typeDefn.getAnnotations().size());
-   assertEquals("HeaderInfo", typeDefn.getAnnotations().get(0).getTerm().getName());
+   assertEquals(3, typeDefn.getAnnotations().size());
+   assertEquals("OriginalDataType", typeDefn.getAnnotations().get(0).getTerm().getName());
  }
  
  @Test
  public void readAnnotationOnBoundActions() {
    final Edm edm = fetchEdm();
    assertNotNull(edm);
-   EdmAction action = edm.getBoundAction(new FullQualifiedName("SEPMRA_SO_MAN2", "BA_RTCountryVHType"), 
-       new FullQualifiedName("SEPMRA_SO_MAN2","I_DraftAdministrativeDataType"), false);
+   EdmAction action = edm.getBoundAction(new FullQualifiedName("SEPMRA_SO_MAN2", "BA_RTCountryVHType"),
+       new FullQualifiedName("SEPMRA_SO_MAN2", "I_DraftAdministrativeDataType"), false);
    assertEquals(1, action.getAnnotations().size());
    assertEquals("HeaderInfo", action.getAnnotations().get(0).getTerm().getName());
-   
-   //Annotations on Bound Action parameter
-   assertEquals(1, action.getParameter("ParameterCTPrim").getAnnotations().size());
+
+   // Annotations on Bound Action parameter
+   assertEquals(2, action.getParameter("ParameterCTPrim").getAnnotations().size());
    assertEquals("HeaderInfo", action.getParameter("ParameterCTPrim")
        .getAnnotations().get(0).getTerm().getName());
+   
+   FullQualifiedName termName = new FullQualifiedName("UI", "AdditionalInfo");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = action.getParameter("ParameterCTPrim").getAnnotation(term, null);
+   assertNotNull(annotation);
  }
  
  @Test
@@ -703,58 +731,50 @@ public class MetadataTest extends AbstractTest {
    EdmEntitySet entitySet = container.getEntitySet("I_DraftAdministrativeData");
    assertEquals(1, entitySet.getAnnotations().size());
    assertEquals("HeaderInfo", entitySet.getAnnotations().get(0).getTerm().getName());
-   
-   
-   
+
    EdmEntityType entityType50 = edm.getEntityTypeWithAnnotations(
        new FullQualifiedName("SEPMRA_SO_MAN2", "I_DraftAdministrativeDataType"));
-   assertEquals(1, ((EdmProperty)entityType50.getProperty("DraftUUID")).getAnnotations().size());
-   assertEquals("UI.HeaderInfo", ((EdmProperty)entityType50.getProperty("DraftUUID")).
-       getAnnotations().get(0).getTerm().getFullQualifiedName().getFullQualifiedNameAsString());
-   
-   
-   
+   assertEquals(1, ((EdmProperty) entityType50.getProperty("DraftUUID")).getAnnotations().size());
+   assertEquals("UI.HeaderInfo", ((EdmProperty) entityType50.getProperty("DraftUUID")).getAnnotations().get(0)
+       .getTerm().getFullQualifiedName().getFullQualifiedNameAsString());
+
    // Annotations on properties of entity type included in EntitySet
    EdmEntityType entityType3 = entitySet.getEntityTypeWithAnnotations();
-   assertEquals(2, ((EdmProperty)entityType3.getProperty("DraftUUID")).getAnnotations().size());
-   assertEquals("AdditionalInfo", ((EdmProperty)entityType3.getProperty("DraftUUID"))
+   assertEquals(3, ((EdmProperty) entityType3.getProperty("DraftUUID")).getAnnotations().size());
+   assertEquals("AdditionalInfo", ((EdmProperty) entityType3.getProperty("DraftUUID"))
        .getAnnotations().get(0).getTerm().getName());
-   assertEquals("HeaderInfo", ((EdmProperty)entityType3.getProperty("DraftUUID"))
+   assertEquals("HeaderInfo", ((EdmProperty) entityType3.getProperty("DraftUUID"))
        .getAnnotations().get(1).getTerm().getName());
-   
+
    // Annotations on navigation properties of entity type included in EntitySet
    EdmEntitySet entitySet1 = container.getEntitySet("SEPMRA_C_SalesOrderCustCntctVH");
    EdmEntityType entityType5 = entitySet1.getEntityTypeWithAnnotations();
-   assertEquals(2, ((EdmNavigationProperty)entityType5.getNavigationProperty("to_Customer"))
+   assertEquals(2, ((EdmNavigationProperty) entityType5.getNavigationProperty("to_Customer"))
        .getAnnotations().size());
-   assertEquals("AdditionalInfo", ((EdmNavigationProperty)entityType5
+   assertEquals("AdditionalInfo", ((EdmNavigationProperty) entityType5
        .getNavigationProperty("to_Customer"))
-       .getAnnotations().get(0).getTerm().getName());
-   assertEquals("HeaderInfo", ((EdmNavigationProperty)entityType5
+           .getAnnotations().get(0).getTerm().getName());
+   assertEquals("HeaderInfo", ((EdmNavigationProperty) entityType5
        .getNavigationProperty("to_Customer"))
-       .getAnnotations().get(1).getTerm().getName());
-   
-   
-   
-   EdmComplexType complexType = edm.getComplexTypeWithAnnotations(
+           .getAnnotations().get(1).getTerm().getName());
+
+  EdmComplexType complexType = edm.getComplexTypeWithAnnotations(
        new FullQualifiedName("SEPMRA_SO_MAN2", "CTPrim"));
    EdmProperty complexTypeProp = (EdmProperty) complexType.getProperty("PropertyInt16");
    assertEquals(1, complexTypeProp.getAnnotations().size());
    assertEquals("HeaderInfo", complexTypeProp.getAnnotations().get(0).getTerm().getName());
-   
-   
-   
+
    // Annotations on properties of complex properties of entity type included in EntitySet
    EdmProperty complexProp = (EdmProperty) entityType3.getProperty("ComplexProperty");
    EdmComplexType compType = (EdmComplexType) complexProp.getTypeWithAnnotations();
    EdmProperty prop = (EdmProperty) compType.getProperty("PropertyInt16");
-   assertEquals(1, prop.getAnnotations().size());
+   assertEquals(2, prop.getAnnotations().size());
    assertEquals("AdditionalInfo", prop.getAnnotations().get(0).getTerm().getName());
-   
+
    // Annotations on navigation properties of complex properties of entity type included in EntitySet
    EdmNavigationProperty navProp = (EdmNavigationProperty) compType
        .getProperty("NavPropertyDraftAdministrativeDataType");
-   assertEquals(1, navProp.getAnnotations().size());
+   assertEquals(2, navProp.getAnnotations().size());
    assertEquals("AdditionalInfo", navProp.getAnnotations().get(0).getTerm().getName());
  }
  
@@ -763,8 +783,417 @@ public class MetadataTest extends AbstractTest {
    streams.add(getClass().getResourceAsStream("annotations.xml"));
    streams.add(getClass().getResourceAsStream("VOC_Core.xml"));
    streams.add(getClass().getResourceAsStream("UI.xml"));
+   streams.add(getClass().getResourceAsStream("Capabilities.xml"));
+   streams.add(getClass().getResourceAsStream("Integration.xml"));
    final Edm edm = client.getReader().readMetadata(getClass().getResourceAsStream("$metadata.xml"),
        streams);
-  return edm;
+   return edm;
+ }
+ 
+ @Test
+ public void readAnnotationOnFunctionImport() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityContainer container = edm.getEntityContainer();
+   EdmFunctionImport functionImport = container.getFunctionImport("FIC_RTTimeOfDay_");
+   assertEquals(3, functionImport.getAnnotations().size());
+   
+   FullQualifiedName termName = new FullQualifiedName("UI", "Identification");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = functionImport.getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+ }
+ 
+ @Test
+ public void readAnnotationWithinMetadataFile() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+
+   //Get Annotations on entity types derived from edm 
+   EdmEntityType entityType = edm.getEntityTypeWithAnnotations(
+       new FullQualifiedName("SEPMRA_SO_MAN2", "CDI_CDC_SOURCEResult"));
+   FullQualifiedName termName;
+   EdmTerm term;
+   EdmAnnotation annotation;
+   String valueAsString;
+   checkAnnotationsOnEntityType(edm, entityType);
+   
+   assertEquals(3, ((EdmProperty) entityType.getProperty("CHANGED")).getAnnotations().size());
+   // Get the term defined on the entity property
+   termName =
+       new FullQualifiedName("Integration", "OriginalDataType");
+   term = edm.getTerm(termName);
+   annotation = ((EdmProperty) entityType.getProperty("CHANGED")).getAnnotation(term, null);
+   assertNotNull(annotation);
+   valueAsString = annotation.getExpression().asConstant().getValueAsString();
+   assertEquals("TIMESTAMP" , valueAsString);
+   
+   termName =
+       new FullQualifiedName("Integration", "SourceSystem");
+   term = edm.getTerm(termName);
+   annotation = ((EdmProperty) entityType.getProperty("CHANGED")).getAnnotation(term, null);
+   assertNotNull(annotation);
+   valueAsString = annotation.getExpression().asConstant().getValueAsString();
+   assertEquals("DB" , valueAsString);
+   
+   // Get annotations added on container
+   EdmEntityContainer container = edm.getEntityContainer();
+   assertEquals(5, container.getAnnotations().size());
+   // Get the term defined on the entity container
+   termName =
+       new FullQualifiedName("Integration", "SourceSystem");
+   term = edm.getTerm(termName);
+   annotation = container.getAnnotation(term, null);
+   assertNotNull(annotation);
+   valueAsString = annotation.getExpression().asConstant().getValueAsString();
+   assertEquals("DB", valueAsString);
+   
+   termName =
+       new FullQualifiedName("Integration", "Extractable");
+   term = edm.getTerm(termName);
+   annotation = container.getAnnotation(term, null);
+   assertNotNull(annotation);
+   valueAsString = annotation.getExpression().asConstant().getValueAsString();
+   assertTrue(Boolean.valueOf(valueAsString));
+   
+   //Get the annotations defined on type definitions
+   final EdmTypeDefinition defn = edm.getTypeDefinition(new FullQualifiedName("SEPMRA_SO_MAN2", "TDString"));
+   assertNotNull(defn);
+   assertEquals(3, defn.getAnnotations().size());
+   termName =
+       new FullQualifiedName("Integration", "Extractable");
+   term = edm.getTerm(termName);
+   annotation = defn.getAnnotation(term, null);
+   assertNotNull(annotation);
+   valueAsString = annotation.getExpression().asConstant().getValueAsString();
+   assertTrue(Boolean.valueOf(valueAsString));
+   
+   termName =
+       new FullQualifiedName("UI", "HeaderInfo");
+   term = edm.getTerm(termName);
+   annotation = defn.getAnnotation(term, null);
+   assertNotNull(annotation);
+   assertEquals("HeaderInfo", annotation.getTerm().getName());
+   
+   // Get the annotations defined on entity set
+    container = edm.getEntityContainer();
+    EdmEntitySet entitySet = container.getEntitySet("CDI_CDC_SOURCEResult");
+    assertEquals(3, entitySet.getAnnotations().size());
+    assertEquals("SourceSystem", entitySet.getAnnotations().get(0).getTerm().getName());
+    assertEquals("Extractable", entitySet.getAnnotations().get(1).getTerm().getName());
+    
+    termName =
+        new FullQualifiedName("UI", "Identification");
+    term = edm.getTerm(termName);
+    annotation = entitySet.getAnnotation(term, null);
+    assertNotNull(annotation);
+    
+    EdmExpression expression = annotation.getExpression();
+    EdmDynamicExpression asDynamic = expression.asDynamic();
+    if ((asDynamic != null) && (asDynamic.isCollection())) {
+      EdmCollection collection = asDynamic.asCollection();
+      EdmExpression exp = collection.getItems().get(0);
+      EdmRecord asRecord = exp.asDynamic().asRecord();
+      if (asRecord != null) {
+        List<EdmPropertyValue> propertyValues = asRecord.getPropertyValues();
+        if (propertyValues != null) {
+          for (int i = 0; i < propertyValues.size(); i++) {
+            EdmPropertyValue edmPropertyValue = propertyValues.get(i);
+            String property = edmPropertyValue.getProperty();
+            if (property.equals("Value")) {
+              EdmExpression value = edmPropertyValue.getValue();
+              assertNotNull(value);
+              assertEquals("Path", value.getExpressionName());
+            }
+          }
+        }
+      }
+    }
+    
+    // Get the annotations defined on entity type derived from entity set
+    entityType = entitySet.getEntityTypeWithAnnotations();
+    checkAnnotationsOnEntityType(edm, entityType);
+    assertEquals(2, ((EdmProperty) entityType.getProperty("CHANGED")).getAnnotations().size());
+    
+    termName =
+        new FullQualifiedName("Integration", "OriginalDataType");
+    term = edm.getTerm(termName);
+    annotation = ((EdmProperty) entityType.getProperty("CHANGED")).getAnnotation(term, null);
+    assertNotNull(annotation);
+    valueAsString = annotation.getExpression().asConstant().getValueAsString();
+    assertEquals("TIMESTAMP" , valueAsString);
+    
+    termName =
+        new FullQualifiedName("Integration", "Extractable");
+    term = edm.getTerm(termName);
+    annotation = ((EdmProperty) entityType.getProperty("CHANGED")).getAnnotation(term, null);
+    assertNotNull(annotation);
+    valueAsString = annotation.getExpression().asConstant().getValueAsString();
+    assertTrue(Boolean.valueOf(valueAsString));
+    
+    assertEquals(3, entityType.getAnnotations().size());
+    termName =
+        new FullQualifiedName("Capabilities", "ChangeTracking");
+    term = edm.getTerm(termName);
+    annotation = entityType.getAnnotation(term, null);
+    assertNotNull(annotation);
+    
+    expression = annotation.getExpression();
+    asDynamic = expression.asDynamic();
+    if ((asDynamic != null) && (asDynamic.isRecord())) {
+      EdmRecord asRecord = asDynamic.asRecord();
+      if (asRecord != null) {
+        List<EdmPropertyValue> propertyValues = asRecord.getPropertyValues();
+        if (propertyValues != null) {
+          for (int i = 0; i < propertyValues.size(); i++) {
+            EdmPropertyValue edmPropertyValue = propertyValues.get(i);
+            String property = edmPropertyValue.getProperty();
+            if (property.equals("Supported")) {
+              EdmExpression value = edmPropertyValue.getValue();
+              EdmConstantExpression asConstant2 = value.asConstant();
+              String valueAsString1 = asConstant2.getValueAsString();
+              assertTrue(Boolean.valueOf(valueAsString1));
+            }
+          }
+        }
+      }
+    }
+ }
+
+ /**
+  * @param edm
+  * @param entityType
+  */
+ private void checkAnnotationsOnEntityType(final Edm edm, EdmEntityType entityType) {
+   FullQualifiedName termName =
+       new FullQualifiedName("Capabilities", "ChangeTracking");
+   // Get the term defined on the entity type
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotationChangeTracking = entityType.getAnnotation(term, null);
+   assertNotNull(annotationChangeTracking);
+   if (annotationChangeTracking != null) {
+     EdmExpression expression = annotationChangeTracking.getExpression();
+     EdmDynamicExpression asDynamic = expression.asDynamic();
+     if ((asDynamic != null) && (asDynamic.isRecord())) {
+       EdmRecord asRecord = asDynamic.asRecord();
+       if (asRecord != null) {
+         List<EdmPropertyValue> propertyValues = asRecord.getPropertyValues();
+         if (propertyValues != null) {
+           for (int i = 0; i < propertyValues.size(); i++) {
+             EdmPropertyValue edmPropertyValue = propertyValues.get(i);
+             String property = edmPropertyValue.getProperty();
+             if (property.equals("Supported")) {
+               EdmExpression value = edmPropertyValue.getValue();
+               EdmConstantExpression asConstant2 = value.asConstant();
+               String valueAsString = asConstant2.getValueAsString();
+               assertTrue(Boolean.valueOf(valueAsString));
+             }
+           }
+         }
+       }
+     }
+   }
+   termName =
+       new FullQualifiedName("Integration", "Extractable");
+   term = edm.getTerm(termName);
+   EdmAnnotation annotation = entityType.getAnnotation(term, null);
+   assertNotNull(annotation);
+   String valueAsString = annotation.getExpression().asConstant().getValueAsString();
+   assertTrue(Boolean.valueOf(valueAsString));
+ }
+ 
+ @Test
+ public void readAnnotationWithAliasOnEntityTypesProperties() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityType entityType = edm.getEntityTypeWithAnnotations(new FullQualifiedName("Test.CDI_CDC_SOURCEResult"));
+   List<EdmAnnotation> annotations = ((EdmProperty)entityType.getProperty("CHANGED")).getAnnotations();
+   assertEquals(3, annotations.size());
+   
+   FullQualifiedName termName =
+       new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = ((EdmProperty)entityType.getProperty("CHANGED")).getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+   entityType = edm.getEntityTypeWithAnnotations(
+       new FullQualifiedName("Test.SEPMRA_C_SalesOrderCustCntctVHType"));
+   List<EdmAnnotation> annotationsOnNavProp = ((EdmNavigationProperty)entityType.
+       getNavigationProperty("to_Customer")).getAnnotations();
+   assertEquals(2, annotationsOnNavProp.size());
+   
+   termName =
+       new FullQualifiedName("UI", "HeaderInfo");
+   term = edm.getTerm(termName);
+   annotation = ((EdmNavigationProperty)entityType.getNavigationProperty("to_Customer")).
+       getAnnotation(term, null);
+   assertNotNull(annotation);
+ }
+ 
+ @Test
+ public void readAnnotationWithAliasOnEntitySetProperties() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityContainer container = edm.getEntityContainer();
+   EdmEntitySet entitySet = container.getEntitySet("I_DraftAdministrativeData");
+   EdmEntityType entityType = entitySet.getEntityTypeWithAnnotations();
+   List<EdmAnnotation> annotations = ((EdmProperty)entityType.getProperty("DraftUUID")).getAnnotations();
+   assertEquals(3, annotations.size());
+   
+   FullQualifiedName termName =
+       new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = ((EdmProperty)entityType.getProperty("DraftUUID")).getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+ }
+ 
+ @Test
+ public void readAnnotationFetchingAllSingletons() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityContainer container = edm.getEntityContainer();
+   List<EdmSingleton> singletons = container.getSingletons();
+   assertEquals(1, singletons.size());
+   
+   FullQualifiedName termName = new FullQualifiedName("UI", "HeaderInfo");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = singletons.get(0).getAnnotation(term, null);
+   assertNotNull(annotation);
+ }
+ 
+ @Test
+ public void readAnnotationFetchingAllActionImports() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityContainer container = edm.getEntityContainer();
+   List<EdmActionImport> actionImports = container.getActionImports();
+   assertEquals(1, actionImports.size());
+ }
+ 
+ @Test
+ public void readAnnotationFetchingAllFunctionImports() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityContainer container = edm.getEntityContainer();
+   List<EdmFunctionImport> functionImports = container.getFunctionImports();
+   assertEquals(1, functionImports.size());
+   
+   FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = functionImports.get(0).getAnnotation(term, null);
+   assertNotNull(annotation);
+ }
+ 
+ @Test
+ public void readAnnotationFetchingAllEntitySets() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEntityContainer container = edm.getEntityContainer();
+   List<EdmEntitySet> entitySets = container.getEntitySets();
+   assertEquals(4, entitySets.size());
+   
+   FullQualifiedName termName = new FullQualifiedName("UI", "HeaderInfo");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = entitySets.get(0).getAnnotation(term, null);
+   assertNotNull(annotation);
+ }
+ 
+ @Test
+ public void readAnnotationOnEnumTypes() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmEnumType enumType = edm.getEnumType(new FullQualifiedName("SEPMRA_SO_MAN2.ENString"));
+   EdmMember member = enumType.getMember("String1");
+   assertEquals(1, member.getAnnotations().size());
+   FullQualifiedName termName = new FullQualifiedName("Integration", "OriginalDataType");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = member.getAnnotation(term, null);
+   assertNotNull(annotation);
+ }
+ 
+ @Test
+ public void readAnnotationOnFunction() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   List<EdmFunction> function = edm.getUnboundFunctions(new FullQualifiedName("SEPMRA_SO_MAN2", "UFCRTCollString"));
+   assertEquals(1, function.size());
+   List<EdmAnnotation> annotations = function.get(0).getAnnotations();
+   assertEquals(2, annotations.size());
+
+   FullQualifiedName termName =
+       new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = function.get(0).getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+ }
+ 
+ @Test
+ public void readAnnotationOnFunctionWithParameters() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   List<String> paramNames = new ArrayList<String>();
+   paramNames.add("ParameterString");
+   paramNames.add("ParameterInt16");
+   EdmFunction function = edm.getUnboundFunction(
+       new FullQualifiedName("SEPMRA_SO_MAN2", "UFCRTStringTwoParam"), paramNames);
+   assertNotNull(function);
+   List<EdmAnnotation> annotations = function.getAnnotations();
+   assertEquals(2, annotations.size());
+
+   FullQualifiedName termName =
+       new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = function.getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+   termName =
+       new FullQualifiedName("UI", "AdditionalInfo");
+   term = edm.getTerm(termName);
+   annotation = function.getParameter("ParameterString").getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+ }
+ 
+ @Test
+ public void readAnnotationOnAction() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   EdmAction action = edm.getUnboundAction(new FullQualifiedName("SEPMRA_SO_MAN2", "UARTString"));
+   List<EdmAnnotation> annotations = action.getAnnotations();
+   assertEquals(2, annotations.size());
+
+   FullQualifiedName termName =
+       new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = action.getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+ }
+ 
+ @Test
+ public void readAnnotationGroup() {
+   final Edm edm = fetchEdm();
+   assertNotNull(edm);
+   // Read annotations on annotation group within metadata file
+   EdmAnnotations annotations = edm.getAnnotationGroup(
+       new FullQualifiedName("SEPMRA_SO_MAN2", "CDI_CDC_SOURCEResult"), null);
+   assertNotNull(annotations);
+   FullQualifiedName termName = new FullQualifiedName("Integration", "Extractable");
+   EdmTerm term = edm.getTerm(termName);
+   EdmAnnotation annotation = annotations.getAnnotation(term, null);
+   assertNotNull(annotation);
+   
+   //Read annotations on annotation group from external file
+   annotations = edm.getAnnotationGroup(
+       new FullQualifiedName(
+           "SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/ComplexProperty/PropertyInt16"), null);
+   assertNotNull(annotations);
+   termName = new FullQualifiedName("UI", "AdditionalInfo");
+   term = edm.getTerm(termName);
+   annotation = annotations.getAnnotation(term, null);
+   assertNotNull(annotation);
  }
 }
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/$metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/$metadata.xml
index 4a29589..d7072de 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/$metadata.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/$metadata.xml
@@ -26,14 +26,28 @@
   <edmx:Reference xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Uri="../v4.0/cs02/vocabularies/Org.OData.Core.V1.xml">
     <edmx:Include Namespace="Org.OData.Core.V1" Alias="Core"/>
   </edmx:Reference>
+  <edmx:Reference Uri="http://server/TEST/odata/DataIntegration.xml">
+	<edmx:Include Namespace="com.test.vocabularies.DataIntegration.v1" Alias="Integration"/>
+  </edmx:Reference>
+  <edmx:Reference Uri="http://server/TEST/odata/Org.OData.Capabilities.V1.xml">
+	<edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/>
+  </edmx:Reference>
   <edmx:DataServices m:DataServiceVersion="2.0">
-    <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="SEPMRA_SO_MAN2" xml:lang="en">
+    <Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="SEPMRA_SO_MAN2" Alias="Test" xml:lang="en">
     <EnumType Name="ENString" IsFlags="true" UnderlyingType="Edm.Int16">
-		<Member Name="String1" Value="1"/>
+		<Member Name="String1" Value="1">
+			<Annotation Term="Integration.OriginalDataType">
+				<String>TIMESTAMP</String>
+			</Annotation>
+		</Member>
 		<Member Name="String2" Value="2"/>
 		<Member Name="String3" Value="4"/>
 		</EnumType>
-	<TypeDefinition Name="TDString" UnderlyingType="Edm.String" MaxLength="15"/>
+	<TypeDefinition Name="TDString" UnderlyingType="Edm.String" MaxLength="15">
+		<Annotation Term="Integration.OriginalDataType">
+			<String>TIMESTAMP</String>
+		</Annotation>
+	</TypeDefinition>
 	  <ComplexType Name="CTPrim">
 		<Property Name="PropertyInt16" Type="Edm.Int16"/>
 		<NavigationProperty Name="NavPropertyDraftAdministrativeDataType" Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType"/>
@@ -79,6 +93,36 @@
         <Property Name="Country" Type="Edm.String" Nullable="false" MaxLength="3"/>
         <Property Name="CountryT" Type="Edm.String" MaxLength="50"/>
       </EntityType>
+      <EntityType Name="CDI_CDC_SOURCEResult">
+		<Key>
+			<PropertyRef Name="ID"/>
+		</Key>
+		<Property Name="CHANGED" Type="Edm.DateTimeOffset" MaxLength="27" Precision="6" Scale="7">
+			<Annotation Term="Integration.OriginalDataType">
+				<String>TIMESTAMP</String>
+			</Annotation>
+		</Property>
+		<Property Name="CREATED" Type="Edm.DateTimeOffset" MaxLength="27" Precision="6" Scale="7">
+			<Annotation Term="Integration.OriginalDataType">
+				<String>TIMESTAMP</String>
+			</Annotation>
+		</Property>
+		<Property Name="ID" Type="Edm.Int64" MaxLength="10" Scale="0">
+			<Annotation Term="Integration.OriginalDataType">
+				<String>INTEGER</String>
+			</Annotation>
+		</Property>
+		<Property Name="NAME" Type="Edm.String" MaxLength="20">
+			<Annotation Term="Integration.OriginalDataType">
+				<String>VARCHAR</String>
+			</Annotation>
+		</Property>
+		<Property Name="STATUS" Type="Edm.Int64" MaxLength="10" Scale="0">
+			<Annotation Term="Integration.OriginalDataType">
+				<String>INTEGER</String>
+			</Annotation>
+		</Property>
+	</EntityType>
       <Action Name="BA_RTCountryVHType" IsBound="true">
 		<Parameter Name="ParameterCountryType" Type="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType" Nullable="false"/>
 		<ReturnType Type="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType"/>
@@ -93,6 +137,9 @@
 		<Parameter Name="ParameterCTPrim" Type="SEPMRA_SO_MAN2.CTPrim" Nullable="false"/>
 		<ReturnType Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType"/>
 	  </Action>
+	  <Action Name="UARTString" IsBound="false">
+		<ReturnType Type="Edm.String"/>
+	</Action>
 	  <Function Name="_FC_RTTimeOfDay_" IsBound="true" IsComposable="true">
 		<Parameter Name="ParameterTimeOfDay" Type="Edm.TimeOfDay" Nullable="false"/>
 		<ReturnType Type="Edm.TimeOfDay"/>
@@ -102,13 +149,21 @@
 		<Parameter Name="ParameterAny" Type="Edm.String" Nullable="false"/>
 		<ReturnType Type="Edm.TimeOfDay"/>
 	  </Function>
+	  <Function Name="UFCRTCollString" IsBound="false">
+		<ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+	</Function>
+	<Function Name="UFCRTStringTwoParam" IsBound="false">
+		<Parameter Name="ParameterString" Type="Edm.String" Nullable="false"/>
+		<Parameter Name="ParameterInt16" Type="Edm.Int16" Nullable="false"/>
+		<ReturnType Type="Edm.String"/>
+	</Function>
       <EntityContainer Name="SEPMRA_SO_MAN2_Entities" m:IsDefaultEntityContainer="true">
         <EntitySet Name="I_DraftAdministrativeData" EntityType="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType"/>
         <EntitySet Name="SEPMRA_C_SalesOrderCustCntctVH" EntityType="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType">
         <NavigationPropertyBinding Path="Customer" Target="SEPMRA_C_CountryVH" />
         </EntitySet>
         <EntitySet Name="SEPMRA_C_CountryVH" EntityType="SEPMRA_SO_MAN2.SEPMRA_C_CountryVHType"/>
-        <ActionImport Name="AIRTString" Action="Namespace1_Alias.UARTString">
+        <ActionImport Name="AIRTString" Action="SEPMRA_SO_MAN2.UARTString">
 			<Annotation Term="Core.Description">
 				<String>Action Import returns a simple String</String>
 			</Annotation>
@@ -116,11 +171,29 @@
 				<Bool>true</Bool>
 			</Annotation>
 		</ActionImport>
+		<FunctionImport Name="FIC_RTTimeOfDay_" Function="SEPMRA_SO_MAN2._FC_RTTimeOfDay_" IncludeInServiceDocument="true">
+			<Annotation Term="Core.Description">
+				<String>
+				Overload with same unbound parameter name and different type Composable Importing:Edm.TimeOfDay (Edm.TimeOfDay) Returning:Edm.TimeOfDay
+				</String>
+			</Annotation>
+			<Annotation Term="Integration.Extractable">
+				<Bool>false</Bool>
+			</Annotation>
+		</FunctionImport>
 		<Singleton Name="SINav" Type="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType">
 			<NavigationPropertyBinding Path="NavPropertyDraftAdministrativeDataType" Target="I_DraftAdministrativeData"/>
 		</Singleton>
+		<EntitySet Name="CDI_CDC_SOURCEResult" EntityType="SEPMRA_SO_MAN2.CDI_CDC_SOURCEResult">
+		<Annotation Term="Integration.SourceSystem">
+			<String>DB</String>
+		</Annotation>
+		</EntitySet>
+		<Annotation Term="Integration.SourceSystem">
+			<String>DB</String>
+		</Annotation>
       </EntityContainer>
-      <Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTP">
+     <Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTP">
         <Annotation Term="Common.DraftRoot">
           <Record>
             <PropertyValue Property="ActivationAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTPActivation"/>
@@ -773,6 +846,132 @@
             <PropertyValue Property="EffectTypes" EnumMember="Common.EffectType/ValueChange"/>
           </Record>
         </Annotation>
+      </Annotations> 
+      <Annotations Target="SEPMRA_SO_MAN2.CDI_CDC_SOURCEResult">
+		<Annotation Term="Capabilities.ChangeTracking">
+			<Record>
+				<PropertyValue Property="Supported">
+					<Bool>true</Bool>
+				</PropertyValue>
+			</Record>
+		</Annotation>
+		<Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.CDI_CDC_SOURCEResult/CHANGED">
+	<Annotation Term="Integration.SourceSystem">
+		<String>DB</String>
+	</Annotation>
+	</Annotations>
+	<Annotations Target="Test.CDI_CDC_SOURCEResult/CHANGED">
+	<Annotation Term="Integration.Extractable">
+		<Bool>true</Bool>
+	</Annotation>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/CDI_CDC_SOURCEResult/CHANGED">
+	<Annotation Term="Integration.Extractable">
+		<Bool>true</Bool>
+	</Annotation>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.TDString">
+	<Annotation Term="Integration.Extractable">
+		<Bool>true</Bool>
+	</Annotation>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.ENString/String1">
+	<Annotation Term="Integration.Extractable">
+		<Bool>true</Bool>
+	</Annotation>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.ENString">
+		<Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+	</Annotations>
+	<Annotations Target="Test.ENString">
+		<Annotation Term="UI.HeaderInfo"/>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities">
+	<Annotation Term="Integration.Extractable">
+		<Bool>true</Bool>
+	</Annotation>
+	</Annotations>
+	<Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/CDI_CDC_SOURCEResult">
+	<Annotation Term="Integration.Extractable">
+		<Bool>true</Bool>
+	</Annotation>
+	</Annotations> 
+	<Annotations xmlns="http://docs.oasis-open.org/odata/ns/edm" Target="Test.SEPMRA_SO_MAN2_Entities">
+       <Annotation Term="Common.DraftNode">
+         <Record>
+           <PropertyValue Property="PreparationAction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_ScheduleLineTPPreparation"/>
+           <PropertyValue Property="ValidationFunction" String="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_ScheduleLineTPValidation"/>
+         </Record>
+       </Annotation>
+       <Annotation Term="Common.DraftActivationVia">
+         <Collection>
+           <String>SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderTP</String>
+         </Collection>
+       </Annotation>
+     </Annotations>
+     <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/DraftUUID">
+        <Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+    </Annotations>
+    <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/ComplexProperty/NavPropertyDraftAdministrativeDataType">
+        <Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+    </Annotations>
+    <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SINav">
+      <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="Test._FC_RTTimeOfDay_">
+        <Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+    </Annotations>
+    <Annotations Target="Test._FC_RTTimeOfDay_/ParameterTimeOfDay">
+        <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/AIRTString">
+       <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="Test.BA_RTCountryVHType/ParameterCTPrim">
+        <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="Test.UFCRTCollString">
+        <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="SEPMRA_SO_MAN2.UFCRTCollString">
+        <Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+    </Annotations>
+    <Annotations Target="Test.UARTString">
+        <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="SEPMRA_SO_MAN2.UARTString">
+        <Annotation Term="Integration.Extractable">
+			<Bool>true</Bool>
+		</Annotation>
+    </Annotations>
+    <Annotations Target="Test.UFCRTStringTwoParam">
+        <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="SEPMRA_SO_MAN2.UFCRTStringTwoParam">
+        <Annotation Term="Integration.Extractable"/>
+    </Annotations>
+    <Annotations Target="Test.UFCRTStringTwoParam/ParameterString">
+        <Annotation Term="UI.AdditionalInfo"/>
+    </Annotations>
+    <Annotations Target="SEPMRA_SO_MAN2.UFCRTStringTwoParam/ParameterInt16">
+        <Annotation Term="Integration.Extractable"/>
+    </Annotations>
+    <Annotations Target="Test.CTPrim">
+        <Annotation Term="Integration.Extractable"/>
       </Annotations>
     </Schema>
   </edmx:DataServices>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Capabilities.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Capabilities.xml
new file mode 100644
index 0000000..d4376c9
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Capabilities.xml
@@ -0,0 +1,559 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+  <edmx:Reference Uri="Org.OData.Core.V1.xml">
+    <edmx:Include Alias="Core" Namespace="Org.OData.Core.V1" />
+  </edmx:Reference>
+  <edmx:Reference Uri="Org.OData.Validation.V1.xml">
+    <edmx:Include Alias="Validation" Namespace="Org.OData.Validation.V1" />
+  </edmx:Reference>
+  <edmx:DataServices>
+    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Org.OData.Capabilities.V1" Alias="Capabilities">
+      <Annotation Term="Core.Description">
+        <String>Terms describing capabilities of a service</String>
+      </Annotation>
+      <Annotation Term="Core.Links">
+        <Collection>
+          <Record>
+            <PropertyValue Property="rel" String="latest-version" />
+            <PropertyValue Property="href"
+              String="Org.OData.Capabilities.V1.xml" />
+          </Record>
+          <Record>
+            <PropertyValue Property="rel" String="alternate" />
+            <PropertyValue Property="href"
+              String="Org.OData.Capabilities.V1.json" />
+          </Record>
+          <Record>
+            <PropertyValue Property="rel" String="describedby" />
+            <PropertyValue Property="href"
+              String="Org.OData.Capabilities.V1.md" />
+          </Record>
+        </Collection>
+      </Annotation>
+      <Annotation Term="Core.LongDescription">
+        <String>
+There are some capabilities which are strongly recommended for services to support even
+though they are optional. Support for $top and $skip is a good example as
+supporting these query options helps with performance of a service and are essential. Such
+capabilities are assumed to be default capabilities of an OData service even in
+the case that a capabilities annotation doesn’t exist. Capabilities annotations are
+mainly expected to be used to explicitly specify that a service doesn’t support such
+capabilities. Capabilities annotations can as well be used to declaratively
+specify the support of such capabilities.
+
+On the other hand, there are some capabilities that a service may choose to support or
+not support and in varying degrees. $filter and $orderby are such good examples.
+This vocabulary aims to define terms to specify support or no support for such
+capabilities.
+
+A service is assumed to support by default the following capabilities even though an
+annotation doesn’t exist:
+- Countability ($count)
+- Client pageability ($top, $skip)
+- Expandability ($expand)
+- Indexability by key
+- Batch support ($batch)
+- Navigability of navigation properties
+
+A service is expected to support the following capabilities. If not supported, the
+service is expected to call out the restrictions using annotations:
+- Filterability ($filter)
+- Sortability ($orderby)
+- Queryability of top level entity sets
+- Query functions
+
+A client cannot assume that a service supports certain capabilities. A client can try, but
+it needs to be prepared to handle an error in case the following capabilities are not
+supported:
+- Insertability
+- Updatability
+- Deletability
+        </String>
+      </Annotation>
+
+      <!-- Conformance Level -->
+
+      <Term Name="ConformanceLevel" Type="Capabilities.ConformanceLevelType" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="The conformance level achieved by this service" />
+      </Term>
+      <EnumType Name="ConformanceLevelType">
+        <Member Name="Minimal">
+          <Annotation Term="Core.Description" String="Minimal conformance level" />
+        </Member>
+        <Member Name="Intermediate">
+          <Annotation Term="Core.Description" String="Intermediate conformance level" />
+        </Member>
+        <Member Name="Advanced">
+          <Annotation Term="Core.Description" String="Advanced conformance level" />
+        </Member>
+      </EnumType>
+
+      <!-- Request Capabilities -->
+
+      <Term Name="SupportedFormats" Type="Collection(Edm.String)" Nullable="false" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="Media types of supported formats, including format parameters" />
+        <Annotation Term="Core.IsMediaType" />
+      </Term>
+
+      <Term Name="SupportedMetadataFormats" Type="Collection(Edm.String)" Nullable="false" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="Media types of supported formats for $metadata, including format parameters" />
+        <Annotation Term="Core.IsMediaType" />
+      </Term>
+
+      <Term Name="AcceptableEncodings" Type="Collection(Edm.String)" Nullable="false" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="List of acceptable compression methods for ($batch) requests, e.g. gzip" />
+      </Term>
+
+      <!-- Supported Preferences -->
+
+      <Term Name="AsynchronousRequestsSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="Service supports the asynchronous request preference" />
+      </Term>
+
+      <Term Name="BatchContinueOnErrorSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description"
+          String="Service supports the continue on error preference. Supports $batch requests. Services that apply the BatchContinueOnErrorSupported term should also specify the ContinueOnErrorSupported property from the BatchSupport term." />
+      </Term>
+
+      <Term Name="IsolationSupported" Type="Capabilities.IsolationLevel" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="Supported odata.isolation levels" />
+      </Term>
+      <EnumType Name="IsolationLevel" IsFlags="true">
+        <Member Name="Snapshot" Value="1">
+          <Annotation Term="Core.Description"
+            String="All data returned for a request, including multiple requests within a batch or results retrieved across multiple pages, will be consistent as of a single point in time" />
+        </Member>
+      </EnumType>
+
+      <Term Name="CrossJoinSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="Supports cross joins for the entity sets in this container" />
+      </Term>
+
+      <Term Name="CallbackSupported" Type="Capabilities.CallbackType" AppliesTo="EntityContainer EntitySet">
+        <Annotation Term="Core.Description" String="Supports callbacks for the specified protocols" />
+      </Term>
+      <ComplexType Name="CallbackType">
+        <Property Name="CallbackProtocols" Type="Collection(Capabilities.CallbackProtocol)" Nullable="false">
+          <Annotation Term="Core.Description" String="List of supported callback protocols, e.g. `http` or `wss`" />
+        </Property>
+        <Annotation Term="Core.Description"
+          String="A non-empty collection lists the full set of supported protocols. A empty collection means 'only HTTP is supported'" />
+      </ComplexType>
+      <ComplexType Name="CallbackProtocol">
+        <Property Name="Id" Type="Edm.String">
+          <Annotation Term="Core.Description" String="Protocol Identifier" />
+        </Property>
+        <Property Name="UrlTemplate" Type="Edm.String">
+          <Annotation Term="Core.Description" String="URL Template including parameters. Parameters are enclosed in curly braces {} as defined in RFC6570" />
+        </Property>
+        <Property Name="DocumentationUrl" Type="Edm.String" Nullable="true">
+          <Annotation Term="Core.Description" String="Human readable description of the meaning of the URL Template parameters" />
+          <Annotation Term="Core.IsURL" />
+        </Property>
+      </ComplexType>
+
+      <Term Name="ChangeTracking" Type="Capabilities.ChangeTrackingType" AppliesTo="EntityContainer EntitySet Singleton Function FunctionImport NavigationProperty">
+        <Annotation Term="Core.Description" String="Change tracking capabilities of this service or entity set" />
+      </Term>
+      <ComplexType Name="ChangeTrackingType">
+        <Property Name="Supported" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="This entity set supports the odata.track-changes preference" />
+        </Property>
+        <Property Name="FilterableProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="Change tracking supports filters on these properties" />
+        </Property>
+        <Property Name="ExpandableProperties" Type="Collection(Edm.NavigationPropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="Change tracking supports these properties expanded" />
+        </Property>
+      </ComplexType>
+
+      <!--Query Capabilities -->
+
+      <Term Name="CountRestrictions" Type="Capabilities.CountRestrictionsType" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Restrictions on /$count path suffix and $count=true system query option" />
+      </Term>
+      <ComplexType Name="CountRestrictionsType">
+        <Property Name="Countable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Entities can be counted" />
+        </Property>
+        <Property Name="NonCountableProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These collection properties do not allow /$count segments" />
+        </Property>
+        <Property Name="NonCountableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These navigation properties do not allow /$count segments" />
+        </Property>
+      </ComplexType>
+
+      <Term Name="NavigationRestrictions" Type="Capabilities.NavigationRestrictionsType" AppliesTo="EntitySet Singleton">
+        <Annotation Term="Core.Description" String="Restrictions on navigating properties according to OData URL conventions" />
+        <Annotation Term="Core.LongDescription"
+          String="Restrictions specified on an entity set are valid whether the request is directly to the entity set or through a navigation property bound to that entity set. Services can specify a different set of restrictions specific to a path, in which case the more specific restrictions take precedence." />
+      </Term>
+      <ComplexType Name="NavigationRestrictionsType">
+        <Property Name="Navigability" Type="Capabilities.NavigationType">
+          <Annotation Term="Core.Description" String="Supported Navigability" />
+        </Property>
+        <Property Name="RestrictedProperties" Type="Collection(Capabilities.NavigationPropertyRestriction)" Nullable="false">
+          <Annotation Term="Core.Description" String="List of navigation properties with restrictions" />
+        </Property>
+      </ComplexType>
+      <ComplexType Name="NavigationPropertyRestriction">
+        <Property Name="NavigationProperty" Type="Edm.NavigationPropertyPath">
+          <Annotation Term="Core.Description" String="Navigation properties can be navigated" />
+        </Property>
+        <Property Name="Navigability" Type="Capabilities.NavigationType">
+          <Annotation Term="Core.Description" String="Navigation properties can be navigated to this level" />
+        </Property>
+        <Property Name="FilterFunctions" Type="Collection(Edm.String)">
+          <Annotation Term="Core.Description"
+            String="List of functions and operators supported in $filter. If null, all functions and operators may be attempted." />
+        </Property>
+        <Property Name="FilterRestrictions" Type="Capabilities.FilterRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on $filter expressions" />
+        </Property>
+        <Property Name="SearchRestrictions" Type="Capabilities.SearchRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on $search expressions" />
+        </Property>
+        <Property Name="SortRestrictions" Type="Capabilities.SortRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on $orderby expressions" />
+        </Property>
+        <Property Name="TopSupported" Type="Core.Tag" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Supports $top" />
+        </Property>
+        <Property Name="SkipSupported" Type="Core.Tag" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Supports $skip" />
+        </Property>
+        <Property Name="IndexableByKey" Type="Core.Tag" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Supports key values according to OData URL conventions" />
+        </Property>
+        <Property Name="InsertRestrictions" Type="Capabilities.InsertRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on insert operations" />
+        </Property>
+        <Property Name="DeepInsertSupport" Type="Capabilities.DeepInsertSupportType">
+          <Annotation Term="Core.Description"
+            String="Deep Insert Support of the annotated resource (the whole service, an entity set, or a collection-valued resource)" />
+        </Property>
+        <Property Name="UpdateRestrictions" Type="Capabilities.UpdateRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on update operations" />
+        </Property>
+        <Property Name="DeleteRestrictions" Type="Capabilities.DeleteRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on delete operations" />
+        </Property>
+      </ComplexType>
+      <EnumType Name="NavigationType">
+        <Member Name="Recursive">
+          <Annotation Term="Core.Description" String="Navigation properties can be recursively navigated" />
+        </Member>
+        <Member Name="Single">
+          <Annotation Term="Core.Description" String="Navigation properties can be navigated to a single level" />
+        </Member>
+        <Member Name="None">
+          <Annotation Term="Core.Description" String="Navigation properties are not navigable" />
+        </Member>
+      </EnumType>
+
+      <Term Name="IndexableByKey" Type="Core.Tag" DefaultValue="true" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Supports key values according to OData URL conventions" />
+      </Term>
+
+      <Term Name="TopSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Supports $top" />
+      </Term>
+      <Term Name="SkipSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Supports $skip" />
+      </Term>
+
+      <Term Name="BatchSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description"
+          String="Supports $batch requests. Services that apply the BatchSupported term should also apply the more comprehensive BatchSupport term." />
+      </Term>
+
+      <Term Name="BatchSupport" Type="Capabilities.BatchSupportType" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description" String="Batch Support for the service" />
+      </Term>
+      <ComplexType Name="BatchSupportType">
+        <Property Name="Supported" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Service supports requests to $batch" />
+        </Property>
+        <Property Name="ContinueOnErrorSupported" Type="Edm.Boolean">
+          <Annotation Term="Core.Description" String="Service supports the continue on error preference" />
+        </Property>
+        <Property Name="ReferencesInRequestBodiesSupported" Type="Edm.Boolean">
+          <Annotation Term="Core.Description" String="Service supports Content-ID referencing in request bodies" />
+        </Property>
+        <Property Name="ReferencesAcrossChangeSetsSupported" Type="Edm.Boolean">
+          <Annotation Term="Core.Description" String="Service supports Content-ID referencing across change sets" />
+        </Property>
+        <Property Name="EtagReferencesSupported" Type="Edm.Boolean">
+          <Annotation Term="Core.Description" String="Service supports referencing Etags from previous requests" />
+        </Property>
+      </ComplexType>
+
+      <Term Name="FilterFunctions" Type="Collection(Edm.String)" Nullable="false" AppliesTo="EntityContainer EntitySet">
+        <Annotation Term="Core.Description" String="List of functions and operators supported in $filter" />
+      </Term>
+
+      <Term Name="FilterRestrictions" Type="Capabilities.FilterRestrictionsType" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Restrictions on $filter expressions" />
+      </Term>
+      <ComplexType Name="FilterRestrictionsType">
+        <Property Name="Filterable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="$filter is supported" />
+        </Property>
+        <Property Name="RequiresFilter" Type="Edm.Boolean" DefaultValue="false">
+          <Annotation Term="Core.Description" String="$filter is required" />
+        </Property>
+        <Property Name="RequiredProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description"
+            String="These properties must be specified in the $filter clause (properties of derived types are not allowed here)" />
+        </Property>
+        <Property Name="NonFilterableProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These structural properties cannot be used in $filter expressions" />
+        </Property>
+        <Property Name="FilterExpressionRestrictions" Type="Collection(Capabilities.FilterExpressionRestrictionType)" Nullable="false">
+          <Annotation Term="Core.Description" String="These properties only allow a subset of expressions" />
+        </Property>
+        <Property Name="MaxLevels" Type="Edm.Int32" DefaultValue="-1">
+          <Annotation Term="Core.Description"
+            String="The maximum number of levels (including recursion) that can be traversed in a $filter expression. A value of -1 indicates there is no restriction." />
+        </Property>
+      </ComplexType>
+      <ComplexType Name="FilterExpressionRestrictionType">
+        <Property Name="Property" Type="Edm.PropertyPath">
+          <Annotation Term="Core.Description" String="Path to the restricted property" />
+        </Property>
+        <Property Name="AllowedExpressions" Type="Capabilities.FilterExpressionType">
+          <Annotation Term="Core.Description" String="Allowed subset of expressions" />
+        </Property>
+      </ComplexType>
+      <TypeDefinition Name="FilterExpressionType" UnderlyingType="Edm.String">
+        <Annotation Term="Validation.AllowedValues">
+          <Collection>
+            <Record>
+              <PropertyValue Property="Value" String="SingleValue" />
+              <Annotation Term="Core.Description" String="Property can be used in a single eq clause" />
+            </Record>
+            <Record>
+              <PropertyValue Property="Value" String="MultiValue" />
+              <Annotation Term="Core.Description" String="Property can be used in a single in clause" />
+            </Record>
+            <Record>
+              <PropertyValue Property="Value" String="SingleRange" />
+              <Annotation Term="Core.Description" String="Property can be used in at most one ge and/or one le clause, separated by and" />
+            </Record>
+            <Record>
+              <PropertyValue Property="Value" String="SearchExpression" />
+              <Annotation Term="Core.Description" String="String property can be used as first operand in startswith, endswith, and contains clauses" />
+            </Record>
+            <Record>
+              <PropertyValue Property="Value" String="MultiRange" />
+              <Annotation Term="Core.Description" String="Property can be compared to a union of one or more closed, half-open, or open intervals" />
+              <Annotation Term="Core.LongDescription"
+                String="The filter expression for this property consists of one or more interval expressions combined by OR. A single interval expression is either a single comparison of the property and a literal value with eq, le, lt, ge, or gt, or pair of boundaries combined by AND and enclosed in parentheses. The lower boundary is either ge or gt, the upper boundary either le or lt." />
+            </Record>
+            <Record>
+              <PropertyValue Property="Value" String="MultiRangeOrSearchExpression" />
+              <Annotation Term="Core.Description"
+                String="Property can be compared to a union of zero or more closed, half-open, or open intervals plus zero or more simple string patterns" />
+              <Annotation Term="Core.LongDescription"
+                String="The filter expression for this property consists of one or more interval expressions or string comparison functions combined by OR. See MultiRange for a definition of an interval expression. See SearchExpression for the allowed string comparison functions." />
+            </Record>
+          </Collection>
+        </Annotation>
+      </TypeDefinition>
+
+      <Term Name="SortRestrictions" Type="Capabilities.SortRestrictionsType" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Restrictions on $orderby expressions" />
+      </Term>
+      <ComplexType Name="SortRestrictionsType">
+        <Property Name="Sortable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="$orderby is supported" />
+        </Property>
+        <Property Name="AscendingOnlyProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These properties can only be used for sorting in Ascending order" />
+        </Property>
+        <Property Name="DescendingOnlyProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These properties can only be used for sorting in Descending order" />
+        </Property>
+        <Property Name="NonSortableProperties" Type="Collection(Edm.PropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These structural properties cannot be used in $orderby expressions" />
+        </Property>
+      </ComplexType>
+
+      <Term Name="ExpandRestrictions" Type="Capabilities.ExpandRestrictionsType" AppliesTo="EntitySet Singleton">
+        <Annotation Term="Core.Description" String="Restrictions on $expand expressions" />
+      </Term>
+      <ComplexType Name="ExpandRestrictionsType">
+        <Property Name="Expandable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="$expand is supported" />
+        </Property>
+        <Property Name="NonExpandableProperties" Type="Collection(Edm.NavigationPropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These properties cannot be used in $expand expressions" />
+        </Property>
+        <Property Name="MaxLevels" Type="Edm.Int32" DefaultValue="-1">
+          <Annotation Term="Core.Description"
+            String="The maximum number of levels that can be expanded in a $expand expression. A value of -1 indicates there is no restriction." />
+        </Property>
+      </ComplexType>
+
+      <Term Name="SearchRestrictions" Type="Capabilities.SearchRestrictionsType" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Restrictions on $search expressions" />
+      </Term>
+      <ComplexType Name="SearchRestrictionsType">
+        <Property Name="Searchable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="$search is supported" />
+        </Property>
+        <Property Name="UnsupportedExpressions" Type="Capabilities.SearchExpressions" DefaultValue="none">
+          <Annotation Term="Core.Description" String="Expressions not supported in $search" />
+        </Property>
+      </ComplexType>
+      <EnumType Name="SearchExpressions" IsFlags="true">
+        <Member Name="none" Value="0">
+          <Annotation Term="Core.Description" String="Single search term" />
+        </Member>
+        <Member Name="AND" Value="1">
+          <Annotation Term="Core.Description" String="Multiple search terms separated by AND" />
+        </Member>
+        <Member Name="OR" Value="2">
+          <Annotation Term="Core.Description" String="Multiple search terms separated by OR" />
+        </Member>
+        <Member Name="NOT" Value="4">
+          <Annotation Term="Core.Description" String="Search terms preceded by NOT" />
+        </Member>
+        <Member Name="phrase" Value="8">
+          <Annotation Term="Core.Description" String="Search phrases enclosed in double quotes" />
+        </Member>
+        <Member Name="group" Value="16">
+          <Annotation Term="Core.Description" String="Precedence grouping of search expressions with parentheses" />
+        </Member>
+      </EnumType>
+
+      <Term Name="KeyAsSegmentSupported" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+        <Annotation Term="Core.Description"
+          String="Supports [key-as-segment convention](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_KeyasSegmentConvention) for addressing entities within a collection" />
+      </Term>
+
+      <!-- Data Modification Capabilities -->
+
+      <Term Name="InsertRestrictions" Type="Capabilities.InsertRestrictionsType" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Restrictions on insert operations" />
+      </Term>
+      <ComplexType Name="InsertRestrictionsType">
+        <Property Name="Insertable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Entities can be inserted" />
+        </Property>
+        <Property Name="NonInsertableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These navigation properties do not allow deep inserts" />
+        </Property>
+        <Property Name="MaxLevels" Type="Edm.Int32" DefaultValue="-1">
+          <Annotation Term="Core.Description"
+            String="The maximum number of navigation properties that can be traversed when addressing the collection to insert into. A value of -1 indicates there is no restriction." />
+        </Property>
+      </ComplexType>
+
+      <Term Name="DeepInsertSupport" Type="Capabilities.DeepInsertSupportType" AppliesTo="EntityContainer EntitySet">
+        <Annotation Term="Core.Description"
+          String="Deep Insert Support of the annotated resource (the whole service, an entity set, or a collection-valued resource)" />
+      </Term>
+      <ComplexType Name="DeepInsertSupportType">
+        <Property Name="Supported" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Annotation target supports deep inserts" />
+        </Property>
+        <Property Name="ContentIDSupported" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description"
+            String="Annotation target supports accepting and returning nested entities annotated with the `Core.ContentID` instance annotation." />
+        </Property>
+      </ComplexType>
+
+      <Term Name="UpdateRestrictions" Type="Capabilities.UpdateRestrictionsType" AppliesTo="EntitySet Singleton">
+        <Annotation Term="Core.Description" String="Restrictions on update operations" />
+      </Term>
+      <ComplexType Name="UpdateRestrictionsType">
+        <Property Name="Updatable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Entities can be updated" />
+        </Property>
+        <Property Name="NonUpdatableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These navigation properties do not allow rebinding" />
+        </Property>
+        <Property Name="MaxLevels" Type="Edm.Int32" DefaultValue="-1">
+          <Annotation Term="Core.Description"
+            String="The maximum number of navigation properties that can be traversed when addressing the collection or entity to update. A value of -1 indicates there is no restriction." />
+        </Property>
+      </ComplexType>
+
+      <Term Name="DeleteRestrictions" Type="Capabilities.DeleteRestrictionsType" AppliesTo="EntitySet">
+        <Annotation Term="Core.Description" String="Restrictions on delete operations" />
+      </Term>
+      <ComplexType Name="DeleteRestrictionsType">
+        <Property Name="Deletable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Entities can be deleted" />
+        </Property>
+        <Property Name="NonDeletableNavigationProperties" Type="Collection(Edm.NavigationPropertyPath)" Nullable="false">
+          <Annotation Term="Core.Description" String="These navigation properties do not allow DeleteLink requests" />
+        </Property>
+        <Property Name="MaxLevels" Type="Edm.Int32" DefaultValue="-1">
+          <Annotation Term="Core.Description"
+            String="The maximum number of navigation properties that can be traversed when addressing the collection to delete from or the entity to delete. A value of -1 indicates there is no restriction." />
+        </Property>
+      </ComplexType>
+
+      <Term Name="CollectionPropertyRestrictions" Type="Collection(Capabilities.CollectionPropertyRestrictionsType)" AppliesTo="EntitySet Singleton">
+        <Annotation Term="Core.Description" String="Describes restrictions on operations applied to collection-valued structural properties" />
+      </Term>
+      <ComplexType Name="CollectionPropertyRestrictionsType">
+        <Property Name="CollectionProperty" Type="Edm.PropertyPath">
+          <Annotation Term="Core.Description" String="Restricted Collection-valued property" />
+        </Property>
+        <Property Name="FilterFunctions" Type="Collection(Edm.String)">
+          <Annotation Term="Core.Description"
+            String="List of functions and operators supported in $filter. If null, all functions and operators may be attempted" />
+        </Property>
+        <Property Name="FilterRestrictions" Type="Capabilities.FilterRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on $filter expressions" />
+        </Property>
+        <Property Name="SearchRestrictions" Type="Capabilities.SearchRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on $search expressions" />
+        </Property>
+        <Property Name="SortRestrictions" Type="Capabilities.SortRestrictionsType">
+          <Annotation Term="Core.Description" String="Restrictions on $orderby expressions" />
+        </Property>
+        <Property Name="TopSupported" Type="Core.Tag" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Supports $top" />
+        </Property>
+        <Property Name="SkipSupported" Type="Core.Tag" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Supports $skip" />
+        </Property>
+        <Property Name="Insertable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="This collection supports positional inserts" />
+        </Property>
+        <Property Name="Updatable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Members of this ordered collection can be updated by ordinal" />
+        </Property>
+        <Property Name="Deletable" Type="Edm.Boolean" DefaultValue="true">
+          <Annotation Term="Core.Description" String="Members of this ordered collection can be deleted by ordinal" />
+        </Property>
+      </ComplexType>
+
+    </Schema>
+  </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/Integration.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Integration.xml
new file mode 100644
index 0000000..55bb9d1
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/Integration.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<edmx:Edmx
+	xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+	<edmx:Reference
+		Uri="http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml">
+		<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1" />
+	</edmx:Reference>
+	<edmx:Reference
+		Uri="http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Capabilities.V1.xml">
+		<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1" />
+	</edmx:Reference>
+	<edmx:DataServices>
+		<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm"
+			Namespace="com.test.vocabularies.DataIntegration.v1" Alias="Integration">
+			<Annotation Term="Core.Description">
+				<String>Terms describing data extraction capabilities</String>
+			</Annotation>
+			<Term Name="Extractable" Type="Edm.Boolean" DefaultValue="false"
+				AppliesTo="EntitySet">
+				<Annotation Term="Core.Description"
+					String="Defines if entity set is extractable" />
+			</Term>
+			<Term Name="OriginalDataType" Type="Edm.String" DefaultValue=""
+				AppliesTo="Property">
+				<Annotation Term="Core.Description"
+					String="Defines the type in the source systewm" />
+			</Term>
+			<Term Name="SourceSystem" Type="Edm.String" DefaultValue=""
+				AppliesTo="Container">
+				<Annotation Term="Core.Description"
+					String="Defines the source system" />
+			</Term>
+			<EnumType Name="DeltaMethodType">
+				<Member Name="NONE">
+					<Annotation Term="Core.Description"
+						String="Delta is nor supported" />
+				</Member>
+				<Member Name="INSERT">
+					<Annotation Term="Core.Description"
+						String="Delta is only supported for inserts" />
+				</Member>
+				<Member Name="INSERT_UPDATE">
+					<Annotation Term="Core.Description"
+						String="Delta is supported for inserts and updates" />
+				</Member>
+				<Member Name="INSERT_UPDATE_DELETE">
+					<Annotation Term="Core.Description"
+						String="Delta is supported for inserts, updates and deletes" />
+				</Member>
+			</EnumType>
+			<Term Name="DeltaMethod" Type="Integration.DeltaMethodType"
+				AppliesTo="EntitySet">
+				<Annotation Term="Core.Description"
+					String="Defines iwhich delta method the entity set supports" />
+			</Term>
+		</Schema>
+	</edmx:DataServices>
+</edmx:Edmx>
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotations.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotations.xml
index a89467d..4670d85 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotations.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/annotations.xml
@@ -34,12 +34,18 @@
     <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/ComplexProperty/PropertyInt16">
         <Annotation Term="UI.AdditionalInfo"/>
     </Annotations>
+    <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/ComplexProperty/PropertyInt16">
+        <Annotation Term="UI.HeaderInfo"/>
+    </Annotations>
     <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/ComplexProperty/NavPropertyDraftAdministrativeDataType">
         <Annotation Term="UI.AdditionalInfo"/>
     </Annotations>
-    <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SINav/ComplexProperty/NavPropertyDraftAdministrativeDataType">
+    <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/SINav/ComplexProperty/NavPropertyDraftAdministrativeDataType">
         <Annotation Term="UI.AdditionalInfo"/>
     </Annotations>
+    <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SINav/ComplexProperty/NavPropertyDraftAdministrativeDataType">
+        <Annotation Term="UI.HeaderInfo"/>
+    </Annotations>
     <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SEPMRA_C_SalesOrderCustCntctVH/to_Customer">
         <Annotation Term="UI.AdditionalInfo"/>
     </Annotations>
@@ -48,8 +54,6 @@
     </Annotations>
     <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/DraftUUID">
         <Annotation Term="UI.AdditionalInfo"/>
-    </Annotations>
-    <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData/DraftUUID">
         <Annotation Term="UI.HeaderInfo"/>
     </Annotations>
     <Annotations Target="SEPMRA_SO_MAN2.I_DraftAdministrativeDataType/DraftUUID">
@@ -70,7 +74,7 @@
     <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/AIRTString">
         <Annotation Term="UI.HeaderInfo"/>
       </Annotations>
-    <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/SINav">
+    <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/SINav">
       <Annotation Term="UI.HeaderInfo"/>
     </Annotations>
     <Annotations Target="SEPMRA_SO_MAN2.TDString">
@@ -87,7 +91,7 @@
       </Annotations>
       <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities/I_DraftAdministrativeData">
         <Annotation Term="UI.HeaderInfo"/>
-      </Annotations>
+      </Annotations> 
       <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_SO_MAN2_Entities">
         <Annotation Term="UI.HeaderInfo"/>
       </Annotations>
@@ -147,6 +151,9 @@
       <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType/to_Customer">
         <Annotation Term="UI.ThingPerspective"/>
       </Annotations>
+      <Annotations Target="Test.SEPMRA_C_SalesOrderCustCntctVHType/to_Customer">
+        <Annotation Term="UI.HeaderInfo"/>
+      </Annotations>
       <Annotations Target="SEPMRA_SO_MAN2.SEPMRA_C_SalesOrderCustCntctVHType">
         <Annotation Term="UI.FieldGroup" Qualifier="ContactPerson">
           <Record>
@@ -1271,6 +1278,29 @@
         <Annotation Term="UI.HiddenFilter"/>
         <Annotation Term="Common.SemanticObject" String="EPMSalesOrder"/>
       </Annotations>
+     <Annotations Target="Test.SEPMRA_SO_MAN2_Entities/CDI_CDC_SOURCEResult">
+		<Annotation Term="UI.Identification">
+          <Collection>
+            <Record Type="UI.DataField">
+              <PropertyValue Property="Value" Path="UnitOfMeasure"/>
+              <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
+            </Record>
+          </Collection>
+        </Annotation>
+	</Annotations>
+	<Annotations Target="Test.CDI_CDC_SOURCEResult">
+		<Annotation Term="UI.HeaderInfo"/>
+	</Annotations>
+	<Annotations Target="Test.SEPMRA_SO_MAN2_Entities/FIC_RTTimeOfDay_">
+		<Annotation Term="UI.Identification">
+          <Collection>
+            <Record Type="UI.DataField">
+              <PropertyValue Property="Value" Path="UnitOfMeasure"/>
+              <Annotation Term="UI.Importance" EnumMember="UI.ImportanceType/High"/>
+            </Record>
+          </Collection>
+        </Annotation>
+	</Annotations>
     </Schema>
   </edmx:DataServices>
 </edmx:Edmx>
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
index 06d053e..aa5a52e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
@@ -37,6 +37,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
 import org.apache.olingo.commons.api.edm.EdmTerm;
 import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
 
 public abstract class AbstractEdm implements Edm {
 
@@ -96,6 +97,9 @@ public abstract class AbstractEdm implements Edm {
   private final Map<FullQualifiedName, EdmComplexType> complexTypesDerivedFromES =
       Collections.synchronizedMap(new HashMap<FullQualifiedName, EdmComplexType>());
 
+  private Map<String, List<CsdlAnnotation>> annotationMap = 
+      new HashMap<String, List<CsdlAnnotation>>();
+  
   @Override
   public List<EdmSchema> getSchemas() {
     if (schemaList == null) {
@@ -547,4 +551,8 @@ public abstract class AbstractEdm implements Edm {
   protected boolean isPreviousES() {
     return isPreviousES;
   }
+  
+  protected Map<String, List<CsdlAnnotation>> getAnnotationsMap() {
+    return annotationMap;
+  }
 }
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
index 9255cda..86733ee 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityContainerImpl.java
@@ -24,7 +24,6 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.olingo.commons.api.ex.ODataException;
 import org.apache.olingo.commons.api.edm.Edm;
 import org.apache.olingo.commons.api.edm.EdmActionImport;
 import org.apache.olingo.commons.api.edm.EdmEntityContainer;
@@ -34,8 +33,8 @@ import org.apache.olingo.commons.api.edm.EdmFunctionImport;
 import org.apache.olingo.commons.api.edm.EdmSingleton;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.edm.provider.CsdlActionImport;
+import org.apache.olingo.commons.api.edm.provider.CsdlAliasInfo;
 import org.apache.olingo.commons.api.edm.provider.CsdlAnnotation;
-import org.apache.olingo.commons.api.edm.provider.CsdlAnnotations;
 import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
 import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
 import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
@@ -44,8 +43,8 @@ import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
 import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
 import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
 import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlOperationImport;
 import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
-import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
 import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
 import org.apache.olingo.commons.api.ex.ODataException;
 
@@ -75,6 +74,8 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
   private final Map<String, EdmSingleton> singletonWithAnnotationsCache = Collections.synchronizedMap(
       new LinkedHashMap<String, EdmSingleton>());
   private boolean isSingletonAnnotationsIncluded = false;
+  private final String SLASH = "/";
+  private final String DOT = ".";
 
   public EdmEntityContainerImpl(final Edm edm, final CsdlEdmProvider provider,
       final CsdlEntityContainerInfo entityContainerInfo) {
@@ -216,7 +217,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
     try {
       final CsdlSingleton providerSingleton = provider.getSingleton(entityContainerName, singletonName);
       if (providerSingleton != null) {
-		addAnnotations(providerSingleton, entityContainerName);
+        addSingletonAnnotations(providerSingleton, entityContainerName);
         singleton = new EdmSingletonImpl(edm, this, providerSingleton);
       }
     } catch (ODataException e) {
@@ -226,61 +227,130 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
     return singleton;
   }
 
-  private void addAnnotations(CsdlSingleton singleton, FullQualifiedName entityContainerName) {
-    boolean isPropAnnotationsCleared = false;
-    boolean isNavPropAnnotationsCleared = false;
+  private void addSingletonAnnotations(CsdlSingleton singleton, FullQualifiedName entityContainerName) {
     CsdlEntityType entityType = fetchEntityTypeFromSingleton(singleton);
     if (entityType == null) {
       return;
     }
-    
-    List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().
-            equalsIgnoreCase(entityContainerName + "/" + singleton.getName())) {
-          isSingletonAnnotationsIncluded = true;
-          addAnnotationsToSingleton(singleton, annotationGrp);
-        } else {
-          addAnnotationsToPropertiesDerivedFromSingleton(singleton, isPropAnnotationsCleared,
-              isNavPropAnnotationsCleared, entityType, annotationGrp);
-          isPropAnnotationsCleared = true;
-          isNavPropAnnotationsCleared = true;
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(entityContainerName + SLASH + singleton.getName());
+    addAnnotationsOnSingleton(singleton, annotations);
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(aliasName + DOT + entityContainerName.getName() + SLASH + singleton.getName());
+    addAnnotationsOnSingleton(singleton, annotationsOnAlias);
+    addAnnotationsToPropertiesDerivedFromSingleton(singleton, entityType, entityContainerName);
+   }
+
+  /**
+   * Adds annotations on singleton
+   * @param singleton
+   * @param annotations
+   */
+  private void addAnnotationsOnSingleton(CsdlSingleton singleton, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      isSingletonAnnotationsIncluded = true;
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(singleton.getAnnotations(), annotation)) {
+          singleton.getAnnotations().add(annotation);
         }
       }
     }
-   }
-
+  }
+  
+  /**
+   * Get alias name given the namespace from the alias info 
+   * @param namespace
+   * @return
+   */
+  private String getAliasInfo(String namespace) {
+    try {
+      if (null != provider.getAliasInfos()) {
+        for (CsdlAliasInfo aliasInfo : provider.getAliasInfos()) {
+          if (aliasInfo.getNamespace().equalsIgnoreCase(namespace)) {
+            return aliasInfo.getAlias();
+          }
+        }
+      }
+    } catch (ODataException e) {
+      throw new EdmException(e);
+    }
+    return null;
+  }
+  
   /** adds annotations to entity type properties derived from singleton
+   * E.g of target paths
+   * MySchema.MyEntityContainer/MySingleton/MyComplexProperty/MyNavigationProperty
    * @param singleton
    * @param isPropAnnotationsCleared
    * @param isNavPropAnnotationsCleared
    * @param entityType
+   * @param entityContainerName
    * @param annotationGrp
    */
-  private void addAnnotationsToPropertiesDerivedFromSingleton(CsdlSingleton singleton, boolean isPropAnnotationsCleared,
-      boolean isNavPropAnnotationsCleared, CsdlEntityType entityType, CsdlAnnotations annotationGrp) {
-    for (CsdlProperty propertyName : entityType.getProperties()) {
-      if (!isPropAnnotationsCleared) {
-        entityType.getProperty(propertyName.getName()).getAnnotations().clear();
-      }
-      if (isPropertyComplex(propertyName)) {
-        CsdlComplexType complexType = getComplexTypeFromProperty(propertyName);
-        addAnnotationsToComplexTypeIncludedFromSingleton(singleton, 
-           annotationGrp, propertyName, isNavPropAnnotationsCleared, complexType);
+  private void addAnnotationsToPropertiesDerivedFromSingleton(CsdlSingleton singleton, 
+      CsdlEntityType entityType, FullQualifiedName entityContainerName) {
+    String entitySetName = null;
+    String schemaName = null;
+    String containerName = null;
+    try {
+      List<CsdlEntitySet> entitySets = this.provider.getEntityContainer() != null ? 
+          this.provider.getEntityContainer().getEntitySets() : new ArrayList<CsdlEntitySet>();
+      for (CsdlEntitySet entitySet : entitySets) {
+        entitySetName = entitySet.getName();
+        String entityTypeName = entitySet.getTypeFQN().getFullQualifiedNameAsString();
+        if ((null != entityTypeName && entityTypeName.equalsIgnoreCase(
+            entitySet.getTypeFQN().getNamespace() + DOT + entityType.getName()))) {
+          containerName = this.provider.getEntityContainer().getName();
+          schemaName = entitySet.getTypeFQN().getNamespace();
+          for (CsdlProperty property : entityType.getProperties()) {
+            if (isPropertyComplex(property)) {
+              CsdlComplexType complexType = getComplexTypeFromProperty(property);
+              addAnnotationsToComplexTypeIncludedFromSingleton(singleton, property, complexType);
+            }
+            removeAnnotationsAddedToPropertiesOfEntityType(entityType, property, entityContainerName);
+            removeAnnotationsAddedToPropertiesViaEntitySet(entityType, property, 
+                schemaName, containerName, entitySetName);
+          }
+        }
       }
+    } catch (ODataException e) {
+      throw new EdmException(e);
     }
   }
+  
+  /**
+   * If annotations are added to properties via Entity set then remove them
+   * @param entityType
+   * @param property
+   * @param schemaName
+   * @param containerName
+   * @param entitySetName
+   */
+  private void removeAnnotationsAddedToPropertiesViaEntitySet(CsdlEntityType entityType, CsdlProperty property,
+      String schemaName, String containerName, String entitySetName) {
+    List<CsdlAnnotation> annotPropDerivedFromES = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+        schemaName + DOT + 
+        containerName + SLASH +  entitySetName + SLASH + property.getName());
+    removeAnnotationsOnPropertiesDerivedFromES(entityType, property, annotPropDerivedFromES);
+    String aliasName = getAliasInfo(schemaName);
+    List<CsdlAnnotation> annotPropDerivedFromESOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+        aliasName + DOT + 
+        containerName + SLASH +  entitySetName + SLASH + property.getName());
+    removeAnnotationsOnPropertiesDerivedFromES(entityType, property, annotPropDerivedFromESOnAlias);
+  }
 
-  /** Adds annotation to singleton
-   * @param singleton
-   * @param annotationGrp
+  /**
+   * Removes the annotations added on properties via Entity Set in case of singleton flow
+   * @param entityType
+   * @param property
+   * @param annotPropDerivedFromES
    */
-  private void addAnnotationsToSingleton(CsdlSingleton singleton, CsdlAnnotations annotationGrp) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-      if (!compareAnnotations(singleton.getAnnotations(), annotation)) {
-        singleton.getAnnotations().add(annotation);
+  private void removeAnnotationsOnPropertiesDerivedFromES(CsdlEntityType entityType, CsdlProperty property,
+      List<CsdlAnnotation> annotPropDerivedFromES) {
+    if (null != annotPropDerivedFromES && !annotPropDerivedFromES.isEmpty()) {
+      for (CsdlAnnotation annotation : annotPropDerivedFromES) {
+        entityType.getProperty(property.getName()).getAnnotations().remove(annotation);
       }
     }
   }
@@ -310,19 +380,73 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
    * @param complexType
    */
   private void addAnnotationsToComplexTypeIncludedFromSingleton(CsdlSingleton singleton,
-      CsdlAnnotations annotationGrp, CsdlProperty propertyName,
-      boolean isComplexNavPropAnnotationsCleared, CsdlComplexType complexType) {
+      CsdlProperty propertyName, CsdlComplexType complexType) {
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    for (CsdlProperty complexPropertyName : complexType.getProperties()) {
+      removeAnnotationAddedToPropertiesOfComplexType(complexType, complexPropertyName, entityContainerName);
+      
+      List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+          entityContainerName + SLASH + 
+              singleton.getName() + SLASH + 
+              propertyName.getName() + SLASH + complexPropertyName.getName());
+      addAnnotationsOnComplexTypeProperties(complexType, complexPropertyName, annotations);
+      List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+          aliasName + DOT + entityContainerName.getName() + SLASH + 
+              singleton.getName() + SLASH + 
+              propertyName.getName() + SLASH + complexPropertyName.getName());
+      addAnnotationsOnComplexTypeProperties(complexType, complexPropertyName, annotationsOnAlias);
+    }
     for (CsdlNavigationProperty complexNavPropertyName : complexType.getNavigationProperties()) {
-      if (!isComplexNavPropAnnotationsCleared) {
-        complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().clear();
+      checkAnnotationAddedToNavPropertiesOfComplexType(complexType, complexNavPropertyName, entityContainerName);
+      
+      List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(entityContainerName +
+          SLASH + singleton.getName() + SLASH + 
+          propertyName.getName() + SLASH + complexNavPropertyName.getName());
+      addAnnotationsOnComplexTypeNavProperties(complexType, complexNavPropertyName, annotations);
+      List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+          aliasName + DOT + entityContainerName.getName() +
+          SLASH + singleton.getName() + SLASH + 
+          propertyName.getName() + SLASH + complexNavPropertyName.getName());
+      addAnnotationsOnComplexTypeNavProperties(complexType, complexNavPropertyName, annotationsOnAlias);
+    }    
+  }
+  
+  /**
+   * Adds annotations on complex type navigation properties
+   * @param complexType
+   * @param complexNavProperty
+   * @param annotations
+   */
+  private void addAnnotationsOnComplexTypeNavProperties(CsdlComplexType complexType,
+      CsdlNavigationProperty complexNavProperty, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      isAnnotationsIncluded = true;
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(complexType.getNavigationProperty(
+            complexNavProperty.getName()).getAnnotations(), annotation)) {
+          complexType.getNavigationProperty(complexNavProperty.getName()).getAnnotations().add(annotation); 
+        }
       }
-      if (annotationGrp.getTarget().
-          equalsIgnoreCase(entityContainerName + "/" + singleton.getName() + "/" + 
-      propertyName.getName() + "/" + complexNavPropertyName.getName())) {
-        isSingletonAnnotationsIncluded = true;
-        addAnnotationsToComplexTypeNavProperties(annotationGrp, complexType, complexNavPropertyName);
+    }
+  }
+
+  /**
+   * Adds annotations on complex type properties
+   * @param complexType
+   * @param complexProperty
+   * @param annotations
+   */
+  private void addAnnotationsOnComplexTypeProperties(CsdlComplexType complexType, CsdlProperty complexProperty,
+      List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      isAnnotationsIncluded = true;
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(complexType.getProperty(
+            complexProperty.getName()).getAnnotations(), annotation)) {
+          complexType.getProperty(complexProperty.getName()).getAnnotations().add(annotation); 
+        }
       }
-    }    
+    }
   }
   
   protected EdmEntitySet createEntitySet(final String entitySetName) {
@@ -331,7 +455,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
     try {
       final CsdlEntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName);
       if (providerEntitySet != null) {
-		addAnnotations(providerEntitySet, entityContainerName);
+		addEntitySetAnnotations(providerEntitySet, entityContainerName);
         entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet);
       }
     } catch (ODataException e) {
@@ -341,42 +465,36 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
     return entitySet;
   }
 
-  private void addAnnotations(CsdlEntitySet entitySet, FullQualifiedName entityContainerName) {
-    boolean isPropAnnotationsCleared = false;
-    boolean isNavPropAnnotationsCleared = false;
+  private void addEntitySetAnnotations(CsdlEntitySet entitySet, FullQualifiedName entityContainerName) {
     CsdlEntityType entityType = getCsdlEntityTypeFromEntitySet(entitySet);
     if (entityType == null) {
       return;
     }
     
-   List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
-   for (CsdlSchema schema : termSchemaDefinition) {
-     List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-     for (CsdlAnnotations annotationGrp : annotationGrps) {
-       if (annotationGrp.getTarget().
-           equalsIgnoreCase(entityContainerName + "/" + entitySet.getName())) {
-         isAnnotationsIncluded = true;
-         addAnnotationsToEntitySet(entitySet, annotationGrp);
-       } else {
-         addAnnotationsToEntityTypeIncludedFromES(entitySet, entityContainerName,
-             annotationGrp, isPropAnnotationsCleared, isNavPropAnnotationsCleared, entityType);
-         isPropAnnotationsCleared = true;
-         isNavPropAnnotationsCleared = true;
-       }
-     }
-   }
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(entityContainerName + SLASH + entitySet.getName());
+    addAnnotationsOnEntitySet(entitySet, annotations);
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(aliasName + DOT + entityContainerName.getName() + SLASH + entitySet.getName());
+    addAnnotationsOnEntitySet(entitySet, annotationsOnAlias);
+    addAnnotationsToPropertiesIncludedFromES(entitySet, entityContainerName, entityType);
   }
 
   /**
+   * Adds annotations on entity sets
    * @param entitySet
-   * @param annotationGrp
+   * @param annotations
    */
-  private void addAnnotationsToEntitySet(CsdlEntitySet entitySet, CsdlAnnotations annotationGrp) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-       if (!compareAnnotations(entitySet.getAnnotations(), annotation)) {
-         entitySet.getAnnotations().add(annotation);
-       }
-     }
+  private void addAnnotationsOnEntitySet(CsdlEntitySet entitySet, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      isAnnotationsIncluded = true;
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(entitySet.getAnnotations(), annotation)) {
+          entitySet.getAnnotations().add(annotation);
+        }
+      }
+    }
   }
 
   /**
@@ -395,78 +513,175 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
   }
 
   /** Adds annotations to Entity type Properties derived from entity set
+   * E.g of target paths 
+   * MySchema.MyEntityContainer/MyEntitySet/MyProperty
+   * MySchema.MyEntityContainer/MyEntitySet/MyNavigationProperty
+   * MySchema.MyEntityContainer/MyEntitySet/MyComplexProperty/MyProperty
+   * MySchema.MyEntityContainer/MyEntitySet/MyComplexProperty/MyNavigationProperty
    * @param entitySet
    * @param entityContainerName
-   * @param annotationGrp
    * @param entityType 
-   * @param isNavPropAnnotationsCleared 
-   * @param isPropAnnotationsCleared
    * @return
    */
-  private void addAnnotationsToEntityTypeIncludedFromES(CsdlEntitySet entitySet,
-      FullQualifiedName entityContainerName, CsdlAnnotations annotationGrp, 
-      boolean isPropAnnotationsCleared, boolean isNavPropAnnotationsCleared, CsdlEntityType entityType) {
-     for (CsdlProperty propertyName : entityType.getProperties()) {
-       if (!isPropAnnotationsCleared) {
-         entityType.getProperty(propertyName.getName()).getAnnotations().clear();
-       }
-       if (isPropertyComplex(propertyName)) {
-         CsdlComplexType complexType = getComplexTypeFromProperty(propertyName);
-         addAnnotationsToComplexTypeIncludedFromES(entitySet, entityContainerName,
-            annotationGrp, propertyName, isPropAnnotationsCleared, isNavPropAnnotationsCleared, complexType);
-       } else {
-         if (annotationGrp.getTarget().
-             equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" + 
-         propertyName.getName())) {
-           isAnnotationsIncluded = true;
-           addAnnotationsToEntityTypeProperties(annotationGrp, entityType, propertyName);
-         }
-       }
-     }
-     for (CsdlNavigationProperty navPropertyName : entityType.getNavigationProperties()) {
-       if (!isNavPropAnnotationsCleared) {
-         entityType.getNavigationProperty(navPropertyName.getName()).getAnnotations().clear();
-       }
-       if (annotationGrp.getTarget().
-           equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" + 
-       navPropertyName.getName())) {
-         isAnnotationsIncluded = true;
-         addAnnotationsToEntityTypeNavProperties(annotationGrp, entityType, navPropertyName);
-       }
+  private void addAnnotationsToPropertiesIncludedFromES(CsdlEntitySet entitySet,
+      FullQualifiedName entityContainerName, CsdlEntityType entityType) {
+    for (CsdlProperty property : entityType.getProperties()) {
+      removeAnnotationsAddedToPropertiesOfEntityType(entityType, property, entityContainerName);
+        if (isPropertyComplex(property)) {
+          CsdlComplexType complexType = getComplexTypeFromProperty(property);
+          addAnnotationsToComplexTypeIncludedFromES(entitySet, entityContainerName,
+             property, complexType);
+        } else {
+          addAnnotationsToETProperties(entitySet, entityContainerName, entityType, property);
+        }
+      }
+     for (CsdlNavigationProperty navProperty : entityType.getNavigationProperties()) {
+       removeAnnotationAddedToNavProperties(entityType, navProperty, entityContainerName);
+       addAnnotationsToETNavProperties(entitySet, entityContainerName, entityType, navProperty);
      }
   }
 
-  /** Adds annotations to Entity type Navigation Properties derived from entity set
-   * @param annotationGrp
+  /**
+   * @param entitySet
+   * @param entityContainerName
    * @param entityType
-   * @param navPropertyName
+   * @param property
    */
-  private void addAnnotationsToEntityTypeNavProperties(CsdlAnnotations annotationGrp, CsdlEntityType entityType,
-      CsdlNavigationProperty navPropertyName) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-       if (!compareAnnotations(entityType.getNavigationProperty(
-           navPropertyName.getName()).getAnnotations(), annotation)) {
-         entityType.getNavigationProperty(navPropertyName.getName()).getAnnotations().add(annotation); 
-       }
-     }
+  private void addAnnotationsToETProperties(CsdlEntitySet entitySet, FullQualifiedName entityContainerName,
+      CsdlEntityType entityType, CsdlProperty property) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+        entityContainerName + SLASH + entitySet.getName() + SLASH + 
+        property.getName());
+    addAnnotationsOnETProperties(entityType, property, annotations);
+    
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+        aliasName + DOT + entityContainerName.getName() + SLASH + entitySet.getName() + SLASH + 
+        property.getName());
+    addAnnotationsOnETProperties(entityType, property, annotationsOnAlias);
   }
 
-  /** Adds annotations to Entity type Properties derived from entity set
-   * @param annotationGrp
+  /**
+   * Adds annotations to Entity type Properties derived from entity set
    * @param entityType
-   * @param propertyName
+   * @param property
+   * @param annotations
+   */
+  private void addAnnotationsOnETProperties(CsdlEntityType entityType, CsdlProperty property,
+      List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      isAnnotationsIncluded = true;
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(entityType.getProperty(
+            property.getName()).getAnnotations(), annotation)) {
+          entityType.getProperty(property.getName()).getAnnotations().add(annotation); 
+        }
+      }
+    }
+  }
+
+  /**
+   * Adds annotations to Entity type Navigation Properties derived from entity set
+   * @param entitySet
+   * @param entityContainerName
+   * @param entityType
+   * @param navProperty
    */
-  private void addAnnotationsToEntityTypeProperties(CsdlAnnotations annotationGrp, CsdlEntityType entityType,
-      CsdlProperty propertyName) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-       if (!compareAnnotations(entityType.getProperty(
-           propertyName.getName()).getAnnotations(), annotation)) {
-         entityType.getProperty(propertyName.getName()).getAnnotations().add(annotation); 
+  private void addAnnotationsToETNavProperties(CsdlEntitySet entitySet, FullQualifiedName entityContainerName,
+      CsdlEntityType entityType, CsdlNavigationProperty navProperty) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+         entityContainerName + SLASH + entitySet.getName() + SLASH + 
+             navProperty.getName());
+     addAnnotationsOnETNavProperties(entityType, navProperty, annotations);
+     
+     String aliasName = getAliasInfo(entityContainerName.getNamespace());
+     List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+         aliasName + DOT + entityContainerName.getName() + SLASH + entitySet.getName() + SLASH + 
+             navProperty.getName());
+     addAnnotationsOnETNavProperties(entityType, navProperty, annotationsOnAlias);
+  }
+
+  /**
+   * @param entityType
+   * @param navProperty
+   * @param annotations
+   */
+  private void addAnnotationsOnETNavProperties(CsdlEntityType entityType, CsdlNavigationProperty navProperty,
+      List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+       isAnnotationsIncluded = true;
+       for (CsdlAnnotation annotation : annotations) {
+         if (!compareAnnotations(entityType.getNavigationProperty(
+             navProperty.getName()).getAnnotations(), annotation)) {
+           entityType.getNavigationProperty(navProperty.getName()).getAnnotations().add(annotation); 
+         }
        }
      }
   }
 
   /**
+   * If annotations are added to properties via entity type path, then remove it
+   * @param type
+   * @param property
+   * @param entityContainerName
+   */
+  private void removeAnnotationsAddedToPropertiesOfEntityType(CsdlEntityType type, CsdlProperty property, 
+      FullQualifiedName entityContainerName) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(entityContainerName.getNamespace() + 
+        DOT + type.getName() + SLASH + property.getName());
+    removeAnnotationsOnETProperties(property, annotations);
+    
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(aliasName + DOT + entityContainerName.getName() + 
+        DOT + type.getName() + SLASH + property.getName());
+    removeAnnotationsOnETProperties(property, annotationsOnAlias);
+  }
+
+  /**
+   * Removes the annotations added on Entity type
+   * properties when there is a target path on entity type
+   * @param property
+   * @param annotations
+   */
+  private void removeAnnotationsOnETProperties(CsdlProperty property, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      for (CsdlAnnotation annotation : annotations) {
+        property.getAnnotations().remove(annotation); 
+      }
+    }
+  }
+  
+  private void removeAnnotationAddedToNavProperties(CsdlEntityType entityType, 
+      CsdlNavigationProperty navProperty, FullQualifiedName entityContainerName) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+        entityContainerName.getNamespace() + 
+        DOT + entityType.getName() + SLASH + navProperty.getName());
+    removeAnnotationsOnNavProperties(navProperty, annotations);
+    
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+        aliasName + DOT + entityContainerName.getName() + 
+        DOT + entityType.getName() + SLASH + navProperty.getName());
+    removeAnnotationsOnNavProperties(navProperty, annotationsOnAlias);
+  }
+
+  /**
+   * Removes the annotations added on Entity type
+   * navigation properties when there is a target path on entity type
+   * @param property
+   * @param annotations
+   */
+  private void removeAnnotationsOnNavProperties(CsdlNavigationProperty property, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      for (CsdlAnnotation annotation : annotations) {
+        property.getAnnotations().remove(annotation); 
+      }
+    }
+  }
+
+  /**
    * @param propertyName
    * @return
    */
@@ -483,69 +698,69 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
   /**
    * @param entitySet
    * @param entityContainerName
-   * @param annotationGrp
-   * @param propertyName
+   * @param complexProperty
    * @param complexType 
-   * @param isComplexNavPropAnnotationsCleared2 
-   * @param isComplexPropAnnotationsCleared2 
    * @return
    */
   private void addAnnotationsToComplexTypeIncludedFromES(CsdlEntitySet entitySet,
-      FullQualifiedName entityContainerName, CsdlAnnotations annotationGrp, 
-      CsdlProperty propertyName, boolean isComplexPropAnnotationsCleared, 
-      boolean isComplexNavPropAnnotationsCleared, CsdlComplexType complexType) {
-     for (CsdlProperty complexPropertyName : complexType.getProperties()) {
-       if (!isComplexPropAnnotationsCleared) {
-         complexType.getProperty(complexPropertyName.getName()).getAnnotations().clear();
-       }
-       if (annotationGrp.getTarget().
-           equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" + 
-       propertyName.getName() + "/" + complexPropertyName.getName())) {
-         isAnnotationsIncluded = true;
-         addAnnotationsToComplexTypeProperties(annotationGrp, complexType, complexPropertyName);
-       }
-     }
-     for (CsdlNavigationProperty complexNavPropertyName : complexType.getNavigationProperties()) {
-       if (!isComplexNavPropAnnotationsCleared) {
-         complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().clear();
-       }
-       if (annotationGrp.getTarget().
-           equalsIgnoreCase(entityContainerName + "/" + entitySet.getName() + "/" + 
-       propertyName.getName() + "/" + complexNavPropertyName.getName())) {
-         isAnnotationsIncluded = true;
-         addAnnotationsToComplexTypeNavProperties(annotationGrp, complexType, complexNavPropertyName);
-       }
-     }
-  }
-
-  /**
-   * @param annotationGrp
-   * @param complexType
-   * @param complexNavPropertyName
-   */
-  private void addAnnotationsToComplexTypeNavProperties(CsdlAnnotations annotationGrp, CsdlComplexType complexType,
-      CsdlNavigationProperty complexNavPropertyName) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-       if (!compareAnnotations(complexType.getNavigationProperty(
-           complexNavPropertyName.getName()).getAnnotations(), annotation)) {
-         complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().add(annotation); 
-       }
-     }
+      FullQualifiedName entityContainerName, CsdlProperty complexProperty, 
+      CsdlComplexType complexType) {
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    for (CsdlProperty complexPropertyName : complexType.getProperties()) {
+      removeAnnotationAddedToPropertiesOfComplexType(complexType, complexPropertyName, entityContainerName);
+      
+      List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(entityContainerName + SLASH + 
+      entitySet.getName() + SLASH + 
+      complexProperty.getName() + SLASH + complexPropertyName.getName());
+      addAnnotationsOnComplexTypeProperties(complexType, complexPropertyName, annotations);
+      
+      List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+          aliasName + DOT + entityContainerName.getName() + SLASH + 
+          entitySet.getName() + SLASH + 
+          complexProperty.getName() + SLASH + complexPropertyName.getName());
+      addAnnotationsOnComplexTypeProperties(complexType, complexPropertyName, annotationsOnAlias);
+    }
+    for (CsdlNavigationProperty complexNavProperty : complexType.getNavigationProperties()) {
+      checkAnnotationAddedToNavPropertiesOfComplexType(complexType, complexNavProperty, entityContainerName);
+      
+      List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+          entityContainerName + SLASH + entitySet.getName() + SLASH + 
+          complexProperty.getName() + SLASH + complexNavProperty.getName());
+      addAnnotationsOnComplexTypeNavProperties(complexType, complexNavProperty, annotations);
+      
+      List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().get(
+          aliasName + DOT + entityContainerName.getName() + SLASH + entitySet.getName() + SLASH + 
+          complexProperty.getName() + SLASH + complexNavProperty.getName());
+      addAnnotationsOnComplexTypeNavProperties(complexType, complexNavProperty, annotationsOnAlias);
+    }
   }
 
-  /**
-   * @param annotationGrp
-   * @param complexType
-   * @param complexPropertyName
-   */
-  private void addAnnotationsToComplexTypeProperties(CsdlAnnotations annotationGrp, CsdlComplexType complexType,
-      CsdlProperty complexPropertyName) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-       if (!compareAnnotations(complexType.getProperty(
-           complexPropertyName.getName()).getAnnotations(), annotation)) {
-         complexType.getProperty(complexPropertyName.getName()).getAnnotations().add(annotation); 
-       }
-     }
+  private void checkAnnotationAddedToNavPropertiesOfComplexType(CsdlComplexType complexType,
+      CsdlNavigationProperty complexNavProperty, FullQualifiedName entityContainerName) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(entityContainerName.getNamespace() + 
+        DOT + complexType.getName() + SLASH + complexNavProperty.getName());
+    removeAnnotationsOnNavProperties(complexNavProperty, annotations);
+    
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(aliasName + 
+        DOT + complexType.getName() + SLASH + complexNavProperty.getName());
+    removeAnnotationsOnNavProperties(complexNavProperty, annotationsOnAlias);
+  }
+
+  private void removeAnnotationAddedToPropertiesOfComplexType(CsdlComplexType complexType,
+      CsdlProperty complexPropertyName, FullQualifiedName entityContainerName) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(entityContainerName.getNamespace() + 
+        DOT + complexType.getName() + SLASH + complexPropertyName.getName());
+    removeAnnotationsOnETProperties(complexPropertyName, annotations);
+    
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(aliasName + DOT + entityContainerName.getName() + 
+        DOT + complexType.getName() + SLASH + complexPropertyName.getName());
+    removeAnnotationsOnETProperties(complexPropertyName, annotationsOnAlias);
   }
 
   private boolean isPropertyComplex(CsdlProperty propertyName) {
@@ -562,7 +777,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
     try {
       final CsdlActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName);
       if (providerImport != null) {
-		addAnnotations(providerImport, entityContainerName);
+        addOperationImportAnnotations(providerImport, entityContainerName);
         actionImport = new EdmActionImportImpl(edm, this, providerImport);
       }
     } catch (ODataException e) {
@@ -572,31 +787,40 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
     return actionImport;
   }
 
-  private void addAnnotations(CsdlActionImport actionImport, FullQualifiedName entityContainerName) {
-    List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().
-            equalsIgnoreCase(entityContainerName + "/" + actionImport.getName())) {
-          for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-            if (!compareAnnotations(actionImport.getAnnotations(), annotation)) {
-              actionImport.getAnnotations().add(annotation);
-            }
-          }
-          break;
+  private void addOperationImportAnnotations(CsdlOperationImport operationImport, 
+      FullQualifiedName entityContainerName) {
+    List<CsdlAnnotation> annotations = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(entityContainerName + SLASH + operationImport.getName());
+    addAnnotationsOnOperationImport(operationImport, annotations);
+    
+    String aliasName = getAliasInfo(entityContainerName.getNamespace());
+    List<CsdlAnnotation> annotationsOnAlias = ((EdmProviderImpl)edm).getAnnotationsMap().
+        get(aliasName + DOT + entityContainerName.getName() + SLASH + operationImport.getName());
+    addAnnotationsOnOperationImport(operationImport, annotationsOnAlias);
+   }
+   
+  /**
+   * Adds annotations on action import
+   * @param operationImport
+   * @param annotations
+   */
+  private void addAnnotationsOnOperationImport(CsdlOperationImport operationImport, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(operationImport.getAnnotations(), annotation)) {
+          operationImport.getAnnotations().add(annotation);
         }
       }
     }
-   }
-   
+  }
+  
   protected EdmFunctionImport createFunctionImport(final String functionImportName) {
     EdmFunctionImport functionImport = null;
 
     try {
       final CsdlFunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName);
       if (providerImport != null) {
-		addAnnotations(providerImport, entityContainerName);
+        addOperationImportAnnotations(providerImport, entityContainerName);
         functionImport = new EdmFunctionImportImpl(edm, this, providerImport);
       }
     } catch (ODataException e) {
@@ -605,25 +829,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
 
     return functionImport;
   }
-
-  private void addAnnotations(CsdlFunctionImport functionImport, FullQualifiedName entityContainerName) {
-    List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions();
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().
-            equalsIgnoreCase(entityContainerName + "/" + functionImport.getName())) {
-          for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-            if (!compareAnnotations(functionImport.getAnnotations(), annotation)) {
-              functionImport.getAnnotations().add(annotation);
-            }
-          }
-          break;
-        }
-      }
-    }
-   }
-   
+  
   protected void loadAllEntitySets() {
     loadContainer();
     final List<CsdlEntitySet> providerEntitySets = container.getEntitySets();
@@ -631,7 +837,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
 
     if (providerEntitySets != null) {
       for (CsdlEntitySet entitySet : providerEntitySets) {
-		addAnnotations(entitySet, entityContainerName);
+		addEntitySetAnnotations(entitySet, entityContainerName);
         final EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
         if (isAnnotationsIncluded) {
           entitySetWithAnnotationsCache.put(impl.getName(), impl);
@@ -652,7 +858,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
 
     if (providerFunctionImports != null) {
       for (CsdlFunctionImport functionImport : providerFunctionImports) {
-		addAnnotations(functionImport, entityContainerName);
+        addOperationImportAnnotations(functionImport, entityContainerName);
         EdmFunctionImportImpl impl = new EdmFunctionImportImpl(edm, this, functionImport);
         functionImportCache.put(impl.getName(), impl);
         functionImportsLocal.add(impl);
@@ -668,7 +874,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
 
     if (providerSingletons != null) {
       for (CsdlSingleton singleton : providerSingletons) {
-		addAnnotations(singleton, entityContainerName);
+        addSingletonAnnotations(singleton, entityContainerName);
         final EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
         singletonCache.put(singleton.getName(), impl);
         singletonsLocal.add(impl);
@@ -684,7 +890,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
 
     if (providerActionImports != null) {
       for (CsdlActionImport actionImport : providerActionImports) {
-        addAnnotations(actionImport, entityContainerName);
+        addOperationImportAnnotations(actionImport, entityContainerName);
 		final EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
         actionImportCache.put(actionImport.getName(), impl);
         actionImportsLocal.add(impl);
@@ -701,7 +907,7 @@ public class EdmEntityContainerImpl extends AbstractEdmNamed implements EdmEntit
         if (containerLocal == null) {
           containerLocal = new CsdlEntityContainer().setName(getName());
         }
-		((EdmProviderImpl)edm).addAnnotations(containerLocal, entityContainerName);
+		((EdmProviderImpl)edm).addEntityContainerAnnotations(containerLocal, entityContainerName);
         container = containerLocal;
       } catch (ODataException e) {
         throw new EdmException(e);
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
index e4ad840..c8b1c71 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmProviderImpl.java
@@ -45,10 +45,12 @@ import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
 import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
 import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainer;
 import org.apache.olingo.commons.api.edm.provider.CsdlEntityContainerInfo;
+import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
 import org.apache.olingo.commons.api.edm.provider.CsdlEntityType;
 import org.apache.olingo.commons.api.edm.provider.CsdlEnumType;
 import org.apache.olingo.commons.api.edm.provider.CsdlFunction;
 import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.CsdlOperation;
 import org.apache.olingo.commons.api.edm.provider.CsdlParameter;
 import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
 import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
@@ -66,6 +68,9 @@ public class EdmProviderImpl extends AbstractEdm {
       Collections.synchronizedMap(new HashMap<FullQualifiedName, List<CsdlFunction>>());
   private List<CsdlSchema> termSchemaDefinition = new ArrayList<CsdlSchema>();
 
+  private final String SLASH = "/";
+  private final String DOT = ".";
+  
   public EdmProviderImpl(final CsdlEdmProvider provider) {
     this.provider = provider;
   }
@@ -73,6 +78,7 @@ public class EdmProviderImpl extends AbstractEdm {
   public EdmProviderImpl(final CsdlEdmProvider provider, final List<CsdlSchema> termSchemaDefinition) {
     this.provider = provider;
     this.termSchemaDefinition = termSchemaDefinition;
+    populateAnnotationMap();
   }
 
   @Override
@@ -80,7 +86,7 @@ public class EdmProviderImpl extends AbstractEdm {
     try {
       CsdlEntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
       if (entityContainerInfo != null) {
-		addAnnotations(provider.getEntityContainer(), entityContainerInfo.getContainerName());
+        addEntityContainerAnnotations(provider.getEntityContainer(), entityContainerInfo.getContainerName());
         return new EdmEntityContainerImpl(this, provider, entityContainerInfo.getContainerName(), 
             provider.getEntityContainer());
       }
@@ -90,18 +96,25 @@ public class EdmProviderImpl extends AbstractEdm {
     }
   }
 
-  public void addAnnotations(CsdlEntityContainer csdlEntityContainer, FullQualifiedName containerName) {
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().equalsIgnoreCase(containerName.getFullQualifiedNameAsString())) {
-          for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-            if (!compareAnnotations(csdlEntityContainer.getAnnotations(), annotation)) {
-              csdlEntityContainer.getAnnotations().addAll(annotationGrp.getAnnotations());
-            }
-          }
-          break;
-        }
+  public void addEntityContainerAnnotations(CsdlEntityContainer csdlEntityContainer, FullQualifiedName containerName) {
+    String aliasName = getAliasInfo(containerName.getNamespace());
+    List<CsdlAnnotation> annotations = getAnnotationsMap().get(containerName.getFullQualifiedNameAsString());
+    List<CsdlAnnotation> annotationsOnAlias = getAnnotationsMap().get(aliasName + DOT + containerName.getName());
+    addAnnotationsOnEntityContainer(csdlEntityContainer, annotations);
+    addAnnotationsOnEntityContainer(csdlEntityContainer, annotationsOnAlias);
+  }
+  
+  /**
+   * @param csdlEntityContainer
+   * @param annotations
+   */
+  private void addAnnotationsOnEntityContainer(CsdlEntityContainer csdlEntityContainer,
+      List<CsdlAnnotation> annotations) {
+    if (null != annotations) {
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(csdlEntityContainer.getAnnotations(), annotation)) {
+          csdlEntityContainer.getAnnotations().add(annotation);
+        } 
       }
     }
   }
@@ -111,7 +124,7 @@ public class EdmProviderImpl extends AbstractEdm {
     try {
       CsdlEnumType enumType = provider.getEnumType(enumName);
       if (enumType != null) {
-		addAnnotations(enumType, enumName);
+        addEnumTypeAnnotations(enumType, enumName);
         return new EdmEnumTypeImpl(this, enumName, enumType);
       }
       return null;
@@ -120,18 +133,24 @@ public class EdmProviderImpl extends AbstractEdm {
     }
   }
 
-  public void addAnnotations(CsdlEnumType enumType, FullQualifiedName enumName) {
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().equalsIgnoreCase(enumName.getFullQualifiedNameAsString())) {
-          for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-            if (!compareAnnotations(enumType.getAnnotations(), annotation)) {
-              enumType.getAnnotations().addAll(annotationGrp.getAnnotations());
-            }
-          }
-          break;
-        }
+  public void addEnumTypeAnnotations(CsdlEnumType enumType, FullQualifiedName enumName) {
+    String aliasName = getAliasInfo(enumName.getNamespace());
+    List<CsdlAnnotation> annotations = getAnnotationsMap().get(enumName.getFullQualifiedNameAsString());
+    List<CsdlAnnotation> annotationsOnAlias = getAnnotationsMap().get(aliasName + DOT + enumName.getName());
+    addAnnotationsOnEnumTypes(enumType, annotations);
+    addAnnotationsOnEnumTypes(enumType, annotationsOnAlias);
+  }
+  
+  /**
+   * @param enumType
+   * @param annotations
+   */
+  private void addAnnotationsOnEnumTypes(CsdlEnumType enumType, List<CsdlAnnotation> annotations) {
+    if (null != annotations) {
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(enumType.getAnnotations(), annotation)) {
+          enumType.getAnnotations().add(annotation);
+        } 
       }
     }
   }
@@ -141,7 +160,7 @@ public class EdmProviderImpl extends AbstractEdm {
     try {
       CsdlTypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
       if (typeDefinition != null) {
-		addAnnotations(typeDefinition, typeDefinitionName);
+        addTypeDefnAnnotations(typeDefinition, typeDefinitionName);
         return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
       }
       return null;
@@ -150,18 +169,24 @@ public class EdmProviderImpl extends AbstractEdm {
     }
   }
   
-  public void addAnnotations(CsdlTypeDefinition typeDefinition, FullQualifiedName typeDefinitionName) {
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().equalsIgnoreCase(typeDefinitionName.getFullQualifiedNameAsString())) {
-          for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-            if (!compareAnnotations(typeDefinition.getAnnotations(), annotation)) {
-              typeDefinition.getAnnotations().addAll(annotationGrp.getAnnotations());
-            }
-          }
-          break;
-        }
+  public void addTypeDefnAnnotations(CsdlTypeDefinition typeDefinition, FullQualifiedName typeDefinitionName) {
+    String aliasName = getAliasInfo(typeDefinitionName.getNamespace());
+    List<CsdlAnnotation> annotations = getAnnotationsMap().get(typeDefinitionName.getFullQualifiedNameAsString());
+    List<CsdlAnnotation> annotationsOnAlias = getAnnotationsMap().get(aliasName + DOT + typeDefinitionName.getName());
+    addAnnotationsOnTypeDefinitions(typeDefinition, annotations);
+    addAnnotationsOnTypeDefinitions(typeDefinition, annotationsOnAlias);
+  }
+  
+  /**
+   * @param typeDefinition
+   * @param annotations
+   */
+  private void addAnnotationsOnTypeDefinitions(CsdlTypeDefinition typeDefinition, List<CsdlAnnotation> annotations) {
+    if (null != annotations) {
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(typeDefinition.getAnnotations(), annotation)) {
+          typeDefinition.getAnnotations().add(annotation);
+        } 
       }
     }
   }
@@ -171,8 +196,14 @@ public class EdmProviderImpl extends AbstractEdm {
     try {
       CsdlEntityType entityType = provider.getEntityType(entityTypeName);
       if (entityType != null) {
+        List<CsdlAnnotation> annotations = getAnnotationsMap().get(entityTypeName.getFullQualifiedNameAsString());
+        String aliasName = getAliasInfo(entityTypeName.getNamespace());
+        List<CsdlAnnotation> annotationsOnAlias = getAnnotationsMap().get(aliasName + DOT + entityTypeName.getName());
+        addAnnotationsOnStructuralType(entityType, annotations);
+        addAnnotationsOnStructuralType(entityType, annotationsOnAlias);
+        
 		  if (!isEntityDerivedFromES()) {
-          addAnnotations(entityType, entityTypeName);
+          addStructuralTypeAnnotations(entityType, entityTypeName, this.provider.getEntityContainer());
         }
         return new EdmEntityTypeImpl(this, entityTypeName, entityType);
       }
@@ -183,108 +214,370 @@ public class EdmProviderImpl extends AbstractEdm {
   }
 
   /**
+   * Add annoations to entity types and complex types
+   * @param entityType
+   * @param annotations
+   */
+  private void addAnnotationsOnStructuralType(CsdlStructuralType structuralType, List<CsdlAnnotation> annotations) {
+    if (null != annotations && !annotations.isEmpty()) {
+      for (CsdlAnnotation annotation : annotations) {
+        if (!compareAnnotations(structuralType.getAnnotations(), annotation)) {
+          structuralType.getAnnotations().add(annotation);
+        }
+      }
+    }
+  }
+
+  /**
+   * Populates a map of String (annotation target) and List of CsdlAnnotations
+   * Reads both term definition schema (external schema) and 
+   * provider schema (actual metadata file)
+   */
+  private void populateAnnotationMap() {
+    for (CsdlSchema schema : termSchemaDefinition) {
+      fetchAnnotationsInMetadataAndExternalFile(schema);
+    }
+    try {
+      if (null != provider.getSchemas()) {
+        for (CsdlSchema schema : provider.getSchemas()) {
+          fetchAnnotationsInMetadataAndExternalFile(schema);
+        }
+      }
+    } catch (ODataException e) {
+        throw new EdmException(e);
+      }
+  }
+
+  /**
+   * @param schema
+   */
+  private void fetchAnnotationsInMetadataAndExternalFile(CsdlSchema schema) {
+    List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
+    for (CsdlAnnotations annotationGrp : annotationGrps) {
+      if (!getAnnotationsMap().containsKey(annotationGrp.getTarget())) {
+        getAnnotationsMap().put(annotationGrp.getTarget(), annotationGrp.getAnnotations());
+      } else {
+        List<CsdlAnnotation> annotations = getAnnotationsMap().get(annotationGrp.getTarget());
+        List<CsdlAnnotation> newAnnotations = new ArrayList<CsdlAnnotation>();
+        for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
+          if (!compareAnnotations(annotations, annotation)) {
+            newAnnotations.add(annotation);
+          }
+        }
+        if (!newAnnotations.isEmpty()) {
+          getAnnotationsMap().get(annotationGrp.getTarget()).addAll(newAnnotations);
+        }
+      }
+    }
+  }
+  
+  /**
    * Add the annotations defined in an external file to the property/
    * navigation property and the entity
    * @param structuralType
    * @param typeName
+   * @param csdlEntityContainer 
    */
-  public void addAnnotations(CsdlStructuralType structuralType, FullQualifiedName typeName) {
-    boolean isPropAnnotationsCleared = false;
-    boolean isNavPropAnnotationsCleared = false;
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().equalsIgnoreCase(typeName.getFullQualifiedNameAsString())) {
-          addAnnotationsToStructuralTypes(structuralType, annotationGrp);
-        } else {
-          checkAnnotationsOnStructuralProperties(structuralType, typeName, isPropAnnotationsCleared, annotationGrp);
-          checkAnnotationsOnStructuralNavProperties(structuralType, typeName, isNavPropAnnotationsCleared,
-              annotationGrp);
-          isPropAnnotationsCleared = true;
-          isNavPropAnnotationsCleared = true;
+  public void addStructuralTypeAnnotations(CsdlStructuralType structuralType, FullQualifiedName typeName, 
+      CsdlEntityContainer csdlEntityContainer) {
+    updateAnnotationsOnStructuralProperties(structuralType, typeName, csdlEntityContainer);
+    updateAnnotationsOnStructuralNavProperties(structuralType, typeName, csdlEntityContainer);
+  }
+  
+  /**
+   * Get alias name given the namespace from the alias info 
+   * @param namespace
+   * @return
+   */
+  private String getAliasInfo(String namespace) {
+    try {
+      if (null != provider.getAliasInfos()) {
+        for (CsdlAliasInfo aliasInfo : provider.getAliasInfos()) {
+          if (aliasInfo.getNamespace().equalsIgnoreCase(namespace)) {
+            return aliasInfo.getAlias();
+          }
         }
       }
+    } catch (ODataException e) {
+      throw new EdmException(e);
     }
+    return null;
   }
-
   /** Check if annotations are added on navigation properties of a structural type
    * @param structuralType
    * @param typeName
+   * @param csdlEntityContainer 
    * @param isNavPropAnnotationsCleared
    * @param annotationGrp
    */
-  private void checkAnnotationsOnStructuralNavProperties(CsdlStructuralType structuralType, FullQualifiedName typeName,
-      boolean isNavPropAnnotationsCleared, CsdlAnnotations annotationGrp) {
+  private void updateAnnotationsOnStructuralNavProperties(CsdlStructuralType structuralType, 
+      FullQualifiedName typeName, CsdlEntityContainer csdlEntityContainer) {
     List<CsdlNavigationProperty> navProperties = structuralType.getNavigationProperties();
-    for (CsdlNavigationProperty navProperty : navProperties) {
-      if (!isNavPropAnnotationsCleared) {
-        structuralType.getNavigationProperty(navProperty.getName()).getAnnotations().clear();
+    String containerName = null;
+    String schemaName = null;
+    String entitySetName = null;
+    List<CsdlEntitySet> entitySets = csdlEntityContainer != null ? 
+        csdlEntityContainer.getEntitySets() : new ArrayList<CsdlEntitySet>();
+    if (structuralType instanceof CsdlComplexType) {
+      removeAnnotationsAddedToCTNavPropFromES(structuralType, typeName, csdlEntityContainer, navProperties, entitySets);
+    } else {
+      for (CsdlEntitySet entitySet : entitySets) {
+        entitySetName = entitySet.getName();
+        String entityTypeName = entitySet.getTypeFQN().getFullQualifiedNameAsString();
+        if (null != entityTypeName && entityTypeName.equalsIgnoreCase(typeName.getFullQualifiedNameAsString())) {
+          containerName = csdlEntityContainer.getName();
+          schemaName = typeName.getNamespace();
+          break;
+        }
+      }
+      for (CsdlNavigationProperty navProperty : navProperties) {
+        List<CsdlAnnotation> annotPropDerivedFromES = getAnnotationsMap().get(schemaName + DOT + 
+            containerName + SLASH +  entitySetName + SLASH + navProperty.getName());
+        removeAnnotationsOnNavPropDerivedFromEntitySet(structuralType, navProperty, annotPropDerivedFromES);
+        String aliasName = getAliasInfo(schemaName);
+        List<CsdlAnnotation> annotPropDerivedFromESOnAlias = getAnnotationsMap().get(aliasName + DOT + 
+            containerName + SLASH +  entitySetName + SLASH + navProperty.getName());
+        removeAnnotationsOnNavPropDerivedFromEntitySet(structuralType, navProperty, annotPropDerivedFromESOnAlias);
+        
+        List<CsdlAnnotation> navPropAnnotations = getAnnotationsMap().get(
+            typeName + SLASH + navProperty.getName());
+        addAnnotationsOnNavProperties(structuralType, navProperty, navPropAnnotations);
+        aliasName = getAliasInfo(typeName.getNamespace());
+        List<CsdlAnnotation> navPropAnnotationsOnAlias = getAnnotationsMap().get(
+            aliasName + DOT + typeName.getName() + SLASH + navProperty.getName());
+        addAnnotationsOnNavProperties(structuralType, navProperty, navPropAnnotationsOnAlias);
+      }
+    }
+  }
+
+  /**
+   * Adds annotations to navigation properties of entity and complex types
+   * @param structuralType
+   * @param navProperty
+   * @param navPropAnnotations
+   */
+  private void addAnnotationsOnNavProperties(CsdlStructuralType structuralType, CsdlNavigationProperty navProperty,
+      List<CsdlAnnotation> navPropAnnotations) {
+    if (null != navPropAnnotations && !navPropAnnotations.isEmpty()) {
+      for (CsdlAnnotation annotation : navPropAnnotations) {
+        if (!compareAnnotations(structuralType.getNavigationProperty(
+            navProperty.getName()).getAnnotations(), annotation)) {
+          structuralType.getNavigationProperty(navProperty.getName()).getAnnotations().
+          add(annotation);
+        }
       }
-      if (annotationGrp.getTarget().equalsIgnoreCase(typeName + "/" + navProperty.getName())) {
-        addAnnotationsToStructuralTypeNavProperties(structuralType, annotationGrp, navProperty);
+    }
+  }
+
+  /**
+   * Removes the annotations added to properties of structural types
+   * if annotation was added before via EntitySet path
+   * @param structuralType
+   * @param navProperty
+   * @param annotPropDerivedFromES
+   */
+  private void removeAnnotationsOnNavPropDerivedFromEntitySet(CsdlStructuralType structuralType,
+      CsdlNavigationProperty navProperty, List<CsdlAnnotation> annotPropDerivedFromES) {
+    if (null != annotPropDerivedFromES && !annotPropDerivedFromES.isEmpty()) {
+      for (CsdlAnnotation annotation : annotPropDerivedFromES) {
+        List<CsdlAnnotation> propAnnot = structuralType.getNavigationProperty(
+            navProperty.getName()).getAnnotations();
+        if (propAnnot.contains(annotation)) {
+          propAnnot.remove(annotation);
+        }
       }
     }
   }
 
+  /**
+   * Remove the annotations added to navigation properties 
+   * of a complex type loaded via entity set path
+   * @param structuralType
+   * @param typeName
+   * @param csdlEntityContainer
+   * @param navProperties
+   * @param entitySets
+   */
+  private void removeAnnotationsAddedToCTNavPropFromES(CsdlStructuralType structuralType, FullQualifiedName typeName,
+      CsdlEntityContainer csdlEntityContainer, List<CsdlNavigationProperty> navProperties,
+      List<CsdlEntitySet> entitySets) {
+    String containerName;
+    String schemaName;
+    String complexPropName;
+    for (CsdlEntitySet entitySet : entitySets) {
+      try {
+        CsdlEntityType entType = provider.getEntityType(entitySet.getTypeFQN());
+        List<CsdlProperty> entTypeProperties = null != entType ? 
+            entType.getProperties() : new ArrayList<CsdlProperty>();
+        for (CsdlProperty entTypeProperty : entTypeProperties) {
+          if (null != entTypeProperty.getType() && 
+              entTypeProperty.getType().equalsIgnoreCase(typeName.getFullQualifiedNameAsString())) {
+            complexPropName = entTypeProperty.getName();
+            containerName = csdlEntityContainer.getName();
+            schemaName = typeName.getNamespace();
+            for (CsdlNavigationProperty navProperty : navProperties) { 
+              List<CsdlAnnotation> annotPropDerivedFromES = getAnnotationsMap().get(schemaName + DOT + 
+                  containerName + SLASH +  entitySet.getName() + SLASH + 
+                  complexPropName + SLASH + navProperty.getName());
+              removeAnnotationsOnNavPropDerivedFromEntitySet(structuralType, navProperty, annotPropDerivedFromES);
+              String aliasName = getAliasInfo(schemaName);
+              List<CsdlAnnotation> annotPropDerivedFromESOnAlias = getAnnotationsMap().get(aliasName + DOT + 
+                  containerName + SLASH +  entitySet.getName() + SLASH + 
+                  complexPropName + SLASH + navProperty.getName());
+              removeAnnotationsOnNavPropDerivedFromEntitySet(structuralType, 
+                  navProperty, annotPropDerivedFromESOnAlias);
+              
+              List<CsdlAnnotation> propAnnotations = getAnnotationsMap().
+                  get(typeName.getFullQualifiedNameAsString() + SLASH + navProperty.getName());
+              addAnnotationsOnNavProperties(structuralType, navProperty, propAnnotations);
+              aliasName = getAliasInfo(typeName.getNamespace());
+              List<CsdlAnnotation> propAnnotationsOnAlias = getAnnotationsMap().
+                  get(aliasName + DOT + typeName.getName() + SLASH + navProperty.getName());
+              addAnnotationsOnNavProperties(structuralType, navProperty, propAnnotationsOnAlias);
+            }
+          }
+        }
+      } catch (ODataException e) {
+        throw new EdmException(e);
+      }
+    }
+    for (CsdlNavigationProperty navProperty : structuralType.getNavigationProperties()) {
+      List<CsdlAnnotation> propAnnotations = getAnnotationsMap().
+          get(typeName.getFullQualifiedNameAsString() + SLASH + navProperty.getName());
+      addAnnotationsOnNavProperties(structuralType, navProperty, propAnnotations);
+      String aliasName = getAliasInfo(typeName.getNamespace());
+      List<CsdlAnnotation> propAnnotationsOnAlias = getAnnotationsMap().
+          get(aliasName + DOT + typeName.getName() + SLASH + navProperty.getName());
+      addAnnotationsOnNavProperties(structuralType, navProperty, propAnnotationsOnAlias);
+    }
+  }
+
   /** Check if annotations are added on properties of a structural type
    * @param structuralType
    * @param typeName
-   * @param isPropAnnotationsCleared
-   * @param annotationGrp
+   * @param csdlEntityContainer
    */
-  private void checkAnnotationsOnStructuralProperties(CsdlStructuralType structuralType, FullQualifiedName typeName,
-      boolean isPropAnnotationsCleared, CsdlAnnotations annotationGrp) {
+  private void updateAnnotationsOnStructuralProperties(CsdlStructuralType structuralType, FullQualifiedName typeName,
+      CsdlEntityContainer csdlEntityContainer) {
     List<CsdlProperty> properties = structuralType.getProperties();
-    for (CsdlProperty property : properties) {
-      if (!isPropAnnotationsCleared) {
-        structuralType.getProperty(property.getName()).getAnnotations().clear();
+    String containerName = null;
+    String schemaName = null;
+    String entitySetName = null;
+    List<CsdlEntitySet> entitySets = null != csdlEntityContainer ? 
+        csdlEntityContainer.getEntitySets() : new ArrayList<CsdlEntitySet>();
+    if (structuralType instanceof CsdlComplexType) {
+      removeAnnotationsAddedToCTTypePropFromES(structuralType, typeName, csdlEntityContainer, properties, entitySets);
+    } else {
+      for (CsdlEntitySet entitySet : entitySets) {
+        entitySetName = entitySet.getName();
+        String entityTypeName = entitySet.getTypeFQN().getFullQualifiedNameAsString();
+        if (null != entityTypeName && entityTypeName.equalsIgnoreCase(typeName.getFullQualifiedNameAsString())) {
+          containerName = csdlEntityContainer.getName();
+          schemaName = typeName.getNamespace();
+          break;
+        }
       }
-      if (annotationGrp.getTarget().equalsIgnoreCase(
-          typeName.getFullQualifiedNameAsString() + "/" + property.getName())) {
-        addAnnotationsToStructuralTypeProperties(structuralType, annotationGrp, property);
+      for (CsdlProperty property : properties) {
+        List<CsdlAnnotation> annotPropDerivedFromES = getAnnotationsMap().get(schemaName + DOT + 
+            containerName + SLASH +  entitySetName + SLASH + property.getName());
+        removeAnnotationsOnPropDerivedFromEntitySet(structuralType, property, annotPropDerivedFromES);
+        String aliasName = getAliasInfo(schemaName);
+        List<CsdlAnnotation> annotPropDerivedFromESOnAlias = getAnnotationsMap().get(aliasName + DOT + 
+            containerName + SLASH +  entitySetName + SLASH + property.getName());
+        removeAnnotationsOnPropDerivedFromEntitySet(structuralType, property, annotPropDerivedFromESOnAlias);
+        List<CsdlAnnotation> propAnnotations = getAnnotationsMap().
+            get(typeName.getFullQualifiedNameAsString() + SLASH + property.getName());
+        addAnnotationsOnPropertiesOfStructuralType(structuralType, property, propAnnotations);
+        aliasName = getAliasInfo(typeName.getNamespace());
+        List<CsdlAnnotation> propAnnotationsOnAlias = getAnnotationsMap().
+            get(aliasName + DOT + typeName.getName() + SLASH + property.getName());
+        addAnnotationsOnPropertiesOfStructuralType(structuralType, property, propAnnotationsOnAlias);
       }
     }
   }
 
   /**
+   * Adds annotations to properties of entity type and complex type
    * @param structuralType
-   * @param annotationGrp
-   * @param navProperty
+   * @param property
+   * @param propAnnotations
    */
-  private void addAnnotationsToStructuralTypeNavProperties(CsdlStructuralType structuralType,
-      CsdlAnnotations annotationGrp, CsdlNavigationProperty navProperty) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-      if (!compareAnnotations(structuralType.getNavigationProperty(
-          navProperty.getName()).getAnnotations(), annotation)) {
-        structuralType.getNavigationProperty(navProperty.getName()).getAnnotations().
-        add(annotation);
+  private void addAnnotationsOnPropertiesOfStructuralType(CsdlStructuralType structuralType, CsdlProperty property,
+      List<CsdlAnnotation> propAnnotations) {
+    if (null != propAnnotations && !propAnnotations.isEmpty()) {
+      for (CsdlAnnotation annotation : propAnnotations) {
+        if (!compareAnnotations(structuralType.getProperty(
+            property.getName()).getAnnotations(), annotation)) {
+          structuralType.getProperty(property.getName()).getAnnotations().add(annotation); 
+        }
       }
     }
   }
-
+  
   /**
+   * Removes the annotations added to properties of entity type when added via entity set
    * @param structuralType
-   * @param annotationGrp
    * @param property
+   * @param annotPropDerivedFromESOnAlias
    */
-  private void addAnnotationsToStructuralTypeProperties(CsdlStructuralType structuralType,
-      CsdlAnnotations annotationGrp, CsdlProperty property) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-      if (!compareAnnotations(structuralType.getProperty(
-          property.getName()).getAnnotations(), annotation)) {
-        structuralType.getProperty(property.getName()).getAnnotations().add(annotation); 
+  private void removeAnnotationsOnPropDerivedFromEntitySet(CsdlStructuralType structuralType, CsdlProperty property,
+      List<CsdlAnnotation> annotPropDerivedFromES) {
+    if (null != annotPropDerivedFromES && !annotPropDerivedFromES.isEmpty()) {
+      for (CsdlAnnotation annotation : annotPropDerivedFromES) {
+        List<CsdlAnnotation> propAnnot = structuralType.getProperty(
+            property.getName()).getAnnotations();
+        if (propAnnot.contains(annotation)) {
+          propAnnot.remove(annotation);
+        }
       }
     }
   }
 
   /**
+   * Removes the annotation added on complex type property via Entity Set
    * @param structuralType
-   * @param annotationGrp
+   * @param typeName
+   * @param csdlEntityContainer
+   * @param properties
+   * @param entitySets
    */
-  private void addAnnotationsToStructuralTypes(CsdlStructuralType structuralType, CsdlAnnotations annotationGrp) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-      if (!compareAnnotations(structuralType.getAnnotations(), annotation)) {
-        structuralType.getAnnotations().addAll(annotationGrp.getAnnotations());
+  private void removeAnnotationsAddedToCTTypePropFromES(CsdlStructuralType structuralType, FullQualifiedName typeName,
+      CsdlEntityContainer csdlEntityContainer, List<CsdlProperty> properties, List<CsdlEntitySet> entitySets) {
+    String containerName;
+    String schemaName;
+    String complexPropName;
+    for (CsdlEntitySet entitySet : entitySets) {
+      try {
+        CsdlEntityType entType = provider.getEntityType(entitySet.getTypeFQN());
+        List<CsdlProperty> entTypeProperties = null != entType ? 
+            entType.getProperties() : new ArrayList<CsdlProperty>();
+        for (CsdlProperty entTypeProperty : entTypeProperties) {
+          if (null != entTypeProperty.getType() && 
+              entTypeProperty.getType().endsWith(DOT + structuralType.getName())) {
+            complexPropName = entTypeProperty.getName();
+            containerName = csdlEntityContainer.getName();
+            schemaName = typeName.getNamespace();
+            for (CsdlProperty property : properties) { 
+              List<CsdlAnnotation> annotPropDerivedFromES = getAnnotationsMap().get(schemaName + DOT + 
+                  containerName + SLASH +  entitySet.getName() + SLASH + complexPropName + SLASH + property.getName());
+              removeAnnotationsOnPropDerivedFromEntitySet(structuralType, property, annotPropDerivedFromES);
+              String aliasName = getAliasInfo(schemaName);
+              List<CsdlAnnotation> annotPropDerivedFromESOnAlias = getAnnotationsMap().get(aliasName + DOT + 
+                  containerName + SLASH +  entitySet.getName() + SLASH + complexPropName + SLASH + property.getName());
+              removeAnnotationsOnPropDerivedFromEntitySet(structuralType, property, annotPropDerivedFromESOnAlias);
+              
+              List<CsdlAnnotation> propAnnotations = getAnnotationsMap().
+                  get(typeName.getFullQualifiedNameAsString() + SLASH + property.getName());
+              addAnnotationsOnPropertiesOfStructuralType(structuralType, property, propAnnotations);
+              aliasName = getAliasInfo(typeName.getNamespace());
+              List<CsdlAnnotation> propAnnotationsOnAlias = getAnnotationsMap().
+                  get(typeName.getName() + SLASH + property.getName());
+              addAnnotationsOnPropertiesOfStructuralType(structuralType, property, propAnnotationsOnAlias);
+            }
+          }
+        }
+      } catch (ODataException e) {
+        throw new EdmException(e);
       }
     }
   }
@@ -294,8 +587,18 @@ public class EdmProviderImpl extends AbstractEdm {
     try {
       final CsdlComplexType complexType = provider.getComplexType(complexTypeName);
       if (complexType != null) {
+        List<CsdlAnnotation> annotations = getAnnotationsMap().get(complexTypeName.getFullQualifiedNameAsString());
+        if (null != annotations && !annotations.isEmpty()) {
+          addAnnotationsOnStructuralType(complexType, annotations);
+        }
+        String aliasName = getAliasInfo(complexTypeName.getNamespace());
+        List<CsdlAnnotation> annotationsOnAlias = getAnnotationsMap().get(aliasName + DOT + complexTypeName.getName());
+        if (null != annotationsOnAlias && !annotationsOnAlias.isEmpty()) {
+          addAnnotationsOnStructuralType(complexType, annotationsOnAlias);
+        }
+        
 		  if (!isComplexDerivedFromES()) {
-          addAnnotations(complexType, complexTypeName);
+          addStructuralTypeAnnotations(complexType, complexTypeName, provider.getEntityContainer());
         }
         return new EdmComplexTypeImpl(this, complexTypeName, complexType);
       }
@@ -329,7 +632,7 @@ public class EdmProviderImpl extends AbstractEdm {
               isComplexPreviousTypeCompatibleToBindingParam(bindingParameterTypeName, parameter, 
                   isBindingParameterCollection))
               && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
-			addAnnotations(action, actionName);
+            addOperationsAnnotations(action, actionName);
             return new EdmActionImpl(this, actionName, action);
           }
 
@@ -341,48 +644,57 @@ public class EdmProviderImpl extends AbstractEdm {
     }
   }
 
-  public void addAnnotations(CsdlAction action, FullQualifiedName actionName) {
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().equalsIgnoreCase(
-            actionName.getFullQualifiedNameAsString())) {
-          addAnnotationsToActions(action, annotationGrp);
-        } else {
-          addAnnotationsToParamsOfActions(action, actionName, annotationGrp);
-        }
-      }
+  public void addOperationsAnnotations(CsdlOperation operation, FullQualifiedName actionName) {
+    String aliasName = getAliasInfo(actionName.getNamespace());
+    List<CsdlAnnotation> annotations = getAnnotationsMap().get(actionName.getFullQualifiedNameAsString());
+    List<CsdlAnnotation> annotationsOnAlias = getAnnotationsMap().get(aliasName + DOT + actionName.getName());
+    if (null != annotations) {
+      addAnnotationsToOperations(operation, annotations);
+    }
+    if (null != annotationsOnAlias) {
+      addAnnotationsToOperations(operation, annotationsOnAlias);
     }
+    addAnnotationsToParamsOfOperations(operation, actionName);
   }
   
-  /** Adds annotations to actions
-   * @param action
+  /** Adds annotations to action parameters
+   * @param operation
    * @param actionName
-   * @param annotationGrp
+   * @param annotations
    */
-  private void addAnnotationsToParamsOfActions(CsdlAction action, FullQualifiedName actionName,
-      CsdlAnnotations annotationGrp) {
-    final List<CsdlParameter> parameters = action.getParameters();
+  private void addAnnotationsToParamsOfOperations(CsdlOperation operation, FullQualifiedName actionName) {
+    final List<CsdlParameter> parameters = operation.getParameters();
     for (CsdlParameter parameter : parameters) {
-      if (annotationGrp.getTarget().equalsIgnoreCase(
-          actionName.getFullQualifiedNameAsString() + "/" + parameter.getName())) {
-        for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-          if (!compareAnnotations(action.getParameter(parameter.getName()).getAnnotations(), annotation)) {
-            action.getParameter(parameter.getName()).getAnnotations().add(annotation);
+      List<CsdlAnnotation> annotsToParams = getAnnotationsMap().get(
+          actionName.getFullQualifiedNameAsString() + SLASH + parameter.getName());
+      if (null != annotsToParams && !annotsToParams.isEmpty()) {
+        for (CsdlAnnotation annotation : annotsToParams) {
+          if (!compareAnnotations(operation.getParameter(parameter.getName()).getAnnotations(), annotation)) {
+            operation.getParameter(parameter.getName()).getAnnotations().add(annotation);
+          }
+        }
+      }
+      String aliasName = getAliasInfo(actionName.getNamespace());
+      List<CsdlAnnotation> annotsToParamsOnAlias = getAnnotationsMap().get(
+          aliasName + DOT + actionName.getName() + SLASH + parameter.getName());
+      if (null != annotsToParamsOnAlias && !annotsToParamsOnAlias.isEmpty()) {
+        for (CsdlAnnotation annotation : annotsToParamsOnAlias) {
+          if (!compareAnnotations(operation.getParameter(parameter.getName()).getAnnotations(), annotation)) {
+            operation.getParameter(parameter.getName()).getAnnotations().add(annotation);
           }
         }
       }
     }
   }
 
-  /** Adds annotations to parameters of action
-   * @param action
-   * @param annotationGrp
+  /** Adds annotations to action
+   * @param operation
+   * @param annotationsOnAlias
    */
-  private void addAnnotationsToActions(CsdlAction action, CsdlAnnotations annotationGrp) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-      if (!compareAnnotations(action.getAnnotations(), annotation)) {
-        action.getAnnotations().add(annotation);
+  private void addAnnotationsToOperations(CsdlOperation operation, List<CsdlAnnotation> annotations) {
+    for (CsdlAnnotation annotation : annotations) {
+      if (!compareAnnotations(operation.getAnnotations(), annotation)) {
+        operation.getAnnotations().add(annotation);
       }
     }
   }
@@ -464,7 +776,7 @@ public class EdmProviderImpl extends AbstractEdm {
               providerParameterNames.add(providerParameters.get(i).getName());
             }
             if (parameterNamesCopy.containsAll(providerParameterNames)) {
-			  addAnnotations(function, functionName);
+              addOperationsAnnotations(function, functionName);
               return new EdmFunctionImpl(this, functionName, function);
             }
           }
@@ -476,51 +788,6 @@ public class EdmProviderImpl extends AbstractEdm {
     }
   }
 
-  public void addAnnotations(CsdlFunction function, FullQualifiedName functionName) {
-    for (CsdlSchema schema : termSchemaDefinition) {
-      List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups();
-      for (CsdlAnnotations annotationGrp : annotationGrps) {
-        if (annotationGrp.getTarget().equalsIgnoreCase(
-            functionName.getFullQualifiedNameAsString())) {
-          addAnnotationsToFunctions(function, annotationGrp);
-        } else {
-          addAnnotationsToParamsOFunctions(function, functionName, annotationGrp);
-        }
-      }
-    }
-  }
-
-  /** Adds annotations of function parameters
-   * @param function
-   * @param functionName
-   * @param annotationGrp
-   */
-  private void addAnnotationsToParamsOFunctions(CsdlFunction function, FullQualifiedName functionName,
-      CsdlAnnotations annotationGrp) {
-    final List<CsdlParameter> parameters = function.getParameters();
-    for (CsdlParameter parameter : parameters) {
-      if (annotationGrp.getTarget().equalsIgnoreCase(
-          functionName.getFullQualifiedNameAsString() + "/" + parameter.getName())) {
-        for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-          if (!compareAnnotations(function.getParameter(parameter.getName()).getAnnotations(), annotation)) {
-            function.getParameter(parameter.getName()).getAnnotations().add(annotation);
-          }
-        }
-      }
-    }
-  }
-
-  /**Add annotations to functions
-   * @param function
-   * @param annotationGrp
-   */
-  private void addAnnotationsToFunctions(CsdlFunction function, CsdlAnnotations annotationGrp) {
-    for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) {
-      if (!compareAnnotations(function.getAnnotations(), annotation)) {
-        function.getAnnotations().add(annotation);
-      }
-    }
-  }
   
   @Override
   protected Map<String, String> createAliasToNamespaceInfo() {
@@ -553,6 +820,7 @@ public class EdmProviderImpl extends AbstractEdm {
       // Search for first unbound action
       for (CsdlAction action : actions) {
         if (!action.isBound()) {
+          addOperationsAnnotations(action, actionName);
           return new EdmActionImpl(this, actionName, action);
         }
       }
@@ -577,6 +845,7 @@ public class EdmProviderImpl extends AbstractEdm {
       if (functions != null) {
         for (CsdlFunction function : functions) {
           if (!function.isBound()) {
+            addOperationsAnnotations(function, functionName);
             result.add(new EdmFunctionImpl(this, functionName, function));
           }
         }
@@ -616,6 +885,8 @@ public class EdmProviderImpl extends AbstractEdm {
             }
 
             if (parameterNamesCopy.containsAll(functionParameterNames)) {
+              addOperationsAnnotations(function, functionName);
+              addAnnotationsToParamsOfOperations(function, functionName);
               return new EdmFunctionImpl(this, functionName, function);
             }
           }
@@ -677,6 +948,12 @@ public class EdmProviderImpl extends AbstractEdm {
   protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName, String qualifier) {
     try {
       CsdlAnnotations providerGroup = provider.getAnnotationsGroup(targetName, qualifier);
+      if (null == providerGroup) {
+        for(CsdlSchema schema : termSchemaDefinition) {
+          providerGroup = schema.getAnnotationGroup(targetName.getFullQualifiedNameAsString(), qualifier);
+          break;
+        }
+      }
       if (providerGroup != null) {
         return new EdmAnnotationsImpl(this, providerGroup);
       }
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java
index a88faee..20489a5 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmSchemaImpl.java
@@ -152,6 +152,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
   protected EdmEntityContainer createEntityContainer() {
     if (schema.getEntityContainer() != null) {
       FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName());
+      edm.addEntityContainerAnnotations(schema.getEntityContainer(), containerFQN);
       EdmEntityContainer impl = new EdmEntityContainerImpl(edm, provider, containerFQN, schema.getEntityContainer());
       edm.cacheEntityContainer(containerFQN, impl);
       edm.cacheEntityContainer(null, impl);
@@ -166,6 +167,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
     if (providerTypeDefinitions != null) {
       for (CsdlTypeDefinition def : providerTypeDefinitions) {
         FullQualifiedName typeDefName = new FullQualifiedName(namespace, def.getName());
+        edm.addTypeDefnAnnotations(def, typeDefName);
         EdmTypeDefinitionImpl typeDefImpl = new EdmTypeDefinitionImpl(edm, typeDefName, def);
         typeDefns.add(typeDefImpl);
         edm.cacheTypeDefinition(typeDefName, typeDefImpl);
@@ -180,6 +182,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
     if (providerEnumTypes != null) {
       for (CsdlEnumType enumType : providerEnumTypes) {
         FullQualifiedName enumName = new FullQualifiedName(namespace, enumType.getName());
+        edm.addEnumTypeAnnotations(enumType, enumName);
         EdmEnumType enumTypeImpl = new EdmEnumTypeImpl(edm, enumName, enumType);
         enumTyps.add(enumTypeImpl);
         edm.cacheEnumType(enumName, enumTypeImpl);
@@ -194,6 +197,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
     if (providerEntityTypes != null) {
       for (CsdlEntityType entityType : providerEntityTypes) {
         FullQualifiedName entityTypeName = new FullQualifiedName(namespace, entityType.getName());
+        edm.addStructuralTypeAnnotations(entityType, entityTypeName, schema.getEntityContainer());
         EdmEntityTypeImpl entityTypeImpl = new EdmEntityTypeImpl(edm, entityTypeName, entityType);
         edmEntityTypes.add(entityTypeImpl);
         edm.cacheEntityType(entityTypeName, entityTypeImpl);
@@ -208,6 +212,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
     if (providerComplexTypes != null) {
       for (CsdlComplexType complexType : providerComplexTypes) {
         FullQualifiedName comlexTypeName = new FullQualifiedName(namespace, complexType.getName());
+        edm.addStructuralTypeAnnotations(complexType, comlexTypeName, schema.getEntityContainer());
         EdmComplexTypeImpl complexTypeImpl = new EdmComplexTypeImpl(edm, comlexTypeName, complexType);
         edmComplexTypes.add(complexTypeImpl);
         edm.cacheComplexType(comlexTypeName, complexTypeImpl);
@@ -222,6 +227,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
     if (providerActions != null) {
       for (CsdlAction action : providerActions) {
         FullQualifiedName actionName = new FullQualifiedName(namespace, action.getName());
+        edm.addOperationsAnnotations(action, actionName);
         EdmActionImpl edmActionImpl = new EdmActionImpl(edm, actionName, action);
         edmActions.add(edmActionImpl);
         edm.cacheAction(actionName, edmActionImpl);
@@ -236,6 +242,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
     if (providerFunctions != null) {
       for (CsdlFunction function : providerFunctions) {
         FullQualifiedName functionName = new FullQualifiedName(namespace, function.getName());
+        edm.addOperationsAnnotations(function, functionName);
         EdmFunctionImpl functionImpl = new EdmFunctionImpl(edm, functionName, function);
         edmFunctions.add(functionImpl);
         edm.cacheFunction(functionName, functionImpl);