Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-1059

Improve specification and use of NavigationProperties, EntitySets, and Singletons

    XMLWordPrintable

    Details

    • Proposal:
      Hide

      The following proposals are alternatives for simplifying the OData metamodel.

      Proposal 1:
      Add clarifying text to 4.01 along these lines:
      • A property must be owned by a StructuredType and must have a type
      • A scalar property is a property and may have at most one value that is an instance of its type
      • A collection property is a property that may have zero or more values that are instances of its type
      • A reference type value is a reference to an instance of the type
      • An association end is a property that must be owned by a StructuredType and must have a reference type
      • EntityContainer is a special kind of StructuredType that must have exactly one instance in a model
      • EntitySet is a special kind of collection property that must be owned by an EntityContainer and must have type EntityType
      • Singleton is a special kind of scalar property that must be owned by an EntityContainer and must have type EntityType
      • A containment NavigationProperty (ContainsTarget=”True”) is a special kind of collection or scalar property that must be owned by an EntityType or ComplexType and must have type EntityType
      • A non-containment NavigationProperty (ContainsTarget=”True”) is a special kind of collection or scalar association end that must be owned by an EntityType or ComplexType and must have type EntityType

      Advantages of proposal 1:

      • No changes required to implementations.

      Proposal 2:
      1) Allow use of Singleton and EntitySet in the context of an EntityType or ComplexType declaration.
      2) Deprecate the ContainsTarget attribute.
      3) Add Nullable attribute to Singleton and EntitySet.

      The advantages of Proposal 3:
      1) Eliminates implied Singleton and EntitySet. These are now first class citizens in all cases.
      2) Simplifies specifications since containment NavigationProperty is eliminated.
      3) Clarifies whether or not a value may be omitted.

      Proposal 4:
      1) Add EntityProperty, with same syntax and semantics as Property except that Type must be an EntityType.
      2) Allow use of EntityProperty in the context of EntityContainer, EntityType, or ComplexType.
      3) Deprecate the ContainsTarget attribute.
      4) Deprecate Singleton and EntitySet
      5) Modify syntax of NavigationProperty to only reference EntityProperties.

      The advantages of Proposal 3:
      1) Eliminates Singleton and EntitySet. These are now first class EntityProperty elements in all cases.
      2) Eliminates need for ContainsTarget attribute and therefore the concept of containment NavigationProperty.
      3) Rationalizes the syntax differences between Singleton, EntitySet, and NavigationProperty around Property.
      4) Simplifies semantics of NavigationProperty as an association.
      5) Clarifies whether or not a value may be omitted.

      Proposal 4:
      1) Same as Proposal 3 except that instead of adding EntityProperty, instead extend Property to allow Type to be an EntityType. In this case, the spec might refer to an entity property as a Property with Type that is an EntityType.
      2) Allow use of Property in the context of EntityContainer, EntityType, or ComplexType declarations.
      3) Deprecate the ContainsTarget attribute.
      4) Deprecate Singleton and EntitySet
      5) Modify syntax of NavigationProperty to only reference entity properties.

      The advantages of Proposal 4:
      1) Everything in Proposal 3.
      2) Does not add a new metatype.

      Show
      The following proposals are alternatives for simplifying the OData metamodel. Proposal 1: Add clarifying text to 4.01 along these lines: • A property must be owned by a StructuredType and must have a type • A scalar property is a property and may have at most one value that is an instance of its type • A collection property is a property that may have zero or more values that are instances of its type • A reference type value is a reference to an instance of the type • An association end is a property that must be owned by a StructuredType and must have a reference type • EntityContainer is a special kind of StructuredType that must have exactly one instance in a model • EntitySet is a special kind of collection property that must be owned by an EntityContainer and must have type EntityType • Singleton is a special kind of scalar property that must be owned by an EntityContainer and must have type EntityType • A containment NavigationProperty (ContainsTarget=”True”) is a special kind of collection or scalar property that must be owned by an EntityType or ComplexType and must have type EntityType • A non-containment NavigationProperty (ContainsTarget=”True”) is a special kind of collection or scalar association end that must be owned by an EntityType or ComplexType and must have type EntityType Advantages of proposal 1: No changes required to implementations. Proposal 2: 1) Allow use of Singleton and EntitySet in the context of an EntityType or ComplexType declaration. 2) Deprecate the ContainsTarget attribute. 3) Add Nullable attribute to Singleton and EntitySet. The advantages of Proposal 3: 1) Eliminates implied Singleton and EntitySet. These are now first class citizens in all cases. 2) Simplifies specifications since containment NavigationProperty is eliminated. 3) Clarifies whether or not a value may be omitted. Proposal 4: 1) Add EntityProperty, with same syntax and semantics as Property except that Type must be an EntityType. 2) Allow use of EntityProperty in the context of EntityContainer, EntityType, or ComplexType. 3) Deprecate the ContainsTarget attribute. 4) Deprecate Singleton and EntitySet 5) Modify syntax of NavigationProperty to only reference EntityProperties. The advantages of Proposal 3: 1) Eliminates Singleton and EntitySet. These are now first class EntityProperty elements in all cases. 2) Eliminates need for ContainsTarget attribute and therefore the concept of containment NavigationProperty. 3) Rationalizes the syntax differences between Singleton, EntitySet, and NavigationProperty around Property. 4) Simplifies semantics of NavigationProperty as an association. 5) Clarifies whether or not a value may be omitted. Proposal 4: 1) Same as Proposal 3 except that instead of adding EntityProperty, instead extend Property to allow Type to be an EntityType. In this case, the spec might refer to an entity property as a Property with Type that is an EntityType. 2) Allow use of Property in the context of EntityContainer, EntityType, or ComplexType declarations. 3) Deprecate the ContainsTarget attribute. 4) Deprecate Singleton and EntitySet 5) Modify syntax of NavigationProperty to only reference entity properties. The advantages of Proposal 4: 1) Everything in Proposal 3. 2) Does not add a new metatype.

      Description

      There is significant confusion over the role and semantics of Singletons and EntitySets. For example, since Nullable is not an attribute, it is assumed that they must have a value, but implementors are also assuming that if a particular Singleton or EntitySet is not implemented, then a value need not be returned.

      Observations on Singletons and EntitySets from an OData metamodel point of view:
      1) A Singleton is a scalar Property with a Type that is an EntityType.
      2) An EntitySet is an array Property with a Type that is an EntityType.
      3) A NavigationProperty with ContainsTarget="True" is a scalar or array Property with a Type that is an EntityType.
      4) A NavigationProperty with ContainsTarget="False" is an association end with a Type that is an EntityType.

      The overlap of 1, 2, and 3 is a source of great confusion. Additionally the reasons for variations in semantics of these metatypes are not clear. (i.e. missing Nullable attribute.)

        Attachments

          Activity

            People

            • Assignee:
              george.ericson George Ericson
              Reporter:
              george.ericson George Ericson
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: