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

Annotations: introduce path segment to address the count of a collection

    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

      Annotations: introduce path segment to address the count of a collection: We could use /$count or @odata.count.
      The first is consistent with URL rules, the second with odata.mediaContentType etc. that we introduced recently in ODATA-227.

      <?xml version="1.0" encoding="utf-8"?>
      <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
      <edmx:Reference Url="http://services.odata.org/V3/OData/OData.svc/$metadata" />
      <edmx:DataServices>
      <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="CountSample" Alias="CS">

      <Term Name="MostImportantDataFields" Type="Collection(CS.DataFieldType)" />
      <ComplexType Name="DataFieldType">
      <Property Name="Label" Type="String" Nullable="true" />
      <Property Name="Value" Type="Edm.PrimitiveType" Nullable="false" />
      <Property Name="NavigationPath" Type="Edm.NavigationPropertyPath" Nullable="true" />
      </ComplexType>

      <Annotations Target="ODataDemo.Category">
      <Annotation Term="CS.MostImportantDataFields">
      <Collection>
      <Record>
      <PropertyValue Property="Label" String="Category Name" />
      <PropertyValue Property="Value" Path="Name" />
      </Record>
      <Record>
      <PropertyValue Property="Label" String="Numbers of Products related to this Category" />
      <!-- Alternative 1 -->
      <PropertyValue Property="Value" Path="Products/$count" /> <!-- see $orderby and $filter -->
      <!-- Alternative 2 -->
      <PropertyValue Property="Value" Path="Products/@odata.count" /><!-- see CSDL 16.2.10 The edm:Path Expression -->
      <PropertyValue Property="NavigationPath" NavigationPropertyPath="Products" />
      </Record>
      </Collection>
      </Annotation>
      </Annotations>
      </Schema>
      </edmx:DataServices>
      </edmx:Edmx>

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: