diff --git a/docs/odata-protocol/odata-protocol.html b/docs/odata-protocol/odata-protocol.html index a10076a8..2ad13ff9 100644 --- a/docs/odata-protocol/odata-protocol.html +++ b/docs/odata-protocol/odata-protocol.html @@ -1348,6 +1348,7 @@

10.3 Entity

Context URL template:

{context-url}#{entity-set}/$entity
+{context-url}#{single-navprop}
 {context-url}#{type-name}

If a response or response part is a single entity of the declared type of an entity set, the context URL fragment is the entity set’s name with /$entity appended.

@@ -1355,12 +1356,18 @@

10.3 Entity

http://host/service/Customers(1)
 http://host/service/$metadata#Customers/$entity
-

If the entity is contained, then entity-set is the top-level entity set or singleton followed by the path to the containment navigation property of the containing entity.

+

If the entity is bound to a contained entity set, then entity-set is the top-level entity set or singleton followed by the path to the collection-valued containment navigation property of the containing entity.

Example 14: resource URL and corresponding context URL for contained entity

http://host/service/Orders(4711)/Items(1)
 http://host/service/$metadata#Orders(4711)/Items/$entity
+

If the entity is the target of a single-valued containment navigation property, the context URL fragment is the top-level entity set or singleton followed by the path to the single-valued containment navigation property without /$entity appended.

+
+

Example 15: resource URL and corresponding context URL for entity targeted by a single-valued containment navigation property

+
http://host/service/Orders(4711)/DeliveryAddress
+http://host/service/$metadata#Orders(4711)/DeliveryAddress
+

If the entity is not bound to an entity set, such as an entity returned from a function or action with no entity set path, a function import or action import with no specified entity set, or a navigation property with no navigation property binding, the context URL fragment specifies the type of the returned entity.

@@ -1370,7 +1377,7 @@

10.4 Singleton{context-url}#{singleton}

If a response or response part is a singleton, its name is the context URL fragment.

-

Example 15: resource URL and corresponding context URL

+

Example 16: resource URL and corresponding context URL

http://host/service/MainSupplier
 http://host/service/$metadata#MainSupplier
@@ -1382,7 +1389,7 @@

{context-url}#{entity-set}{/type-name}

If an entity set consists exclusively of derived entities, a type-cast segment is added to the context URL.

-

Example 16: resource URL and corresponding context URL

+

Example 17: resource URL and corresponding context URL

http://host/service/Customers/Model.VipCustomer
 http://host/service/$metadata#Customers/Model.VipCustomer
@@ -1394,7 +1401,7 @@

10.6 Der
{context-url}#{entity-set}{/type-name}/$entity

If a response or response part is a single entity of a type derived from the declared type of an entity set, a type-cast segment is appended to the entity set name.

-

Example 17: resource URL and corresponding context URL

+

Example 18: resource URL and corresponding context URL

http://host/service/Customers(2)/Model.VipCustomer
 http://host/service/$metadata#Customers/Model.VipCustomer/$entity
@@ -1412,7 +1419,7 @@

$select.

-

Example 18: resource URL and corresponding context URL

+

Example 19: resource URL and corresponding context URL

http://host/service/Customers?$select=Address,Orders,Model.VipCustomer/PreferredContact
 http://host/service/$metadata#Customers(Address,Orders,Model.VipCustomer/PreferredContact)
@@ -1431,7 +1438,7 @@

10

Operations in the context URL are represented using the namespace- or alias-qualified name. Function names suffixed with parentheses represent a specific overload, while function names without parentheses represent all overloads of the function.

OData 4.01 responses MAY use the shortcut pattern {namespace}.* to represent the list of all bound actions or functions available for the returned entity, see system query option $select.

-

Example 19: resource URL and corresponding context URL

+

Example 20: resource URL and corresponding context URL

http://host/service/Customers(1)?$select=Name,Rating
 http://host/service/$metadata#Customers(Name,Rating)/$entity
@@ -1448,17 +1455,17 @@

-

Example 20: resource URL and corresponding context URL — select and expand

+

Example 21: resource URL and corresponding context URL — select and expand

http://host/service/Customers?$select=Name&$expand=Address/Country
 http://host/service/$metadata#Customers(Name,Address/Country())
-

Example 21: resource URL and corresponding context URL — expand $ref

+

Example 22: resource URL and corresponding context URL — expand $ref

http://host/service/Customers?$expand=Orders/$ref
 http://host/service/$metadata#Customers
-

Example 22: resource URL and corresponding context URL — expand with $levels

+

Example 23: resource URL and corresponding context URL — expand with $levels

http://host/service/Employees/Sales.Manager?$select=DirectReports
         &$expand=DirectReports($select=FirstName,LastName;$levels=4)
 http://host/service/$metadata
@@ -1477,7 +1484,7 @@ 

10.1

If the context URL includes only expanded navigation properties (i.e., only navigation properties suffixed with parentheses), then all structural properties are implicitly selected (same as if there were no properties listed in the select-list).

Navigation properties with expanded references are not represented in the context URL.

@@ -1503,7 +1510,7 @@

1
{context-url}#$ref

If a response is a single entity reference, $ref is the context URL fragment.

-

Example 25: resource URL and corresponding context URL for a single entity reference

+

Example 26: resource URL and corresponding context URL for a single entity reference

http://host/service/Orders(10643)/Customer/$ref
 http://host/service/$metadata#$ref
@@ -1517,7 +1524,7 @@

10.13 P

If a response represents an individual property of an entity with a canonical URL, the context URL specifies the canonical URL of the entity and the path to the structural property of that entity. The path MUST include cast segments for properties defined on types derived from the expected type of the previous segment.

If the property value does not contain explicitly or implicitly selected navigation properties or operations, OData 4.01 responses MAY use the less specific second template.

-

Example 26: resource URL and corresponding context URL

+

Example 27: resource URL and corresponding context URL

http://host/service/Customers(1)/Addresses
 http://host/service/$metadata#Customers(1)/Addresses
@@ -1529,7 +1536,7 @@

-

Example 27: resource URL and corresponding context URL

+

Example 28: resource URL and corresponding context URL

http://host/service/TopFiveHobbies()
 http://host/service/$metadata#Collection(Edm.String)

@@ -1541,7 +1548,7 @@

-

Example 28: resource URL and corresponding context URL

+

Example 29: resource URL and corresponding context URL

http://host/service/MostPopularName()
 http://host/service/$metadata#Edm.String
@@ -1557,7 +1564,7 @@

1 {context-url}#{type-name}{select-list}

If the response from an action or function is a collection of entities or a single entity that is a member of an entity set, the context URL identifies the entity set. If the response from an action or function is a property of a single entity, the context URL identifies the entity and property. Otherwise, the context URL identifies the type returned by the operation. The context URL will correspond to one of the former examples.

-

Example 29: resource URL and corresponding context URL

+

Example 30: resource URL and corresponding context URL

http://host/service/TopFiveCustomers()
 http://host/service/$metadata#Customers
@@ -1573,7 +1580,7 @@

10.17 Delt

The context URL of a delta response is the context URL of the response to the defining query, followed by /$delta. This includes singletons, single-valued navigation properties, and collection-valued navigation properties.

If the entities are contained, then {entity-set} is the top-level entity set followed by the path to the containment navigation property of the containing entity.

-

Example 30: resource URL and corresponding context URL

+

Example 31: resource URL and corresponding context URL

http://host/service/Customers?$deltatoken=1234
 http://host/service/$metadata#Customers/$delta
@@ -1728,7 +1735,7 @@

204 No Content.

If the property is not available, for example due to permissions, the service responds with 404 Not Found.

-

Example 31:

+

Example 32:

GET http://host/service/Products(1)/Name
@@ -1749,7 +1756,7 @@

204 No Content response.

If the property or operation result is not available, for example due to permissions, the service responds with 404 Not Found.

-

Example 32:

+

Example 33:

GET http://host/service/Products(1)/Name/$value

@@ -1764,27 +1771,27 @@

actions and functions explicitly requested by the client. The service returns the specified content, if available, along with any available expanded navigation or stream properties, and MAY return additional information.

The value of the $select query option is a comma-separated list of paths that end with properties, non-entity-valued instance annotations, qualified action names, or qualified function names, as well as of the star operator (*), or the star operator prefixed with the namespace or alias of the schema in order to specify all operations defined in the schema. Only aliases defined in the metadata document of the service can be used in URLs.

-

Example 33: request only the Rating and ReleaseDate for the matching Products

+

Example 34: request only the Rating and ReleaseDate for the matching Products

GET http://host/service/Products?$select=Rating,ReleaseDate

It is also possible to request all structural properties, including any dynamic properties, using the star operator. The star operator SHOULD NOT introduce navigation properties, actions or functions not otherwise requested.

-

Example 34:

+

Example 35:

GET http://host/service/Products?$select=*

Properties of related entities can be specified by including the $select query option within the $expand.

-

Example 35:

+

Example 36:

GET http://host/service/Products?$expand=Category($select=Name)

The properties specified in $select are represented in addition to any expanded navigation or stream properties. If a navigation property is specified in $select, then the corresponding navigation link is represented in the response. If the navigation property also appears in an $expand query option, then it is additionally represented as inline content.

-

Example 36: for each category, return the CategoryName and the Products navigation link

+

Example 37: for each category, return the CategoryName and the Products navigation link

GET http://host/service/Categories?$select=CategoryName,Products

It is also possible to request all actions or functions available for each returned entity.

-

Example 37:

+

Example 38:

GET http://host/service/Products?$select=DemoService.*

Query options can be applied to a selected property by appending a semicolon-separated list of query options, enclosed in parentheses, to the property. Allowed system query options are $select and $compute for complex properties, plus $filter, $search, $count, $orderby, $skip, and $top for collection-valued properties. A property MUST NOT have select options specified in more than one place in a request and MUST NOT have both select options and expand options specified.

@@ -1798,15 +1805,15 @@

OData-URL, section 5.1.3.

-

Example 38: for each customer entity within the Customers entity set the value of all related Orders will be represented inline

+

Example 39: for each customer entity within the Customers entity set the value of all related Orders will be represented inline

GET http://host/service.svc/Customers?$expand=Orders
-

Example 39: for each customer entity within the Customers entity set the references to the related Orders will be represented inline

+

Example 40: for each customer entity within the Customers entity set the references to the related Orders will be represented inline

GET http://host/service.svc/Customers?$expand=Orders/$ref
-

Example 40: for each customer entity within the Customers entity set the media stream representing the customer photo will be represented inline

+

Example 41: for each customer entity within the Customers entity set the media stream representing the customer photo will be represented inline

GET http://host/service.svc/Customers?$expand=Photo
@@ -1815,11 +1822,11 @@
11.2.

The set of expanded entities can be further refined through the application of expand options, expressed as a semicolon-separated list of system query options, enclosed in parentheses, see OData-URL.

Allowed system query options are $compute, $select, $expand, and $levels for all navigation properties, plus $filter, $orderby, $skip, $top, $count, and $search for collection-valued navigation properties.

-

Example 41: for each customer entity within the Customers entity set, the value of those related Orders whose Amount is greater than 100 will be represented inline

+

Example 42: for each customer entity within the Customers entity set, the value of those related Orders whose Amount is greater than 100 will be represented inline

GET http://host/service.svc/Customers?$expand=Orders($filter=Amount gt 100)
-

Example 42: for each order within the Orders entity set, the following will be represented inline:

+

Example 43: for each order within the Orders entity set, the following will be represented inline:

-

Example 43: for each customer entity in the Customers entity set, the value of all related InHouseStaff will be represented inline if the entity is of type VipCustomer or a subtype of that. For entities that are not of type VipCustomer, or any of its subtypes, that entity may be returned with no inline representation for the expanded navigation property InHouseStaff (the service can always send more than requested)

+

Example 44: for each customer entity in the Customers entity set, the value of all related InHouseStaff will be represented inline if the entity is of type VipCustomer or a subtype of that. For entities that are not of type VipCustomer, or any of its subtypes, that entity may be returned with no inline representation for the expanded navigation property InHouseStaff (the service can always send more than requested)

GET http://host/service.svc/Customers?$expand=SampleModel.VipCustomer/InHouseStaff
@@ -1838,7 +1845,7 @@
-

Example 44: return each employee from the Employees entity set and, for each employee that is a manager, return all direct reports, recursively to four levels

+

Example 45: return each employee from the Employees entity set and, for each employee that is a manager, return all direct reports, recursively to four levels

GET http://host/service/Employees?$expand=Model.Manager/DirectReports($levels=4)
@@ -1850,7 +1857,7 @@

The $compute system query option allows clients to define computed properties that can be used in a $select or within a $filter or $orderby expression.

Computed properties SHOULD be included as dynamic properties in the result and MUST be included if $select is specified with the computed property name, or star (*).

-

Example 45: compute total price for order items (line breaks only for readability)

+

Example 46: compute total price for order items (line breaks only for readability)

