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

Path evaluation for annotations targeting annotations

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: V4.01_OS
    • Fix Version/s: V4.01_ERRATA01
    • Component/s: CSDL JSON , CSDL XML
    • Labels:
      None
    • Environment:

      Proposed

    • Proposal:
      Hide

      Insert two paragraphs into the "Path evaluation" section (shown indented below):

      For annotations embedded within a structural or navigation property of an entity type or complex type, the path is evaluated starting at the directly enclosing type. This allows e.g. specifying the value of an annotation on one property to be calculated from values of other properties of the same type. An empty path resolves to the enclosing type, and non-empty paths MUST follow the rules for annotations targeting the directly enclosing type.

      For annotations embedded within an annotation that is embedded within an entity type or complex type, the path is evaluated starting at that type. Annotations of a type are thus treated like properties.

      For annotations targeting a structural or navigation property of an entity type or complex type, the path is evaluated starting at the outermost entity type or complex type named in the target of the annotation, i.e. an empty path resolves to the outermost type, and the first segment of a non-empty path MUST be a structural or navigation property of the outermost type, a type cast, or a term cast.

      For annotations embedded within an annotation that is targeting an entity type or complex type, and for annotations targeting an annotation of an entity type or complex type, the path is evaluated starting at the outermost entity type or complex type named in the target.

      Show
      Insert two paragraphs into the "Path evaluation" section (shown indented below): For annotations embedded within a structural or navigation property of an entity type or complex type, the path is evaluated starting at the directly enclosing type. This allows e.g. specifying the value of an annotation on one property to be calculated from values of other properties of the same type. An empty path resolves to the enclosing type, and non-empty paths MUST follow the rules for annotations targeting the directly enclosing type. For annotations embedded within an annotation that is embedded within an entity type or complex type, the path is evaluated starting at that type. Annotations of a type are thus treated like properties. For annotations targeting a structural or navigation property of an entity type or complex type, the path is evaluated starting at the  outermost  entity type or complex type named in the target of the annotation, i.e. an empty path resolves to the outermost type, and the first segment of a non-empty path MUST be a structural or navigation property of the outermost type, a  type cast , or a  term cast . For annotations embedded within an annotation that is targeting an entity type or complex type, and for annotations targeting an annotation of an entity type or complex type, the path is evaluated starting at the outermost entity type or complex type named in the target.

      Description

      OData-CSDL, section "Path evaluation" does not specify rules for annotations that target another annotation.

      Imagine an annotation term PAngV.PriceSection2 whose value is an amount.

      <EntityType Name="SalesOrderItem">
       <Property Name="Pieces" Type="Edm.Int"/>
       <Property Name="Price" Type="Edm.Decimal"/>
       <Annotation Term="PAngV.PriceSection2">
        <DivBy>
         <Path>Price</Path>
         <Path>Pieces</Path>
        </DivBy>
        <Annotation Term="Measures.ISOCurrency">
         <Path>Price/@Measures.ISOCurrency</Path>
        </Annotation>
       </Annotation>
      </EntityType>
      

      This entity type computes the PAngV.PriceSection2 as an annotation and wants to annotate this annotation with the corresponding currency. I would expect the evaluation of the path Price/@Measures.ISOCurrency to follow the rules for "annotations embedded within a structural or navigation property of an entity type or complex type", because the "outer" annotation has a primitive type.

      This should be clarified in the specification.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              heiko.theissen Heiko Theissen
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: