You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Riccardo Mariani <ma...@gmail.com> on 2015/12/05 10:55:24 UTC

questions

Hi Olingo users,

I'm using Olingo v4.
I've a couple of questions:

 1.   I need to know the version (x.x.x) of my webapp implementing the
    odata service.
    Is there a standard/common way to get the webapp version in odata?
    Currently I implemented an odata function webappVersion() which
    returns the version x.x.x as a string.

 2. I would need to execute a query conceptually similar to the following:
    entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count*($filter=XXX)*

    Right now the bold part is not accepted by odata.
    The idea of the query is: I want to order the entitySet by the
    navigationProperty/$count *filtering the navigationProperty set*.
    Without the bold part I suppose I'm ordering the entitySet by
    navigationProperty/$count *without* *filtering the
    navigationProperty set*.
    Does it exist a standard way to obtain the result I want?

    A solution I thought could be the use of a custom function like in
    the following example:
    entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
    What the best way is?

Thanks a lot for the help!

Riccardo.


Re: questions

Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Ralf,

Thanks a lot.
I appreciated your reply.

Riccardo.


On 17/12/15 15:57, Handl, Ralf wrote:
>
> Hi Riccardo,
>
> In this case I’d use an annotation in $metadata, this is simpler than 
> having a function:
>
> <Schema Namespace=…>
>
> <Annotation Term="SomeAlias.ImplementationVersion" Int="42" />
>
> …
>
> </Schema>
>
> Your second question is also quite interesting. It would seem natural 
> to write
>
> GET 
> entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count($filter=XXX)
>
> I’ve created https://issues.oasis-open.org/browse/ODATA-897 to keep 
> track of that requirement for OData Version 4.01
>
> Thanks!
>
> --Ralf
>
> *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
> *Sent:* Mittwoch, 16. Dezember 2015 18:53
> *To:* Handl, Ralf <ra...@sap.com>; user@olingo.apache.org
> *Subject:* Re: questions
>
> Hi Ralf,
>
> it's just the version of the implementation behind the scenes, no 
> change on the service structure.
>
> Thanks,
> Riccardo.
>
> On 16/12/15 14:40, Handl, Ralf wrote:
>
>     Hi Riccardo,
>
>     Regarding “internal service version”: is that just the version of
>     the implementation behind the scenes, or will the service
>     structure ($metadata) also change between versions?
>
>     Thanks in advance!
>     --Ralf
>
>     *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
>     *Sent:* Freitag, 11. Dezember 2015 09:20
>     *To:* user@olingo.apache.org <ma...@olingo.apache.org>
>     *Subject:* Re: questions
>
>     Hi Christian,
>
>     Thanks for the reply.
>
>     Maybe I didn't understand your answer about the version problem.
>     It's not related to how I can get the version in code.
>     It's more related to how I can expose the version (I mean internal
>     service version, not odata version) to clients.
>
>     About the orderby option I understand the idea.
>     I suppose the result of the following query is to order by
>     unfiltered navigation property or is it illegal?
>     entitySet?$orderby=navigationProperty/$count
>
>     If I want to order by a filtered navigation property then the only
>     solution is the following one, where I use a function?
>     entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)
>
>
>     Thanks a lot,
>     Riccardo.
>
>
>     On 09/12/15 14:48, Amend, Christian wrote:
>
>         Hi Riccardo,
>
>         for the Debug output we use the following code to get the
>         implementation version:
>
>         *final*Package pack= DebugResponseHelperImpl.*class*.getPackage();
>
>         *final*String name= pack.getImplementationTitle();
>
>         *final*String version= pack.getImplementationVersion();
>
>         *return*(name== *null*? "Olingo": name)
>
>                 + (version== *null*? "": " Version "+ version);
>
>         This only works when built with maven. Maven will fill the
>         manifest file to contain the version for us.
>
>         In order to filter the content of a navigation property and
>         order by it your URL would have to look something like this:
>
>         entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count
>
>         If you implement your service correctly than the orderby
>         statement must be performed after you filtered the data. Then
>         you get the correct output automatically. The order in which
>         system query options should be applied to your data set is as
>         follows:
>
>         Search
>
>         Filter
>
>         Count
>
>         OrderBy
>
>         Skip
>
>         Top
>
>         Best Regards,
>
>         Christian
>
>         *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
>         *Sent:* Samstag, 5. Dezember 2015 10:55
>         *To:* user@olingo.apache.org <ma...@olingo.apache.org>
>         *Subject:* questions
>
>         Hi Olingo users,
>
>         I'm using Olingo v4.
>         I've a couple of questions:
>
>          1.  I need to know the version (x.x.x) of my webapp
>             implementing the odata service.
>             Is there a standard/common way to get the webapp version
>             in odata?
>             Currently I implemented an odata function webappVersion()
>             which returns the version x.x.x as a string.
>          2. I would need to execute a query conceptually similar to
>             the following:
>             entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count*($filter=XXX)*
>
>             Right now the bold part is not accepted by odata.
>             The idea of the query is: I want to order the entitySet by
>             the navigationProperty/$count *filtering the
>             navigationProperty set*.
>             Without the bold part I suppose I'm ordering the entitySet
>             by navigationProperty/$count *without* *filtering the
>             navigationProperty set*.
>             Does it exist a standard way to obtain the result I want?
>
>             A solution I thought could be the use of a custom function
>             like in the following example:
>             entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
>             What the best way is?
>
>         Thanks a lot for the help!
>
>         Riccardo.
>


RE: questions

Posted by "Handl, Ralf" <ra...@sap.com>.
Hi Riccardo,



In this case I’d use an annotation in $metadata, this is simpler than having a function:



              <Schema Namespace=…>

                            <Annotation Term="SomeAlias.ImplementationVersion" Int="42" />

                           …

              </Schema>



Your second question is also quite interesting. It would seem natural to write



GET entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count($filter=XXX)



I’ve created https://issues.oasis-open.org/browse/ODATA-897 to keep track of that requirement for OData Version 4.01



Thanks!

--Ralf



From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Mittwoch, 16. Dezember 2015 18:53
To: Handl, Ralf <ra...@sap.com>; user@olingo.apache.org
Subject: Re: questions



Hi Ralf,

it's just the version of the implementation behind the scenes, no change on the service structure.

Thanks,
Riccardo.

On 16/12/15 14:40, Handl, Ralf wrote:

   Hi Riccardo,



   Regarding “internal service version”: is that just the version of the implementation behind the scenes, or will the service structure ($metadata) also change between versions?



   Thanks in advance!
   --Ralf



   From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
   Sent: Freitag, 11. Dezember 2015 09:20
   To: user@olingo.apache.org<ma...@olingo.apache.org>
   Subject: Re: questions



   Hi Christian,

   Thanks for the reply.

   Maybe I didn't understand your answer about the version problem.
   It's not related to how I can get the version in code.
   It's more related to how I can expose the version (I mean internal service version, not odata version) to clients.

   About the orderby option I understand the idea.
   I suppose the result of the following query is to order by unfiltered navigation property or is it illegal?
   entitySet?$orderby=navigationProperty/$count

   If I want to order by a filtered navigation property then the only solution is the following one, where I use a function?
   entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)


   Thanks a lot,
   Riccardo.




   On 09/12/15 14:48, Amend, Christian wrote:

      Hi Riccardo,



      for the Debug output we use the following code to get the implementation version:

          final Package pack = DebugResponseHelperImpl.class.getPackage();

          final String name = pack.getImplementationTitle();

          final String version = pack.getImplementationVersion();

          return (name == null ? "Olingo" : name)

              + (version == null ? "" : " Version " + version);

      This only works when built with maven. Maven will fill the manifest file to contain the version for us.



      In order to filter the content of a navigation property and order by it your URL would have to look something like this:

      entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count



      If you implement your service correctly than the orderby statement must be performed after you filtered the data. Then you get the correct output automatically. The order in which system query options should be applied to your data set is as follows:

      Search

      Filter

      Count

      OrderBy

      Skip

      Top



      Best Regards,

      Christian



      From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
      Sent: Samstag, 5. Dezember 2015 10:55
      To: user@olingo.apache.org<ma...@olingo.apache.org>
      Subject: questions



      Hi Olingo users,

      I'm using Olingo v4.
      I've a couple of questions:

      1.         I need to know the version (x.x.x) of my webapp implementing the odata service.
      Is there a standard/common way to get the webapp version in odata?
      Currently I implemented an odata function webappVersion() which returns the version x.x.x as a string.
      2.        I would need to execute a query conceptually similar to the following:
      entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count($filter=XXX)

      Right now the bold part is not accepted by odata.
      The idea of the query is: I want to order the entitySet by the navigationProperty/$count filtering the navigationProperty set.
      Without the bold part I suppose I'm ordering the entitySet by navigationProperty/$count without filtering the navigationProperty set.
      Does it exist a standard way to obtain the result I want?

      A solution I thought could be the use of a custom function like in the following example:
      entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
      What the best way is?

      Thanks a lot for the help!

      Riccardo.






Re: questions

Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Ralf,

it's just the version of the implementation behind the scenes, no change 
on the service structure.

Thanks,
Riccardo.

On 16/12/15 14:40, Handl, Ralf wrote:
>
> Hi Riccardo,
>
> Regarding “internal service version”: is that just the version of the 
> implementation behind the scenes, or will the service structure 
> ($metadata) also change between versions?
>
> Thanks in advance!
> --Ralf
>
> *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
> *Sent:* Freitag, 11. Dezember 2015 09:20
> *To:* user@olingo.apache.org
> *Subject:* Re: questions
>
> Hi Christian,
>
> Thanks for the reply.
>
> Maybe I didn't understand your answer about the version problem.
> It's not related to how I can get the version in code.
> It's more related to how I can expose the version (I mean internal 
> service version, not odata version) to clients.
>
> About the orderby option I understand the idea.
> I suppose the result of the following query is to order by unfiltered 
> navigation property or is it illegal?
> entitySet?$orderby=navigationProperty/$count
>
> If I want to order by a filtered navigation property then the only 
> solution is the following one, where I use a function?
> entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)
>
>
> Thanks a lot,
> Riccardo.
>
> On 09/12/15 14:48, Amend, Christian wrote:
>
>     Hi Riccardo,
>
>     for the Debug output we use the following code to get the
>     implementation version:
>
>     *final*Package pack= DebugResponseHelperImpl.*class*.getPackage();
>
>     *final*String name= pack.getImplementationTitle();
>
>     *final*String version= pack.getImplementationVersion();
>
>     *return*(name== *null*? "Olingo": name)
>
>             + (version== *null*? "": " Version "+ version);
>
>     This only works when built with maven. Maven will fill the
>     manifest file to contain the version for us.
>
>     In order to filter the content of a navigation property and order
>     by it your URL would have to look something like this:
>
>     entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count
>
>     If you implement your service correctly than the orderby statement
>     must be performed after you filtered the data. Then you get the
>     correct output automatically. The order in which system query
>     options should be applied to your data set is as follows:
>
>     Search
>
>     Filter
>
>     Count
>
>     OrderBy
>
>     Skip
>
>     Top
>
>     Best Regards,
>
>     Christian
>
>     *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
>     *Sent:* Samstag, 5. Dezember 2015 10:55
>     *To:* user@olingo.apache.org <ma...@olingo.apache.org>
>     *Subject:* questions
>
>     Hi Olingo users,
>
>     I'm using Olingo v4.
>     I've a couple of questions:
>
>      1.  I need to know the version (x.x.x) of my webapp implementing
>         the odata service.
>         Is there a standard/common way to get the webapp version in odata?
>         Currently I implemented an odata function webappVersion()
>         which returns the version x.x.x as a string.
>      2. I would need to execute a query conceptually similar to the
>         following:
>         entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count*($filter=XXX)*
>
>         Right now the bold part is not accepted by odata.
>         The idea of the query is: I want to order the entitySet by the
>         navigationProperty/$count *filtering the navigationProperty set*.
>         Without the bold part I suppose I'm ordering the entitySet by
>         navigationProperty/$count *without* *filtering the
>         navigationProperty set*.
>         Does it exist a standard way to obtain the result I want?
>
>         A solution I thought could be the use of a custom function
>         like in the following example:
>         entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
>         What the best way is?
>
>     Thanks a lot for the help!
>
>     Riccardo.
>


RE: questions

Posted by "Handl, Ralf" <ra...@sap.com>.
Hi Riccardo,

Regarding “internal service version”: is that just the version of the implementation behind the scenes, or will the service structure ($metadata) also change between versions?

Thanks in advance!
--Ralf

From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Freitag, 11. Dezember 2015 09:20
To: user@olingo.apache.org
Subject: Re: questions

Hi Christian,

Thanks for the reply.

Maybe I didn't understand your answer about the version problem.
It's not related to how I can get the version in code.
It's more related to how I can expose the version (I mean internal service version, not odata version) to clients.

About the orderby option I understand the idea.
I suppose the result of the following query is to order by unfiltered navigation property or is it illegal?
entitySet?$orderby=navigationProperty/$count

If I want to order by a filtered navigation property then the only solution is the following one, where I use a function?
entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)


Thanks a lot,
Riccardo.

On 09/12/15 14:48, Amend, Christian wrote:
Hi Riccardo,

for the Debug output we use the following code to get the implementation version:
    final Package pack = DebugResponseHelperImpl.class.getPackage();
    final String name = pack.getImplementationTitle();
    final String version = pack.getImplementationVersion();
    return (name == null ? "Olingo" : name)
        + (version == null ? "" : " Version " + version);
This only works when built with maven. Maven will fill the manifest file to contain the version for us.

In order to filter the content of a navigation property and order by it your URL would have to look something like this:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count

If you implement your service correctly than the orderby statement must be performed after you filtered the data. Then you get the correct output automatically. The order in which system query options should be applied to your data set is as follows:
Search
Filter
Count
OrderBy
Skip
Top

Best Regards,
Christian

From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Samstag, 5. Dezember 2015 10:55
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: questions

Hi Olingo users,

I'm using Olingo v4.
I've a couple of questions:

  1.   I need to know the version (x.x.x) of my webapp implementing the odata service.
Is there a standard/common way to get the webapp version in odata?
Currently I implemented an odata function webappVersion() which returns the version x.x.x as a string.
  2.  I would need to execute a query conceptually similar to the following:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count($filter=XXX)

Right now the bold part is not accepted by odata.
The idea of the query is: I want to order the entitySet by the navigationProperty/$count filtering the navigationProperty set.
Without the bold part I suppose I'm ordering the entitySet by navigationProperty/$count without filtering the navigationProperty set.
Does it exist a standard way to obtain the result I want?

A solution I thought could be the use of a custom function like in the following example:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
What the best way is?

Thanks a lot for the help!

Riccardo.


Re: questions

Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Christian,

thanks a lot for the reply.
It has been very helpful.


On 11/12/15 14:58, Amend, Christian wrote:
>
> Hi Riccardo,
>
> maybe you can introduce a singleton which will give you the service 
> version. Or if you are talking about the Data Specification Version 
> your server is providing you can use the OData-Version header.
>
> If I understand the URI ABNF correctly your first example is correct 
> and would order by the number of entities the navigation property 
> points to.
>
> The second example is incorrect. You can`t specify the filter 
> expression for an orderby expression by adding the ($filter=… ) 
> statement. You have to specify it alone:
>
> entitySet?filter=navigationProperty/$count eq 
> 2&$orderby=navigationProperty/$count
>
> entitySet?$expand=navigationProperty/$count& 
> filter=navigationProperty/$count eq 2&$orderby=navigationProperty/$count
>
> So you should not need a function to perform this behavior.
>
> Best Regards,
>
> Christian
>
> *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
> *Sent:* Freitag, 11. Dezember 2015 09:20
> *To:* user@olingo.apache.org
> *Subject:* Re: questions
>
> Hi Christian,
>
> Thanks for the reply.
>
> Maybe I didn't understand your answer about the version problem.
> It's not related to how I can get the version in code.
> It's more related to how I can expose the version (I mean internal 
> service version, not odata version) to clients.
>
> About the orderby option I understand the idea.
> I suppose the result of the following query is to order by unfiltered 
> navigation property or is it illegal?
> entitySet?$orderby=navigationProperty/$count
>
> If I want to order by a filtered navigation property then the only 
> solution is the following one, where I use a function?
> entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)
>
>
> Thanks a lot,
> Riccardo.
>
> On 09/12/15 14:48, Amend, Christian wrote:
>
>     Hi Riccardo,
>
>     for the Debug output we use the following code to get the
>     implementation version:
>
>     *final*Package pack= DebugResponseHelperImpl.*class*.getPackage();
>
>     *final*String name= pack.getImplementationTitle();
>
>     *final*String version= pack.getImplementationVersion();
>
>     *return*(name== *null*? "Olingo": name)
>
>     + (version== *null*? "": " Version "+ version);
>
>     This only works when built with maven. Maven will fill the
>     manifest file to contain the version for us.
>
>     In order to filter the content of a navigation property and order
>     by it your URL would have to look something like this:
>
>     entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count
>
>     If you implement your service correctly than the orderby statement
>     must be performed after you filtered the data. Then you get the
>     correct output automatically. The order in which system query
>     options should be applied to your data set is as follows:
>
>     Search
>
>     Filter
>
>     Count
>
>     OrderBy
>
>     Skip
>
>     Top
>
>     Best Regards,
>
>     Christian
>
>     *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
>     *Sent:* Samstag, 5. Dezember 2015 10:55
>     *To:* user@olingo.apache.org <ma...@olingo.apache.org>
>     *Subject:* questions
>
>     Hi Olingo users,
>
>     I'm using Olingo v4.
>     I've a couple of questions:
>
>      1.  I need to know the version (x.x.x) of my webapp implementing
>         the odata service.
>         Is there a standard/common way to get the webapp version in odata?
>         Currently I implemented an odata function webappVersion()
>         which returns the version x.x.x as a string.
>      2. I would need to execute a query conceptually similar to the
>         following:
>         entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count*($filter=XXX)*
>
>         Right now the bold part is not accepted by odata.
>         The idea of the query is: I want to order the entitySet by the
>         navigationProperty/$count *filtering the navigationProperty set*.
>         Without the bold part I suppose I'm ordering the entitySet by
>         navigationProperty/$count *without* *filtering the
>         navigationProperty set*.
>         Does it exist a standard way to obtain the result I want?
>
>         A solution I thought could be the use of a custom function
>         like in the following example:
>         entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
>         What the best way is?
>
>     Thanks a lot for the help!
>
>     Riccardo.
>


RE: questions

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Riccardo,

maybe you can introduce a singleton which will give you the service version. Or if you are talking about the Data Specification Version your server is providing you can use the OData-Version header.

If I understand the URI ABNF correctly your first example is correct and would order by the number of entities the navigation property points to.

The second example is incorrect. You can`t specify the filter expression for an orderby expression by adding the ($filter=… ) statement. You have to specify it alone:
entitySet?filter=navigationProperty/$count eq 2&$orderby=navigationProperty/$count
entitySet?$expand=navigationProperty/$count& filter=navigationProperty/$count eq 2&$orderby=navigationProperty/$count

So you should not need a function to perform this behavior.

Best Regards,
Christian


From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Freitag, 11. Dezember 2015 09:20
To: user@olingo.apache.org
Subject: Re: questions

Hi Christian,

Thanks for the reply.

Maybe I didn't understand your answer about the version problem.
It's not related to how I can get the version in code.
It's more related to how I can expose the version (I mean internal service version, not odata version) to clients.

About the orderby option I understand the idea.
I suppose the result of the following query is to order by unfiltered navigation property or is it illegal?
entitySet?$orderby=navigationProperty/$count

If I want to order by a filtered navigation property then the only solution is the following one, where I use a function?
entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)


Thanks a lot,
Riccardo.

On 09/12/15 14:48, Amend, Christian wrote:
Hi Riccardo,

for the Debug output we use the following code to get the implementation version:
    final Package pack = DebugResponseHelperImpl.class.getPackage();
    final String name = pack.getImplementationTitle();
    final String version = pack.getImplementationVersion();
    return (name == null ? "Olingo" : name)
        + (version == null ? "" : " Version " + version);
This only works when built with maven. Maven will fill the manifest file to contain the version for us.

In order to filter the content of a navigation property and order by it your URL would have to look something like this:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count

If you implement your service correctly than the orderby statement must be performed after you filtered the data. Then you get the correct output automatically. The order in which system query options should be applied to your data set is as follows:
Search
Filter
Count
OrderBy
Skip
Top

Best Regards,
Christian

From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Samstag, 5. Dezember 2015 10:55
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: questions

Hi Olingo users,

I'm using Olingo v4.
I've a couple of questions:

  1.   I need to know the version (x.x.x) of my webapp implementing the odata service.
Is there a standard/common way to get the webapp version in odata?
Currently I implemented an odata function webappVersion() which returns the version x.x.x as a string.
  2.  I would need to execute a query conceptually similar to the following:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count($filter=XXX)

Right now the bold part is not accepted by odata.
The idea of the query is: I want to order the entitySet by the navigationProperty/$count filtering the navigationProperty set.
Without the bold part I suppose I'm ordering the entitySet by navigationProperty/$count without filtering the navigationProperty set.
Does it exist a standard way to obtain the result I want?

A solution I thought could be the use of a custom function like in the following example:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
What the best way is?

Thanks a lot for the help!

Riccardo.


Re: questions

Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Christian,

Thanks for the reply.

Maybe I didn't understand your answer about the version problem.
It's not related to how I can get the version in code.
It's more related to how I can expose the version (I mean internal 
service version, not odata version) to clients.

About the orderby option I understand the idea.
I suppose the result of the following query is to order by unfiltered 
navigation property or is it illegal?
entitySet?$orderby=navigationProperty/$count

If I want to order by a filtered navigation property then the only 
solution is the following one, where I use a function?
entitySet?$orderby=navigationProperty/Alias.count($filter=XXX)


Thanks a lot,
Riccardo.


On 09/12/15 14:48, Amend, Christian wrote:
>
> Hi Riccardo,
>
> for the Debug output we use the following code to get the 
> implementation version:
>
> *final*Package pack= DebugResponseHelperImpl.*class*.getPackage();
>
> *final*String name= pack.getImplementationTitle();
>
> *final*String version= pack.getImplementationVersion();
>
> *return*(name== *null*? "Olingo": name)
>
> + (version== *null*? "": " Version "+ version);
>
> This only works when built with maven. Maven will fill the manifest 
> file to contain the version for us.
>
> In order to filter the content of a navigation property and order by 
> it your URL would have to look something like this:
>
> entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count
>
> If you implement your service correctly than the orderby statement 
> must be performed after you filtered the data. Then you get the 
> correct output automatically. The order in which system query options 
> should be applied to your data set is as follows:
>
> Search
>
> Filter
>
> Count
>
> OrderBy
>
> Skip
>
> Top
>
> Best Regards,
>
> Christian
>
> *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
> *Sent:* Samstag, 5. Dezember 2015 10:55
> *To:* user@olingo.apache.org
> *Subject:* questions
>
> Hi Olingo users,
>
> I'm using Olingo v4.
> I've a couple of questions:
>
>  1.  I need to know the version (x.x.x) of my webapp implementing the
>     odata service.
>     Is there a standard/common way to get the webapp version in odata?
>     Currently I implemented an odata function webappVersion() which
>     returns the version x.x.x as a string.
>  2. I would need to execute a query conceptually similar to the following:
>     entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count*($filter=XXX)*
>
>     Right now the bold part is not accepted by odata.
>     The idea of the query is: I want to order the entitySet by the
>     navigationProperty/$count *filtering the navigationProperty set*.
>     Without the bold part I suppose I'm ordering the entitySet by
>     navigationProperty/$count *without* *filtering the
>     navigationProperty set*.
>     Does it exist a standard way to obtain the result I want?
>
>     A solution I thought could be the use of a custom function like in
>     the following example:
>     entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
>     What the best way is?
>
> Thanks a lot for the help!
>
> Riccardo.
>


RE: questions

Posted by "Amend, Christian" <ch...@sap.com>.
Hi Riccardo,

for the Debug output we use the following code to get the implementation version:
    final Package pack = DebugResponseHelperImpl.class.getPackage();
    final String name = pack.getImplementationTitle();
    final String version = pack.getImplementationVersion();
    return (name == null ? "Olingo" : name)
        + (version == null ? "" : " Version " + version);
This only works when built with maven. Maven will fill the manifest file to contain the version for us.

In order to filter the content of a navigation property and order by it your URL would have to look something like this:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count

If you implement your service correctly than the orderby statement must be performed after you filtered the data. Then you get the correct output automatically. The order in which system query options should be applied to your data set is as follows:
Search
Filter
Count
OrderBy
Skip
Top

Best Regards,
Christian

From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Samstag, 5. Dezember 2015 10:55
To: user@olingo.apache.org
Subject: questions

Hi Olingo users,

I'm using Olingo v4.
I've a couple of questions:

  1.   I need to know the version (x.x.x) of my webapp implementing the odata service.
Is there a standard/common way to get the webapp version in odata?
Currently I implemented an odata function webappVersion() which returns the version x.x.x as a string.
  2.  I would need to execute a query conceptually similar to the following:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/$count($filter=XXX)

Right now the bold part is not accepted by odata.
The idea of the query is: I want to order the entitySet by the navigationProperty/$count filtering the navigationProperty set.
Without the bold part I suppose I'm ordering the entitySet by navigationProperty/$count without filtering the navigationProperty set.
Does it exist a standard way to obtain the result I want?

A solution I thought could be the use of a custom function like in the following example:
entitySet?$expand=navigationProperty/$count($filter=XXX)&$orderby=navigationProperty/Alias.count($filter=XXX)
What the best way is?

Thanks a lot for the help!

Riccardo.