SOA Governance and API Management : Working with CentraSite Business UI : OData Service Management : The Entity Data Model (EDM)
The Entity Data Model (EDM)
 
Metadata for OData Services
This section provides a high-level description of the EDM, which is the underlying abstract data model used by OData services.
An OData Service Metadata Document describes its data in EDM terms using an XML language. The remainder of this section provides a brief description of the Entity Data Model and defines how EDM constructs are mapped to the resources of the CentraSite OData model.
The following table lists the OData EDM components that are mapped to an OData service in CentraSite:
OData (EDM) Components
Description
Service
The simple OData Service which implements the Open Data Protocol (OData).
Schema
The Schema(s) exposed by the OData service. The schema in XML language describes the service’s data in EDM terms. For example:
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm”>
Namespace
The Namespace used by OData services when representing data in XML-based formats. The URI identifying the namespace is <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="services.odata.org.TripPin">
Version
The Version of the OData protocol required to consume the service. The supported OData protocol versions are 2.0 and 4.0. For example,
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
EnumType
Enumeration Types (for example, PersonGender) represent a series of related values. Enumeration types expose the related values as members of the enumeration.
The following example shows a simple enum for our sample TripPinService:
<EnumType Name="PersonGender">
<Member Name="Male" Value="0"/>
<Member Name="Female" Value="1"/>
<Member Name="Unknown" Value="2"/>
</EnumType>
ComplexType
Complex Types are structured types (for example, City, Location, Airport Location and so on) consisting of a list of properties (for example, CountryRegion, Name, Address, and so on) but with no key, and thus can only exist as a property of a containing entity or as a temporary value.
The following example shows a simple complex type for our sample TripPinService:
<ComplexType Name="City">
<Property Name="CountryRegion" Type="Edm.String"
Nullable="false"/>
<Property Name="Name" Type="Edm.String"
Nullable="false"/>
<Property Name="Region" Type="Edm.String"
Nullable="false"/>
</ComplexType>
EntityType
Entity Types (for example, Person, Airline and so on) are structured records consisting of named and typed properties and key properties whose values (for example, UserName, AirlineCode and so on) uniquely identify one instance from another.
The following example shows a simple entity type for our sample TripPinService:
<EntityType Name="Person" OpenType="true">
<Key>
<PropertyRef Name="UserName"/>
</Key>
<Property Name="UserName" Type="Edm.String"
Nullable="false"/>
<Property Name="FirstName" Type="Edm.String"
Nullable="false"/>
<Property Name="LastName" Type="Edm.String"
Nullable="false"/>
<Property Name="Emails" Type="Collection
(Edm.String)"/>
</EntityType>
Property
The Property element allows the construction of structural types from a single value or a collection of values.
<Property Name="UserName" Type="Edm.String"
Nullable="false"/>
<Property Name="Emails" Type="Collection
(Edm.String)"/>
NavigationProperty
The Navigation Property allows navigation from an entity to related entities.
In the following example, the Person entity type has the navigation properties, for example, Friends, Trips, and Photo:
<EntityType Name="Person" OpenType="true">
...
<NavigationProperty Name="Friends" Type=
"Collection(services.odata.org.TripPin.Person)"/>
<NavigationProperty Name="Trips" Type=
"Collection(services.odata.org.TripPin.Trip)"
ContainsTarget="true"/>
<NavigationProperty Name="Photo" Type=
"services.odata.org.TripPin.Photo"/>
</EntityType>
EntityContainer
An Entity Container corresponds to a logical data store and contains zero or more entity sets and function imports.
A full example of an entity container is as follows:
<EntityContainer Name="DefaultContainer">
<EntitySet Name="Photos"
EntityType="services.odata.org.TripPin.Photo"/>
<EntitySet Name="People"
EntityType="services.odata.org.TripPin.Person"/>
<EntitySet Name="Airlines"
EntityType="services.odata.org.TripPin.Airline"/>
<FunctionImport Name="GetNearestAirport"
Function="services.odata.org.TripPin.GetNearestAirport"
<EntitySet="Airports"
IncludeInServiceDocument="true">
</FunctionImport>
</EntityContainer>
EntitySet
An Entity Set element represents a single entity or a collection of entities of a specific entity type in the data model.
For example, the entity set identified by the URI http://services.odata.org/V4/TripPinService/People('scottketchum')/Friends or the collection of entities identified by the "Friends" navigation property in http://services.odata.org/V4/TripPinService/People('scottketchum')/Friends('russellwhyte')/Trips identifies a feed of entries exposed by the OData service.
Singleton
Singletons are single entities which are accessed as children of the entity container.
A simple example of a singleton is as follows:
<Singleton Name="Me" Type="services.odata.
org.TripPin.Person">
<NavigationPropertyBinding Path="Friends"
Target="People"/>
<NavigationPropertyBinding Path="Photo"
Target="Photos"/>
</Singleton>
FunctionImport
The Function Import element represents a Function in an entity model.
A simple example of a Function Import is as follows:
<FunctionImport Name="GetNearestAirport"
Function="services.odata.org.TripPin.GetNearestAirport"
EntitySet="Airports" IncludeInServiceDocument="true">
<Annotation Term="Org.OData.Core.V1.ResourcePath"
String="services.odata.org.TripPin.GetNearestAirport"/>
</FunctionImport>
Function IsBound
The Function IsBound element denotes if the function is bound to a specific entity type in an entity model.
A simple example of a Function IsBound is as follows:
<Function Name="GetFavoriteAirline" IsBound="true"
EntitySetPath="person/Trips/PlanItems/
Services.odata.org.TripPin.Flight/Airline"
IsComposable="true">
<Parameter Name="person"
Type="services.odata.org.TripPin.Person" Nullable="false"/>
<ReturnType Type="services.odata.org.TripPin.Airline"
Nullable="false"/>
</Function>
Function Parameter
The Function Parameter element represents a parameter to the function.
The following example demonstrates a Function that contains two parameters:
<Function Name="GetNearestAirport"
IsComposable="true">
<Parameter Name="lat" Type="Edm.Double"
Nullable="false"/>
<Parameter Name="lon" Type="Edm.Double"
Nullable="false"/>
<ReturnType Type="services.odata.org.TripPin.Airport"
Nullable="false"/>
</Function>
ActionImport
The Action Import element represents an Action in an entity model.
A simple example of an Action Import is as follows:
<ActionImport Name="ResetDataSource"
Action="services.odata.org.TripPin.ResetDataSource"/>
Action IsBound
The Action IsBound element denotes if the action is bound to a specific entity type in an entity model.
A simple example of an Action IsBound is as follows:
<Action Name="ShareTrip" IsBound="true">
<Parameter Name="person"
Type="services.odata.org.TripPin.Person"
Nullable="false"/>
<Parameter Name="userName" Type="Edm.String"
Nullable="false"/>
<Parameter Name="tripId" Type="Edm.Int32"
Nullable="false"/>
</Action>
Copyright © 2015- 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback