OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: ODATA listExpr grammar and edge cases


I am trying to understand how to parse and process edge cases for ODATA listExpr:

 

  listExpr  = OPEN BWS commonExpr BWS *( COMMA BWS commonExpr BWS ) CLOSE

 

Are empty listExpr supported?

The ODATA ABNF grammar does not seem to allow an empty list. I don’t see anything in commonExpr that allows the empty value, so it seems a list must have at least one element. Is my interpretation correct?

 

Example:

  city IN ()   # This is not valid ODATA

That _expression_ would always return false.

 

Disambiguation between listExpr and parenExpr

The ABNF grammar defines commonExpr as:

  commonExpr = ( primitiveLiteral
             …
             / parenExpr 
             / listExpr

 

I am observing an _expression_ can match both parenExpr and listExpr when the _expression_ contains a single item, for example “(123)”.

As per ODATA ABNF grammar, parenExpr takes precedence, correct? That’s because per RFC 5234, elements enclosed in parentheses are treated as a single element,  whose contents are strictly ordered.

 

# Example 1:

(1, 2) IN ( (1, 2), (1, 2, 3), (4, 5) )

Both the left and right operands are a listExpr. The right operand is a list of lists.

There is no ambiguity between listExpr and parenExpr.

 

# Example 2:

(4) IN ( 1, 2, 3, 4 )

The left operand is a parenExpr. The right operand is a listExpr.

 

# Example 3:

(4) IN ( (1, 2), (1, 2, 3), (4) )

The right operand is a listExpr. Inside the list, (1, 2) and (1, 2, 3) are a listExpr; (4) is a parenExpr

The left operand is a parenExpr.

 

# Example 4:

(1, 2) IN MyValues

The left operand is a listExpr. If MyValues is a list of lists, then the result will be true if MyValues contains the list (1, 2)

 

ListExpr containing one item

Is there a way to write a listExpr containing a single literal value?

 

# Example:

(1) IN MyValues

 

How can you create a listExpr containing the single numerical value 1?

Suppose MyValues is a list of lists. Because (1) is interpreted as a parenExpr, the overall _expression_ will always return false.

 

Thank you. Sebastien



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]