Слайд 2
ARC202
Providing Broad Access to Data with OData
David Chappell
Principal
Chappell & Associates
Слайд 3
Agenda
Describing OData: The Basics
Examining OData: A Closer Look
at the Technology
Слайд 4
Describing OData: The Basics
Слайд 5
The Problem: Accessing Diverse Data
Many kinds of data
sources exist, such as:
Custom apps with relational storage
Cloud platforms
with relational storage, NOSQL storage, etc.
Content management systems with lists, etc.
Many kinds of clients can use data, such as:
Web browsers
Phone/tablet apps
Business intelligence (BI) tools
Custom apps
How can all of these clients access all of these data sources?
Слайд 6
A Solution: OData
The Open Data Protocol (OData) addresses
this problem
It lets diverse clients access diverse data sources
OData
defines:
An abstract data model
A standard access protocol
With multiple data serialization formats
OData is a generic technology
It’s not tied to Windows
Although Microsoft provides tools and libraries for implementing OData
Слайд 7
OData
Data Sources
Clients
Web Browsers
(Internet Explorer,
Firefox, …)
Mobile Phones
(Android, iPhone,
Windows Phone 7)
Illustrating OData
BI Tools
(Microsoft Excel,
Tableau Desktop)
Слайд 8
OData Components (1)
The OData data model
Provides a generic
way to organize and describe data
Uses the Entity
Data Model (EDM) from Microsoft’s Entity Framework
The OData protocol
Based on HTTP
Lets a client make requests to and get responses from an OData service
Слайд 9
OData Components (2)
An OData service
Exposes an endpoint that
allows access to data
Uses the abstractions of the OData
data model to translate data between its underlying form (e.g., relational tables) into the format sent to the client
OData client libraries
Make it easier to create software that accesses data via the OData protocol
Слайд 10
Data Source
OData Components
An illustration
Client
Слайд 11
Accessing Data from Mobile Devices and Browsers
An OData
scenario
Слайд 12
Exposing Data from a Cloud Application
An OData scenario
Слайд 13
Using Diverse Data Sources with BI Tools
An OData
scenario
Слайд 14
Examining OData:
A Closer Look at the Technology
Слайд 15
The OData Data Model
Entities and associations in the
Слайд 16
The OData Data Model
A closer look at the
Слайд 17
The OData Protocol
Basics
Based on HTTP
Example verbs:
POST: Creates a
new entity
GET: Reads data from one or more entities
PUT:
Updates an existing entity, replacing all of its properties
DELETE: Removes an entity
MERGE: Updates an existing entity, but replaces only specified properties
Supported serialization options:
XML-based Atom/AtomPub
JavaScript Object Notation (JSON)
Слайд 18
The OData Protocol
Illustrating Atom and AtomPub
Слайд 19
The OData Protocol
Mapping between EDM and Atom/AtomPub
Слайд 20
The OData Protocol
Serializing relational data in Atom/AtomPub
Слайд 21
The OData Protocol
Getting an AtomPub service document
Слайд 22
The OData Protocol
An example AtomPub service document
…
Customers
Orders
…
Слайд 23
The OData Protocol
Getting an Atom feed document
OrderID
Status
CustID
CustID
Name
Address
Customers
Orders
Relational Database
OData
Service
Client
Слайд 24
The OData Protocol
An example Atom feed document (1)
xmlns:m= … xmlns:d= … >
Orders
…
…
3501
Shipped
867734
An OData-defined extension to Atom/AtomPub
An Entity Data Model-defined data type
Слайд 25
The OData Protocol
An example Atom feed document (2)
…
5630
Placed
8499734
…
…
Слайд 26
The OData Protocol
Some other options
Returning the number of
entries in a feed:
http://GET www.fabrikam.com/example/Orders/$count
Returning only the
entry whose primary key is 5630:
http://GET www.fabrikam.com/example/Orders(5630)
Слайд 27
The OData Protocol
Serializing data with JSON
The first request:
http://GET www.fabrikam.com/example
The response:
{ "d" : {
"EntitySets": ["Customers", "Orders"]
} }
Слайд 28
The OData Protocol
Serializing data with JSON
Requesting data:
GET http://www.fabrikam.com/example/Orders(5630)
The response:
{ "d" : {
"results":
{
"OrderID": 5630,
"Status": "Placed",
"CustID": 8499734 }
} }
Слайд 29
The OData Protocol
Issuing queries (1)
The OData query language
is expressed as options appended to a GET request
Examples:
$top=n:
Returns only the first n entities in an entity set
That is, the first n entries in an Atom feed
$skip=n: Skips the first n entities in an entity set
Lets a client retrieve a series of distinct pages on subsequent requests
$format: Determines whether data should be returned in JSON or Atom/AtomPub
Default is Atom/AtomPub
Слайд 30
The OData Protocol
Issuing queries (2)
Expressions:
$orderby=: Orders results by
the value of one or more properties in those
results
$filter=: Returns only entities that match the specified expression
$select=: Returns only the specified properties in an entity
Example:
http://GET www.fabrikam.com/example/Orders?$filter=OrderID gt 3000 and OrderID lt 5000
Слайд 31
Implementing OData
What Microsoft provides
Слайд 32
Conclusion
OData provides broad support for accessing many kinds
of data
It includes:
A general data model
A protocol
With serialization in
Atom/AtomPub or JSON
Microsoft also provide support for implementing OData clients and services
OData addresses an important problem
Слайд 33
Feedback
Dear attendees!
Your feedback is appreciated!
In notepad that
can be found in attendee’s infopack, you will find
a feedback form
Please, rate the session and pass the feedback form to the moderator on exit
To take part in a lottery, please do not forget to mark the feedback form with the number of your badge
Thank you!
Слайд 34
Questions?
Providing Broad Access to Data with OData,
ARC202
David Chappell
Principal, Chappell & Associates
david@davidchappell.com
www.davidchappell.com
You can ask your questions
at Microsoft zone in Hall 17 within an hour after end of this session
Слайд 35
For Further Reading
Introducing OData
http://www.davidchappell.com/writing/white_papers/Introducing_OData_v1.0--Chappell.pdf