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

Merge TypeAnnotation and ValueAnnotation into Annotation

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_WD01
    • Fix Version/s: V4.0_WD01
    • Component/s: CSDL XML
    • Labels:
      None
    • Environment:

      [Proposed]

      Description

      Currently we can annotate anything using a ValueAnnotation, and ValueTerms can be of any type except EntityType and Collection(EntityType). We can in addition annotate entity types and complex types with a TypeAnnotation, and these can be of complex type or entity type.

      So for complex-type annotations we have to choose between a ValueAnnotation using a ValueTerm of that complex type, or a TypeAnnotation using the complex type directly.

      From the expressiveness there's no difference. The value annotation will look like

      <ValueAnnotation Term="MyComplexTerm">
      <Record>
      <PropertyValue Name="FirstProperty" String="Constant value" />
      <PropertyValue Name="SecondProperty" Path="SomePropertyInTheAnnotatedType" />
      </Record>
      </ValueAnnotation>

      The type annotation will look like

      <TypeAnnotation Term="MyComplexTerm">
      <PropertyValue Name="FirstProperty" String="Constant value" />
      <PropertyValue Name="SecondProperty" Path="SomePropertyInTheAnnotatedType" />
      </TypeAnnotation>

      The similarity is striking: just strike the <Record> and replace the prefix "Value" with "Type".

      If the annotation on an instance basis deviates from the metadata "default", the representation in Atom and JSON is already identical for both cases.

      The only difference is that with a type annotation the server expresses the opinion that the original instance can be "cast" to the annotation's type, while with a value annotation the original instance can be "projected" to the annotation's type.

      From a data perspective there's no difference between the two, and the "cast" versus "project" choice is anyway ultimately left to the client. So this difference in opinion can be expressed as an annotation on the term definition.

        Attachments

          Activity

            People

            • Assignee:
              handl Ralf Handl
              Reporter:
              handl Ralf Handl
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: