Mentor SAP
Each OData service is represented by a URI, called the service root URI. A URI is a uniform resource identifier, which is a string of characters used to identify a resource. A more commonly used term is the URL. This type of identification enables interaction with representations of the resource across a network using specific protocols like OData.

 

There are two types of the document associated with each OData service:

 

Both documents can be retrieved from a server by means of an HTTP GET call.

 

If you choose the hyperlink of the service root URI, you send an HTTP GET call to the server, and the server will respond with the service document. The service document is formatted by default in Atom but can also be formatted in JSON by using the system query option $format=json.

 

 

The figure shows an example of a simple model and the associations between the entity types. An OData service is a logical data model; it describes entities using associations and operations. The entities in our example are business partners, sales orders, sales order line items, products, and the contacts of business partners.

 

OData Service Document Example

The service document in the figure contains five resources:

 

In OData, these are called entity sets because they are collections of entities. Entity sets are similar to lists or tables.

 

OData Example — Graphical Representation

The service metadata document is available at the Service Metadata URI. The service metadata URI can be constructed easily by appending the string $metadata to the service root URI.

 

The purpose of the service metadata document is to enable clients to discover the structure of an OData service, the structure of its resources, the known links between resources, and the service operations exposed. A service metadata document describes the entity data model (EDM) for a given service.

 

Initially, we can look at a graphical representation of the OData model. The EDM is the underlying abstract data model used by OData services. The core of the entity data model is the entity-relationship model. The entity-relationship model has existed for over 30 years and differs from the more familiar relational model because associations and entities are both first-class concepts.

 

An OData Service Metadata Document describes its data in EDM terms by using an XML language for describing models, known as the conceptual schema definition language (CSDL).

 

 

The EntityContainer

An important section of the service metadata document is EntityContainer. The EntityContainer defines all the entity sets belonging to one service, like ProductSet. ProductSet is an entity set, and each entity of the ProductSet entity set is of the entity type Product. An example of an EntityContainer is as follows: