Show TOC

 Structure and Elements of an Annotation File

 

An annotation file is a semantic description of an OData service. It delivers semantic information to properties and entity types delivered by the OData service, which can be used for a generic rendering for a fact sheet. The description is defined by a sequentiality of annotations that are tags following a special syntax. Annotation tags use terms that are defined in vocabularies, either OData core or delivered by SAP.

Example Example

<Annotation Term="UI.LineItem">

The term UI.LineItem is defined in the vocabulary as <Term Name="LineItem" Type="Collection(UI.DataFieldAbstract)" AppliesTo="EntityType">

End of the example.

An annotation file consists of:

  • A setup area that references the vocabularies, the XML name spaces, and one or several OData services, which provide data to the annotation file.

    A vocabulary is a set of semantic and structuring term definitions. Vocabularies are delivered by SAP.

    Syntax Syntax

    1. <edmx:Reference Uri="/sap/bc/ui5_ui5/ui2/ushell/resources/sap/ushell/components/factsheet/vocabularies/Communication.xml">
      <edmx:Include Namespace="com.sap.vocabularies.Communication.v1" Alias="vCard"/>
      </edmx:Reference>
    End of the code.
  • An annotation area that provides a semantic description of the OData service referencing the entity types and properties of the corresponding OData service.

    An annotation file always refers one or several targets. Each annotation has a target, which refers an entity type or a property of the OData service used.

    Syntax Syntax

    1. <Annotations Target="EPMModel.Product">
    2.  <Annotation Term="UI.HeaderInfo">
    3.    <Record>
    4.       <PropertyValue Property="TypeName" String="Product" />
    5.       <PropertyValue Property="TypeNamePlural" String="Products" />
    6.       <PropertyValue Property="TypeImageUrl" String="/sap/bc/ui5_ui5/ui2/ushell/resources/sap/ushell/components/factsheet/vocabularies/Communication.xml" />
    7.       <PropertyValue Property="ImageUrl" Path="ImageUrl" />
    8.       <PropertyValue Property="Title">
    9.         <Record>
    10.           <PropertyValue Property="Label" String="Product" />
    11.           <PropertyValue Property="Value" Path="Name" />
    12.         </Record>
    13.       </PropertyValue>
    14.       <PropertyValue Property="Description">
    15.         <Record>
    16.           <PropertyValue Property="Label" String="Description" />
    17.           <PropertyValue Property="Value" Path="Description" />
    18.         </Record>
    19.      </PropertyValue>
    20.    </Record>
    21.  </Annotation>
    End of the code.

Each annotation refers to a term of a vocabulary. The features of annotations are:

  • Mapping properties of an OData service to the terms of a vocabulary, that is, the entity types and properties of the corresponding OData service are referenced in the properties of annotation terms.

  • Defining semantic terms, such as header, identification, or line item.

  • Defining areas on the UI, such as facets.

    With a facet, you define a structure in your annotation file, where you can refer annotations defined before, such as header, identification, or line item.