OData metadata is composed of a type system called the Entity Data Model (EDM), consisting of EntitySets, Entities, ComplexTypes and Scalar Types.
Any service can be queried for the metadata. The metadata will describe all the services exposed to the caller. However in order to define the required and returned data within each service, some form of meta description is needed and this is what the metadata does. It defines what inputs and outputs to a particular service will look like in an open and standardized manner.
OData has a built in type system to fully describe all the entities in the metadata. This is called the Entity Data Model (or EDM) and from this it is possible for the caller to infer information about the type from the metadata to ensure that some client side validation such as range checking can be done. Its primary use however is to specify to the caller what the input and output data for each object will look like and how it is to be read and written as well as the relationship between this object and other objects in the Entity Data Model.
The scalar types form the basis for the complex types which are collections of scalar properties and other previously defined complex types. These are the intrinsic types and are all prefixed by “edm:” and define such types as int, string, date, time, boolean, binary and more recently geo coordinates.
Complex types take the scalar types and combine them into a larger collection of properties of scalar types and other complex types that have already been defined. These allow a collection of properties to be given a name.
Entities on the other hand are like complex types on steroids: they are composed of properties which may be scalar or complex types but also support having a key to uniquely identify each instance of the entity as well as having support for navigation to and from other entities. It is also possible for an entity to inherit its structure from another entity and in so doing get the definition of the base entity types.
Finally, EntitySets are collections of instances of entities. Each instance of an entity within an entity set can be accessed by its unique key, implying of course that each entity must have a unique key within the collection and that key is defined by the key property of the entity in the metadata definition for the entity.
It is worth looking at the OData specification for the data model to see a more indepth explanation of the data model since this contains some more information on Associations and Navigation, both of which will be covered in a later blog.