OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-674) Specify navigation property binding combined with containment


    [ https://issues.oasis-open.org/browse/ODATA-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63969#comment-63969 ] 

Michael Pizzo commented on ODATA-674:
-------------------------------------

We want to avoid mixing model concepts from storage concepts. Types define a (resuable) structure, where-as the entity container instantiates an instance of a service using that structure.  It's important that components of the structure do not reference components of the instantiation (i.e., entity types must not reference members of an entity container).

We deal with something similar in entity set bindings for actions/functions.  A bound function definition can have an entitysetpath that defines a relative path from the bound instance to the set of the returned result(s). A function import, on the other hand, can specify the entityset that the returned instances belong to.

If we think of a navigation property as a function that returns related instances, then it might make sense to have a navigationpropertypath to specify how to get from the parent (the one containing the nav property) to the returned entit(ies) (those related according to the specified nav property), just as an entitysetpath tells how to get from the bound entity to the returned entit(ies).

The existing <NavigationPropertyBinding> has properties for target and path, but we would probably want to restrict path to be the current navigation property so it probably makes sense to define a new <NavigationPropertyBindingPath> that has only target and not path.

Target would have to be a path (relative to the instance declaring the nav prop?) that terminates in a containment navigation property (that way the definition of the type never references something within an entity container.) 

The current syntax of an entitysetpath expression doesn’t support "going backwards" up the hierarchy, which may be required in some scenarios. We could address this by augmenting the path expression syntax, for example with "../" addressing a property on the parent. We might want to consider extending the path syntax for entitysetpath for bound functions/actions in a similar way for 4.01.


> Specify navigation property binding combined with containment
> -------------------------------------------------------------
>
>                 Key: ODATA-674
>                 URL: https://issues.oasis-open.org/browse/ODATA-674
>             Project: OASIS Open Data Protocol (OData) TC
>          Issue Type: Bug
>          Components: Implementing OData, OData CSDL
>    Affects Versions: V4.0_OS
>         Environment: Proposal needed for CSD01
>            Reporter: Ralf Handl
>            Assignee: Michael Pizzo
>              Labels: Gap, request_tc_discussion
>             Fix For: V4.01_WD01
>
>
> This combination is not explicitly covered in the specification.
> There are two sides to this problem: 
> - target entity sets for contained entities
> - contained entity sets as target entity sets
> Both problems can be solved by allowing <NavigationPropertyBinding> elements as children of the structured type that defines the containment navigation property.
> Example 1: navigation property of a contained entity targets a top-level entity set:
>   <NavigationProperty Name="Items" Type="Collection(Model.OrderItem)" ContainsTarget="true" />
>   <NavigationPropertyBinding Path="Items/Product" Target="Model.Container/Products"/>
> Example 2: assume an Order contains Items and Shipments, and an Item refers to a single Shipment of the same Order and vice versa. Using paths that start at the type defining the containment navigation property, the Target would be "Shipments" and "Items".
> <EntityType Name="Order">
>   <NavigationProperty Name="Items" Type="Collection(Model.OrderItem)" ContainsTarget="true" />
>   <NavigationPropertyBinding Path="Items/Shipment" Target="Shipments"/>  
>   <NavigationProperty Name="Shipments" Type="Collection(Model.Shipment)" ContainsTarget="true" />
>   <NavigationPropertyBinding Path="Shipments/ShippedItems" Target="Items"/>
> </EntityType>
> <EntityType Name="OrderItem">
>   <NavigationProperty Name="Shipment" Type="Model.Shipment" Partner="ShippedItems"/>
> </EntityType>
> <EntityType Name="Shipment">
>   <NavigationProperty Name="ShippedItems" Type="Collection(Model.OrderItem)" Partner="Shipment"/>
> </EntityType>



--
This message was sent by Atlassian JIRA
(v6.2.2#6258)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]