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

Allow hierarchy filter functions for ancestors and descendants to return true for starting node

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: V4.0_CSD03
    • Fix Version/s: V4.0_CSD04
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      To stay downward compatible with the current spec, the parameter default value must be false.

      Extend the current definitions (additions are enclosed in *):

      <Function Name="isdescendant" IsBound="true">
      <Annotation Term="Core.Description" String="Returns true, if and only if the value of the node property of the specified hierarchy is a descendant of the given parent node with a distance of less than or equal to the optionally specified maximum distance"/>
      <Parameter Name="Entity" Type="Edm.EntityType" Nullable="false"/>
      <Parameter Name="Hierarchy" Type="Edm.String" Nullable="false"/>
      <Parameter Name="Node" Type="Edm.PrimitiveType" Nullable="false"/>
      <Parameter Name="MaxDistance" Type="Edm.Int16"/>
      *
      <Parameter Name="IncludeParent" Type="Edm.Boolean">
      <Annotation Term="Core.OptionalParameter">
      <PropertyValue Property="DefaultValue" String="false"/>
      </Annotation>
      </Parameter>
      *
      <ReturnType Type="Edm.Boolean"/>
      </Function>

      <Function Name="isancestor" IsBound="true">
      <Annotation Term="Core.Description" String="Returns true, if and only if the value of the node property of the specified hierarchy is an ancestor of the given child node with a distance of less than or equal to the optionally specified maximum distance"/>
      <Parameter Name="Entity" Type="Edm.EntityType" Nullable="false"/>
      <Parameter Name="Hierarchy" Type="Edm.String" Nullable="false"/>
      <Parameter Name="Node" Type="Edm.PrimitiveType" Nullable="false"/>
      <Parameter Name="MaxDistance" Type="Edm.Int16"/>
      <ReturnType Type="Edm.Boolean"/>
      *
      <Parameter Name="IncludeChild" Type="Edm.Boolean">
      <Annotation Term="Core.OptionalParameter">
      <PropertyValue Property="DefaultValue" String="false"/>
      </Annotation>
      </Parameter>
      *
      </Function>

      Note that term OptionalParameter has become available in the Core vocabulary with the work on OData version 4.01.

      add to proposal:

      • extend description by explanation of newly added parameter.
      Show
      To stay downward compatible with the current spec, the parameter default value must be false. Extend the current definitions (additions are enclosed in *): <Function Name="isdescendant" IsBound="true"> <Annotation Term="Core.Description" String="Returns true, if and only if the value of the node property of the specified hierarchy is a descendant of the given parent node with a distance of less than or equal to the optionally specified maximum distance"/> <Parameter Name="Entity" Type="Edm.EntityType" Nullable="false"/> <Parameter Name="Hierarchy" Type="Edm.String" Nullable="false"/> <Parameter Name="Node" Type="Edm.PrimitiveType" Nullable="false"/> <Parameter Name="MaxDistance" Type="Edm.Int16"/> * <Parameter Name="IncludeParent" Type="Edm.Boolean"> <Annotation Term="Core.OptionalParameter"> <PropertyValue Property="DefaultValue" String="false"/> </Annotation> </Parameter> * <ReturnType Type="Edm.Boolean"/> </Function> <Function Name="isancestor" IsBound="true"> <Annotation Term="Core.Description" String="Returns true, if and only if the value of the node property of the specified hierarchy is an ancestor of the given child node with a distance of less than or equal to the optionally specified maximum distance"/> <Parameter Name="Entity" Type="Edm.EntityType" Nullable="false"/> <Parameter Name="Hierarchy" Type="Edm.String" Nullable="false"/> <Parameter Name="Node" Type="Edm.PrimitiveType" Nullable="false"/> <Parameter Name="MaxDistance" Type="Edm.Int16"/> <ReturnType Type="Edm.Boolean"/> * <Parameter Name="IncludeChild" Type="Edm.Boolean"> <Annotation Term="Core.OptionalParameter"> <PropertyValue Property="DefaultValue" String="false"/> </Annotation> </Parameter> * </Function> Note that term OptionalParameter has become available in the Core vocabulary with the work on OData version 4.01. add to proposal: extend description by explanation of newly added parameter.
    • Resolution:
      Show
      https://github.com/oasis-tcs/odata-vocabularies/pull/77

      Description

      The current definitions of the two hierarchy filter functions isancestor and isdescendant specify that the functions return true only if the current entity is a strict ancestor/descendant of the given start node.

      Practical applications sometimes require the start node to be included in the result. For this purpose, both functions could be extended by an optional Boolean parameter that allows the OData client to specify, if the start node shall be included in the result. With this, the filter expression $it/Aggregation.isdescendant(Hierarchy='SalesOrgHierarchy',Node='EMEA',IncludeParent=”true”) could avoid the clumsier $it/Aggregation.isdescendant(Hierarchy='SalesOrgHierarchy',Node='EMEA') or ID eq 'EMEA'

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gerald.krause1 Gerald Krause
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: