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

Clarify Referential Constraints have UpdateRule=Cascade semantics

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_CS01
    • Fix Version/s: V4.0_CSD03
    • Component/s: Protocol
    • Labels:
      None
    • Environment:

      [Applied]

    • Proposal:
      Hide

      Clarify that:
      1. Dependent properties that rely on non-key principle properties are ignored on update.
      2. Updating a dependent property that relies on key principle properties effectively updates the relationship as long as a related entity with the specified key value(s) exists; otherwise the update fails.
      3. If both a bind operation and a property value dependent upon a key of the principle of the same navigation are specified in an update payload, the bind operation "wins" and the dependent property is ignored.
      4. Changes to non-key principle properties "cascade" to all dependent entities
      5. If a nav prop is null, then the dependent property is null
      6. Having a nullable nav prop implies the dependent property is nullable. It is an error if it is declared as nullable="false"
      7. Having a non-nullable nav prop with a non-nullable principle property requires that the corresponding dependent property is defined with nullable="false"
      8. For purposes of PUT, the default value for dependent properties is the value of the principle property (i.e., they don't get reset). Make sure it's clear that all dependent properties are defaulted to properties of the principle on POST.

      Accepted: https://www.oasis-open.org/committees/download.php/50877/odata-meeting-54_on-20131001-minutes.html#odata-490

      Show
      Clarify that: 1. Dependent properties that rely on non-key principle properties are ignored on update. 2. Updating a dependent property that relies on key principle properties effectively updates the relationship as long as a related entity with the specified key value(s) exists; otherwise the update fails. 3. If both a bind operation and a property value dependent upon a key of the principle of the same navigation are specified in an update payload, the bind operation "wins" and the dependent property is ignored. 4. Changes to non-key principle properties "cascade" to all dependent entities 5. If a nav prop is null, then the dependent property is null 6. Having a nullable nav prop implies the dependent property is nullable. It is an error if it is declared as nullable="false" 7. Having a non-nullable nav prop with a non-nullable principle property requires that the corresponding dependent property is defined with nullable="false" 8. For purposes of PUT, the default value for dependent properties is the value of the principle property (i.e., they don't get reset). Make sure it's clear that all dependent properties are defaulted to properties of the principle on POST. Accepted: https://www.oasis-open.org/committees/download.php/50877/odata-meeting-54_on-20131001-minutes.html#odata-490
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/50900/odata-v4.0-wd04-part1-protocol-2013-10-03.docx https://www.oasis-open.org/committees/download.php/50904/odata-v4.0-wd04-part3-csdl-2013-10-03.docx Accepted: https://www.oasis-open.org/committees/download.php/50924/odata-meeting-55_on-20131003-minutes.html#odata-490

      Description

      The current specification defines referential constraints that specify properties of the dependent entity must be the same as the corresponding properties of the principle entity. This is similar to a foreign key in a database which specifies that the property of a dependent row must match the (typically primary key) properties of a row in the principle table. Foreign keys in a database are defined through Referential Constraints which have a DeleteRule and an UpdateRule that specify what happens to dependent rows when the principle row is deleted or updated.

      In OData, the referential constraint implicitly includes the navigation property which enforces the uniqueness constraint required in relational databases. This allows us to define referential constraints on sets of properties that may not be unique outside of the implicitly added to 0..1 navigation property.

      In OData we also define an OnDelete rule that specifies what happens if the principle entity is deleted. However, we don't define an UpdateRule. We also don't say what happens if the client tries to update a dependent property (which would be an error if they didn't at the same time change the navigation property to point to a principle entity with the same value).

      The reasonable behavior would be for updates to the dependent properties to be ignored by the service and for updates to the referenced property in the primary entity to "cascade" to the dependent entities. This fits well with the denormalization scenario we were trying to support in allowing the referential constraint to support non-key properties. We even imply this strongly in the insert case by saying that dependent properties may be omitted and must be ignored by the service in inserting a new entity, we just are not as clear in the updating section, when we talk about omitting "key and non-updatable properties" that this includes dependent properties defined within a referential constraint.

        Attachments

          Activity

            People

            • Assignee:
              mikep Michael Pizzo (Inactive)
              Reporter:
              mikep Michael Pizzo (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: