[ 
https://issues.apache.org/jira/browse/OLINGO-730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14696807#comment-14696807
 ] 

Christian Holzer commented on OLINGO-730:
-----------------------------------------

Hi,

thanks for your bug report. Great job. 

1.) You are absolutely right the intention was to provide alternatives and in 
those cases the wrong sign was used.
        I was concerned about the percent decoded values in the grammar, I 
supposed that double percent decoding could be possible.
{code}
        e.g. ESAllPrim%252832767%29 => ESAllPrim%2832767) => ESAllPrim(32767)
{code}
        The "OData Version 4.0 Part 2: URL Conventions Plus Errata 02" says 
that 
                - {quote}"Percent-decode path segments, query option names, and 
query option values exactly once"{quote}
                - and also {quote} "...that the rules in OData-ABNF assume that 
URIs and URI parts have been percent-encoding normalized"        {quote}        
        In this case normalized means that the there is no unnecessary percent 
encoding. Up to the sum, the percent encoded values
        have to be removed to prevent double decoding.

2.) Yes, you are right this is absolutely a valid point but it`s a little bit 
more complicated.
    Especially this grammar rule describes syntactically more than your 
mentioned use case (Entity Sets, Navigation Properties, Functions Imports,...)
        The semantic validation is done in the class UriParseTreeVisitor, so I 
found the following bugs:
                - EntitySets can have more than one Key Predicate e.g.{code} 
ESAllPrim(32767)(1)(2){code}
                - Expand allows Key Predicates e.g. {code} 
ESAllPrim(0)?$expand=NavPropertyETTwoPrimMany(-365)($filter=PropertyString eq 
'Test String1') {code}
                - Lambda expression can be applied to collection valued 
navigation properties with key predicate 
                  e.g. {code} 
ESAllPrim?$filter=NavPropertyETTwoPrimMany(1)/all(d:d/PropertyInt16 eq 0) {code}
                - Navigation allows more than one Key Predicate e.g. {code} 
ESAllPrim(1)/NavPropertyETTwoKeyNavMany(PropertyInt=1,PropertyString='2')(PropertyInt=1,PropertyString='2')
 {code}
                
                But in some other cases two adjacent "Key Predicates" can 
occur. e.g. Function Import which returns an entity set
                The first pair of brackets contains the parameters and the 
second pair the key predicates.
                        {code} 
FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3'){code}
 
                        
3.) Currently $search is not implemented. In the grammar file are some rules 
addressing $search, but there is no semantic validation and further handling.
    So making $search work is a new feature and currently not planed =(
        
Kind regards
Christian       
        

> UriLexer.g4 and UriParser.g4 grammar mistake
> --------------------------------------------
>
>                 Key: OLINGO-730
>                 URL: https://issues.apache.org/jira/browse/OLINGO-730
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.0.0-beta-03
>         Environment: MAC OSX 10.8
> ANTLR 4.1
>            Reporter: Fang Yimeng
>            Assignee: Christian Holzer
>            Priority: Minor
>
> 1. UriLexer.g4 line 74-79:
>       //JSON support 
>       BEGIN_OBJECT : WS*('{'/'%7B')WS*;
>       END_OBJECT : WS*('}'/'%7D')WS*;
>       BEGIN_ARRAY : WS*('['/'%5B')WS*;
>       END_ARRAY :WS*(']'/'%5D')WS*;
> I think '/' here means alternative, should '/' is replaced with '|'?
> 2. UriParser.g4 line 66:
>       pathSegment         : vNS=namespace? vODI=odataIdentifier 
> vlNVO+=nameValueOptList*;
> I read the ABNF of 
> OData4(http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/abnf/odata-abnf-construction-rules.txt),
>  and find out each pathSegment should only has one nameValueOptList, for the 
> reason that: 
>       collectionNavPath    = keyPredicate [ singleNavigation ]
> so should line 66 be like this:
>       pathSegment         : vNS=namespace? vODI=odataIdentifier 
> vlNVO=nameValueOptList?;
> 3. When I trying odata string like this: User?$expand=Friends($search=a), I 
> got error showing me that "$search" is invalid. This is caused by needing 
> SEARCH while presenting SEARCHINLINE. We can modify UriParser.g4 like this:
> expandCountOption   : filter | searchInline;
> and modify UriLexer.g4 like this:
> SEARCHWORD: ('a'..'z'|'A'..'Z')+ ->popMode;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to