open data protocol *
DESCRIPTION
Open Data Protocol *. Han Wang 11/30/2012. * http://www.odata.org. What. “The Open Data Protocol ( OData ) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. ” [1]. - PowerPoint PPT PresentationTRANSCRIPT
What
• “The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today.”[1]
11/30/2012 Open Data Protocol 2
[1] http://www.odata.org/introduction
What (cont.)
• Enables the creation of HTTP-based data services
• Identifies resources using URIs• Publishes and edits resources using simple
HTTP messages
11/30/2012 Open Data Protocol 3
http://www.odata.org/documentation/overview
Why
• Problem: web API’s are hardly uniform• OData provides a uniform interface to
expose, structure, query, and manipulate data– “Uniform” means operations are the same
across any OData service
• OData also provides a uniform way to represent metadata
11/30/2012 Open Data Protocol 4
Basics
• Feeds: Collections of typed Entries• Entries: structured records with keys• A record has a list of Properties of primitive
or complex types• Entries may have related Entries or related
Feeds through Links
11/30/2012 Open Data Protocol 5
Basics (cont.)
• A Service Document lists list all the top level feeds– May be formatted in Atom or JSON
11/30/2012 Open Data Protocol 6
http://services.odata.org/OData/OData.svc
Basics (cont.)
• A Service Metadata Document describes the shape of an OData service, the structure of its resources, the known links between resources, and the Service Operations exposed– Service Operations: simple, service-specific
functions that accept input parameters and return entries or complex/primitive values.
11/30/2012 Open Data Protocol 7
Basics (cont.)
11/30/2012 Open Data Protocol 8
http://services.odata.org/OData/OData.svc/$metadata
9
• Entity Data Model (EDM): the abstract data model that MUST be used to describe the data exposed by an OData service
• Common Schema Definition Language (CSDL) defines an XML-based representation of the entity model exposed by an OData service.
Data Model
11/30/2012 Open Data Protocol
10
• Entities– Instances of Entity Types– Structured records– Have named and typed properties and with Entity
Keys– Grouped in Entity Sets
Data Model (cont.)
11/30/2012 Open Data Protocol
11
• Complex Types– Structured types– Consist of a list of properties but with no key
Data Model (cont.)
11/30/2012 Open Data Protocol
12
• Associations– Define the relationship between two or more
Entity Types– Instances of associations are grouped in
Association Sets
Data Model (cont.)
11/30/2012 Open Data Protocol
13
• Navigation Properties– Special properties on Entity Types– Bound to a specific Association– Used to refer to associations of an entry
Data Model (cont.)
11/30/2012 Open Data Protocol
Service Requests
• Metadata requests– Service Document– Metadata Document
• Data requests– Individual entities– Individual properties– Collections of entities
• Query operations: filter, sort, paging, projection, etc.
11/30/2012 Open Data Protocol 14
Service Requests (cont.)
• Data modification– Create– Update– Delete…
• Operations– Actions– Functions
11/30/2012 Open Data Protocol 15
URL Conventions
11/30/2012 Open Data Protocol 16
• Request the first two products in Category(1), ordered by Name:
– http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name
• Address the links between Category(1) and Products:– http://services.odata.org/OData/OData.svc/Category(1)/$links/Products
• Request all products with the Name 'Milk' that also have a Price less than 2.55:
– http://services.odata.org/OData/OData.svc/Products?$filter=Name eq 'Milk' and Price lt '2.55M’
http://www.odata.org/media/30002/OData%20URL%20Conventions.html
URL Conventions (cont.)
11/30/2012 Open Data Protocol 17
• Request all products, because 9 mod 3 is 0:– http://services.odata.org/OData/OData.svc/Products?$filter=( 4 add 5 ) mod ( 4
sub 1 ) eq 0
• Request all Customers with a CompanyName that contains ‘Alfreds’:– http://services.odata.org/Northwind/Northwind.svc/Customers?
$filter=substringof('Alfreds', CompanyName) eq true
• Request just the Rating and ReleaseDate for the matching Products:– http://services.odata.org/OData/OData.svc/Products?$select=Rating,ReleaseDate
http://www.odata.org/media/30002/OData%20URL%20Conventions.html
Libraries
11/30/2012 Open Data Protocol 18
Ecosystem
• Consumers (processing OData)– Web browsers, OData Explorer, Excel 2010,
LINQPad, Seasame, Tableau, Telerik RadGrid, etc.
• Applications (exposing OData)– SharePoint 2010, IBM WebSphere, Windows
Azure Table Storage, SQL Server Reporting Services
11/30/2012 Open Data Protocol 19
Status
• Currently available under the Microsoft Open Specification Promise (OSP)– Allows third parties to build data services for
any runtime as well as clients to consume such services.
• Microsoft and key partners have proposed an OASIS Technical committee to standardize OData as an OASIS standard.
11/30/2012 Open Data Protocol 20
Specifications
11/30/2012 Open Data Protocol 21
Specification Description[OData:URI] Conventions for constructing URIs to identify the resources and metadata
exposed by an OData service.
[OData:Terms] Glossary of terms used by OData
[OData:Operations] Defines the request types (retrieve, insert, update, delete, etc) and associated responses used by the OData protocol. An implementation can support some or all of the request types.
[OData:ATOM] Defines an AtomPub representation for the payload of an OData request/response.
[OData:JSON] Defines a JSON representation for the payload of an OData request/response.
[OData:Batch] Extends the OData Operations specification to define a mechanism to enable a client of a data service to "batch" a group of requests and send that group/batch to the OData service in a single HTTP request.
Glossary• Binary Large Object (BLOB): binary data stored as a single entity. Blobs are often videos, images, documents, etc.• Collection: A Resource that contains a set of Member Resources as defined in [RFC 5023]. In OData, a Collection is represented as an Atom Feed or an array of JSON objects.• CSDL: An XML language for describing Entity Data Models. See [CDSL] for additional information.• Declared Property: A statically declared Property on an Entity or Complex Type. The value of a declared property is a primitive or complex type.• Dynamic Property: An Entry may include additional (nullable) properties beyond its Declared Properties. The set of additional properties, and the type of each, may vary between
Entry instances. Such additional properties are referred to as Dynamic Properties and do not have a representation in a Service Metadata Document. If an Entry does not include a value for a Dynamic Property named N, then the Entry must be treated as if it included N with a value of null. A Dynamic Property must not have the same name as a declared property on the same Entry.
• Entity Data Model: The abstract data model used by OData services. See the Abstract Data Model section of [OData: Core] additional information.• Entry (Entry Resource): Members of a Collection, as defined by [RFC 5023]. In OData, Entries are represented as Atom Entry Documents, as described in [OData: Atom] or JSON
objects, as described in [OData: JSON]. An Entry may represent an instance of an Open Entity Type if, in addition to Declared Properties, the entry includes Dynamic Properties.• Feed: The representation of a Collection in Atom (see [OData: Atom]) or JSON (see [OData: JSON])• IRI: An Internationalized Resource Identifier as defined in [RFC3987]. Before an IRI found in a document used by HTTP, the IRI is first converted to a URI• Link: Describes an association between two Entries. More specifically, the term refers to a unidirectional association or to one direction of a bidirectional association.• Media Link Entry: A special kind of Entry Resource that contains metadata about a Media Resource, as defined in [RFC 5023].• Media Resource: Members of a Collection that have representations other than Atom Entry Documents or JSON objects.• Member Resource: A Resource whose IRI is listed in a Collection, as defined in [RFC 5023]• Navigation Property: A property of an Entry that represents a Link from the Entry to one or more related Entries. A Navigation Property is not a structural part of the Entry it
belongs to.• OData Data Namespace: The namespace used by OData services when representing data in XML-based formats. The URI identifying the namespace is
http://schemas.microsoft.com/ado/2007/08/dataservices . Note: The next version of OData will likely support a more general odata.org-based namespace.• OData Metadata Namespace: The namespace used by OData services when representing metadata in XML-based formats. The URI identifying the namespace is
http://schemas.microsoft.com/ado/2007/08/dataservices/metadata . Note: The next version of OData will likely support a more general odata.org-based namespace.• OData Service: A service which implements the Open Data Protocol (OData).• Property: A generic term to represent a declared or dynamic property of an Entry.• Representational state transfer (REST): REST is a set of principles or style of software architecture for distributed hypermedia systems such as the World Wide Web. OData
applies the principles of REST whenever possible.• Resource: A network-accessible data object or service identified by an IRI, as defined in [RFC 2616]• Service Document: A document that describes the location and capabilities of one or more Collections, as described by [RFC 5023]. See [OData: Core] for additional information on
using Service Documents with OData services.• Service Metadata Document (Metadata Document): A CSDL that describes the data model (i.e. structure and organization of all the resources) exposed as HTTP endpoints by an
OData service. See [OData: Core] for additional information.• URI: A Uniform Resource Identifier as defined in [RFC3986]
11/30/2012 Open Data Protocol 22