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

Specify which nested query options can be used when expanding only references, and adapt syntax

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_WD01
    • Fix Version/s: V4.0_WD01
    • Component/s: ABNF, Protocol, URL Conventions
    • Labels:
      None
    • Environment:

      [Applied]

    • Proposal:
      Hide

      Change syntax to

      $epand=NavProp/$ref(<nested options>)

      and define a different set following $ref than the one directly following the navigation property:

      expand = '$expand' EQ expandItem *( COMMA expandItem )
      expandItem = [ qualifiedEntityTypeName "/" ] navigationProperty
      [ "/" qualifiedEntityTypeName ]
      [ ref OPEN expandRefOption *( SEMI expandRefOption ) CLOSE
      / OPEN expandOption *( SEMI expandOption ) CLOSE ]
      expandRefOption = filter
      / search
      / skip
      / top
      / inlinecount
      expandOption = expandRefOption
      / select
      / orderby
      / expand
      / levels

      Rationale: we now express in the ABNF what is meaningful and thus allowed after /$ref.

      Also this allows parsing from left to right.

      And putting /$ref before the parens makes it a bit more obvious. Just try reading

      $expand=Items($filter=something very complicated and lengthy and I'll only tell you afterwards that I only want)/$ref&andsoon

      Show
      Change syntax to $epand=NavProp/$ref(<nested options>) and define a different set following $ref than the one directly following the navigation property: expand = '$expand' EQ expandItem *( COMMA expandItem ) expandItem = [ qualifiedEntityTypeName "/" ] navigationProperty [ "/" qualifiedEntityTypeName ] [ ref OPEN expandRefOption *( SEMI expandRefOption ) CLOSE / OPEN expandOption *( SEMI expandOption ) CLOSE ] expandRefOption = filter / search / skip / top / inlinecount expandOption = expandRefOption / select / orderby / expand / levels Rationale: we now express in the ABNF what is meaningful and thus allowed after /$ref. Also this allows parsing from left to right. And putting /$ref before the parens makes it a bit more obvious. Just try reading $expand=Items($filter=something very complicated and lengthy and I'll only tell you afterwards that I only want)/$ref&andsoon
    • Resolution:
      Show
      https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/ABNF/odata-abnf-construction-rules-v4.0-wd01.txt?rev=253 https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/ABNF/odata-abnf-testcases.xml?rev=253 Accepted: https://www.oasis-open.org/committees/download.php/49055/odata-meeting-35_on-20130502-minutes.html#odata-345

      Description

      $expand allows nesting query options after the name of the navigation properties to be expanded.

      When expanding only references $select, $expand, and $levels don't make sense as neither structural nor navigation properties are represented in references.

        Attachments

          Activity

          ralfhandl Ralf Handl created issue -
          Hide
          hubert.heijkers Hubert Heijkers (Inactive) added a comment -

          Also see ODATA-340; wouldn't it make more sense to simply not allow $ref in expand but rather treat it as a 'special' property allowed in the $select? Could we even use in combination with other properties potentially?

          Show
          hubert.heijkers Hubert Heijkers (Inactive) added a comment - Also see ODATA-340 ; wouldn't it make more sense to simply not allow $ref in expand but rather treat it as a 'special' property allowed in the $select? Could we even use in combination with other properties potentially?
          Hide
          ralfhandl Ralf Handl added a comment -

          Originally it was a virtual property, but with ODATA-276 we changed it to a path suffix everywhere:

          GET ~/Orders(1)/Items/$ref
          GET ~/Orders?$expand=Items/$ref

          I like the similarity.

          Show
          ralfhandl Ralf Handl added a comment - Originally it was a virtual property, but with ODATA-276 we changed it to a path suffix everywhere: GET ~/Orders(1)/Items/$ref GET ~/Orders?$expand=Items/$ref I like the similarity.
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          I don't understand the issue with the current syntax NavProp(<nested options>)/$ref.

          $ref just means "return entity references in place of the entities". Like a cast operator. Some of the nested options ($filter in particular) are meaningful (I only want references for related entities that match a particular criteria). Some of the nested options aren't meaningful and may be optimized out ($expand, $select) but that's okay; they are well defined, just not useful if followed by a /$ref.

          Show
          mikep Michael Pizzo (Inactive) added a comment - I don't understand the issue with the current syntax NavProp(<nested options>)/$ref. $ref just means "return entity references in place of the entities". Like a cast operator. Some of the nested options ($filter in particular) are meaningful (I only want references for related entities that match a particular criteria). Some of the nested options aren't meaningful and may be optimized out ($expand, $select) but that's okay; they are well defined, just not useful if followed by a /$ref.
          ralfhandl Ralf Handl made changes -
          Field Original Value New Value
          Proposal Change syntax to

          $epand=NavProp/$ref(<nested options>)

          and define a different set following $ref than the one directly following the navigation property

          Rationale: this allows parsing from left to right. The current positioning of NavProp(...)/$ref makes that impossible, and is hard to read anyway.
          Change syntax to

          $epand=NavProp/$ref(<nested options>)

          and define a different set following $ref than the one directly following the navigation property:

          expand = '$expand' EQ expandItem *( COMMA expandItem )
          expandItem = [ qualifiedEntityTypeName "/" ] navigationProperty
                         [ "/" qualifiedEntityTypeName ]
                         [ ref OPEN expandRefOption *( SEMI expandRefOption ) CLOSE
                         / OPEN expandOption *( SEMI expandOption ) CLOSE ]
          expandRefOption = filter
                          / search
                          / skip
                          / top
                          / inlinecount
          expandOption = expandRefOption
                       / select
                       / orderby
                       / expand
                       / levels


          Rationale: we now express in the ABNF what is meaningful and thus allowed after /$ref.

          Also this allows parsing from left to right.

          And putting /$ref before the parens makes it a bit more obvious. Just try reading

          $expand=Items($filter=something very complicated and lengthy and I'll only tell you afterwards that I only want)/$ref&andsoon
          ralfhandl Ralf Handl made changes -
          Environment [Proposed] [Resolved]
          Status New [ 10000 ] Open [ 1 ]
          ralfhandl Ralf Handl made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          ralfhandl Ralf Handl made changes -
          Assignee Ralf Handl [ ralfhandl ]
          ralfhandl Ralf Handl made changes -
          Environment [Resolved] [Applied]
          handl Ralf Handl made changes -
          Reporter Ralf Handl [ ralfhandl ] Ralf Handl [ handl ]
          handl Ralf Handl made changes -
          Assignee Ralf Handl [ ralfhandl ] Ralf Handl [ handl ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: