2.2.1 Abstract Data Model

This section describes a data modeling vocabulary that a server uses to describe the data it exposes. This modeling vocabulary is also used in subsequent sections of this document to describe data as exchanged by this document. The use of this modeling vocabulary does not mandate a particular data persistence format or implementation on the server, as long as the server's interface is consistent with the OData protocol.

The OData protocol uses the Entity Data Model (EDM) as its data modeling vocabulary. Data models can be described in EDM terms using a conceptual schema definition language (CSDL) document [MC-CSDL]. The remainder of this section provides a brief description of the EDM and defines how EDM constructs are mapped to the resource types defined in the AtomPub specification.

Entity Data Model: The central concepts in the EDM are entities and associations. Entities are instances of EntityType (such as Customer, Employee, and so on) that are structured records that consist of named and typed properties and that include a key.

A ComplexType ([MC-CSDL] section 2.1.7) is a structured type that also consists of a list of properties. However, a ComplexType does not have a key and thus can exist only as a property of a containing entity or as a temporary value.

A service operation represents a FunctionImport, as specified in [MC-CSDL] section 2.1.15, that accepts only input parameters.

A Collection type is a non-nullable, unordered, homogenous set of types EDMSimpleType or ComplexType.

An EntityKey ([MC-CSDL] section 2.1.5) is formed from a subset of properties of the EntityType. The EntityKey (such as CustomerId, OrderId, and so on) is a fundamental concept to uniquely identify instances of EntityType and allows EntityType instances to participate in relationships. Entities are grouped in EntitySets (for example, Customers is a set of Customer instances).

An association defines the relationship between one EntityType and another (for example, Employee Works For Department). Instances of associations are grouped in AssociationSets ([MC-CSDL] section 2.1.19).

NavigationProperties ([MC-CSDL] section 2.1.4) are special properties on an EntityType that are bound to a specific association and can be used to refer to associations through an entity instead of explicitly through an association instance.

Finally, all instance containers (EntitySet and AssociationSet) are grouped in an EntityContainer ([MC-CSDL] section 2.1.14).

EDM constructs map to the data model concepts used in the AtomPub specification as shown in the following Entity Data Model Concepts Mapped to AtomPub Resource Types table. Common Payload Syntax (section 2.2.6) describes how these conceptual AtomPub resources (such as collection and Entry Resource) are represented using multiple formats in request and response messages used by this document.

Entity Data Model

AtomPub Resource Classification

EntitySet

Collection

EntityType with m:HasStream equals true

Media Link Entry Resource

EntityType instance

Entry Resource

NavigationProperty

atom:link element

Named resource stream instance

atom:link element

FunctionImport with Binding equals true and IsSideEffecting equals true

m:action element

FunctionImport with Binding equals true and IsSideEffecting equals false

m:function element

Table: Entity Data Model Concepts Mapped to AtomPub Resource Types