GET http://host/service/Customers
    ?$filter=Orders/any(o:o/TotalPrice gt 100)
    &$expand=Orders($compute=Price mult Qty as TotalPrice
@@ -1870,12 +1877,12 @@ 

-

Example 46: return all Products whose Price is less than $10.00

+

Example 47: return all Products whose Price is less than $10.00

GET http://host/service/Products?$filter=Price lt 10.00

The $count segment may be used within a $filter expression to limit the items returned based on the exact count of related entities or items within a collection-valued property.

-

Example 47: return all Categories with less than 10 products

+

Example 48: return all Categories with less than 10 products

GET http://host/service/Categories?$filter=Products/$count lt 10

The value of the $filter option is a Boolean expression as defined in OData-ABNF.

@@ -1975,7 +1982,7 @@
function parameters, or within a $compute, $filter or $orderby expression. Parameters aliases are names beginning with an at sign (@).

Actual parameter values are specified as query options in the query part of the request URL. The query option name is the name of the parameter alias, and the query option value is the value to be used for the specified parameter alias.

-

Example 48: returns all employees whose Region property matches the string parameter value WA

+

Example 49: returns all employees whose Region property matches the string parameter value WA

GET http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'

Parameter aliases allow the same value to be used multiple times in a request and may be used to reference primitive, structured, or collection values.

@@ -1983,7 +1990,7 @@
-

Example 49: returns all employees, expands their manager, and expands all direct reports with the same first name as the manager, using a parameter alias for $this to pass the manager into the filter on the expanded direct reports

+

Example 50: returns all employees, expands their manager, and expands all direct reports with the same first name as the manager, using a parameter alias for $this to pass the manager into the filter on the expanded direct reports

GET http://host/service.svc/Employees?$expand=Manager(@m=$this;$expand=DirectReports($filter=@m/FirstName eq FirstName))

@@ -2000,17 +2007,17 @@

Services SHOULD order language-dependent strings according to the Content-Language of the response, and SHOULD annotate string properties with language-dependent order with the term Core.IsLanguageDependent, see OData-VocCore.

Values of type Edm.Stream or any of the Geo types cannot be sorted.

-

Example 50: return all Products ordered by release date in ascending order, then by rating in descending order

+

Example 51: return all Products ordered by release date in ascending order, then by rating in descending order

GET http://host/service/Products?$orderby=ReleaseDate asc, Rating desc

Related entities may be ordered by specifying $orderby within the $expand clause.

-

Example 51: return all Categories, and their Products ordered according to release date and in descending order of rating

+

Example 52: return all Categories, and their Products ordered according to release date and in descending order of rating

GET http://host/service/Categories?$expand=Products($orderby=ReleaseDate asc, Rating desc)

$count may be used within a $orderby expression to order the returned items according to the exact count of related entities or items within a collection-valued property.

-

Example 52: return all Categories ordered by the number of Products within each category

+

Example 53: return all Categories ordered by the number of Products within each category

GET http://host/service/Categories?$orderby=Products/$count

@@ -2021,7 +2028,7 @@

\(A\) be a copy of the result set with a total order that extends any existing order of the result set but is otherwise chosen by the service. If no unique ordering is imposed through an $orderby query option, the service MUST choose a stable ordering across requests that include $top or $skip.

If \(A\) contains more than \(n\) instances, the result of \({\tt \$top}=n\) consists of the first \(n\) instances in \(A\). Otherwise, the result equals \(A\). The instances in the result are in the same order as they occur in \(A\).

-

Example 53: return only the first five products of the Products entity set

+

Example 54: return only the first five products of the Products entity set

GET http://host/service/Products?$top=5
@@ -2032,12 +2039,12 @@

\(A\) be a copy of the result set with a total order that extends any existing order of the result set but is otherwise chosen by the service. If no unique ordering is imposed through an $orderby query option, the service MUST choose a stable ordering across requests that include $top or $skip.

If \(A\) contains \(n\) or fewer instances, the result of \({\tt \$skip}=n\) is empty. Otherwise, the first \(n\) instances in \(A\) are omitted from the result and all remaining instances are kept in the same order as they occur in \(A\).

-

Example 54: return products starting with the 6th product of the Products entity set

+

Example 55: return products starting with the 6th product of the Products entity set

GET http://host/service/Products?$skip=5

Where $top and $skip are used together, $skip MUST be applied before $top, regardless of the order in which they appear in the request.

-

Example 55: return the third through seventh products of the Products entity set

+

Example 56: return the third through seventh products of the Products entity set

GET http://host/service/Products?$top=5&$skip=2

If no unique ordering is imposed through an $orderby query option, the service MUST impose a stable ordering across requests that include $skip.

@@ -2047,12 +2054,12 @@

-

Example 56: return, along with the results, the total number of products in the collection

+

Example 57: return, along with the results, the total number of products in the collection

GET http://host/service/Products?$count=true

The count of related entities can be requested by specifying the $count query option within the $expand clause.

-

Example 57:

+

Example 58:

GET http://host/service/Categories?$expand=Products($count=true)

A $count query option with a value of false (or not specified) hints that the service SHOULD NOT return a count.

@@ -2065,32 +2072,32 @@