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/08/10 18:05:06 UTC

odata v4 union of 2 entity sets

Hi all,
I'd like to have a suggestion on how to implement an odata v4 service 
that is able to execute the "union of 2 entity sets" in a single request.

Put simple:
- I've an entity set named Accounts.
- I could request for an EntityCollectionX using 
http://serviceRoot/Accounts?$filter=XXX
- I could request for an EntityCollectionY using 
http://serviceRoot/Accounts?$filter=YYY
- Then I could merge the responses on the client side.

I'd like to do something similar to this request 
http://serviceRoot/Union(Accounts?$filter=XXX, Accounts?$filter=YYY)
Where Union could be an odata function that takes as parameters 2 
requests that are the collections to merge.
(I know I could combine the filters but this is just an example I've a 
more complicated case)

It seems that odata doesn't provide a "standard way" to merge entity 
sets or it does ???
What's the best way to reach this objective ?

Thank you very much, Riccardo.

Re: odata v4 union of 2 entity sets

Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Ralf,
thank you very much!
Your response match exactly with what I meant.

I'm sorry if I did a too much simple example with the union operation
but a more concrete (still simple) example would be the following (using 
the difference operation):

You want entities in EntitySet1 that satisfy some conditions and some 
constraints.

So I could request
request1 = 
http://serviceRoot/EntitySet1?$filter=CONDITION1&*constraint=CONSTRAINT1
request2 = 
http://serviceRoot/EntitySet1?$filter=CONDITION2&*constraint=CONSTRAINT2<http://serviceRoot/Accounts?$filter=YYY>
where constraint is a custom query option,
and then I want request1.difference(request2)

The problem is that I cannot simply 
callhttp://serviceRoot/EntitySet1?$filter=CONDITION1 and (not 
CONDITION2)&*constraint=CONSTRAINT1<http://serviceRoot/Accounts?$filter=YYY> 
and (not CONSTRAINT2)
or something similar, because I want to apply each constraint to a 
condition separately.

I don't know if this example is more comprehensible.
I hope so :-)


On 11/08/15 14:52, Handl, Ralf wrote:
>
> Hi Riccardo,
>
> There’s no standard way of requesting the union of arbitrary OData 
> requests with custom query options etc.
>
> You can only define a function import that returns a collection of the 
> desired entity type, and explicitly model input parameters that allow 
> you to “encode” the list of requests that you want to combine.
>
> Or you can submit a batch request for the individual requests and 
> merge the results on the client.
>
> If you actually need the server to do the union /and /allow flexible 
> filter conditions on the source entity set, you might want to check 
> whether you can express your custom query options as part of $filter 
> with e.g. custom functions.
>
> Can you give an example for a “union” request that cannot be achieved 
> by just combining the filter conditions?
>
> Thanks in advance!
>
> --Ralf
>
> *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
> *Sent:* Dienstag, 11. August 2015 13:59
> *To:* user@olingo.apache.org
> *Subject:* Re: odata v4 union of 2 entity sets
>
> Thanks Ralf,
> I know I can apply boolean operators to the filter query option to 
> obtain a complex filter
> but as I've said in a previous email the problem is that the request 
> could be more complex (custom query options etc).
>
> So in general I'd like to be able to combine the result of 2 different 
> requests (on the same set) in the response to a single request .
> So I thought that a good way could be the use of an odata function, 
> something similar to http://host/service/Union(Accounts 
> <http://host/service/Union%28Accounts>, XXX, YYY).
>
>
>
> On 11/08/15 09:58, Handl, Ralf wrote:
>
>     In the example given below the union of
>
>     http://serviceRoot/Accounts?$filter=XXX
>
>     http://serviceRoot/Accounts?$filter=YYY
>
>     is
>
>     http://serviceRoot/Accounts?$filter=XXX  or YYY
>
>     *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
>     *Sent:* Dienstag, 11. August 2015 07:30
>     *To:* user@olingo.apache.org <ma...@olingo.apache.org>
>     *Subject:* Re: odata v4 union of 2 entity sets
>
>     Ok, odata doesn't support operations on sets such as union,
>     intersection and difference...
>     So what's the best way to implement such operations ?
>
>      1. http://host/service/Accounts?$filter=XXX&*filterUnion=YYY
>         where *filterUnion is a custom query option
>      2. http://host/service/Union(Accounts
>         <http://host/service/Union%28Accounts>, XXX, YYY))
>         where Union is an odata function
>      3. Can you suggest a better way ?
>
>     Thank you, Riccardo.
>
>     On 10/08/15 21:36, Ramesh Reddy wrote:
>
>         If you are really into data integration at this layer may be you want take look into Teiid (http://teiid.org  shameless plug, sorry) then use already built OData layer on top?
>
>           
>
>           
>
>         ----- Original Message -----
>
>             Hi Ramesh,
>
>             thank you very much for the response.
>
>               
>
>             Maybe I don't see the rationale but I still have 2 problems:
>
>             1) Suppose I use
>
>             http://host/service/$crossjoin(Accounts,Accounts)?$filter=
>             <http://host/service/$crossjoin%28Accounts,Accounts%29?$filter=>??? but I'm
>
>             not able to apply 2 different filters to the same Accounts set, I'm wrong?
>
>             2) I mentioned the union operation but I also need other operations on
>
>             sets such as intersection,difference etc... Could I perform the other
>
>             operations always using the $crossjoin?
>
>               
>
>               
>
>             On 10/08/15 18:25, Ramesh Reddy wrote:
>
>                 OData V4 does not have any "$union" feature currently. There is a
>
>                 "$crossjoin" feature.
>
>                 http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090
>
>                 may be you can use that?
>
>                   
>
>                 ----- Original Message -----
>
>                     Hi all,
>
>                     I'd like to have a suggestion on how to implement an odata v4 service
>
>                     that is able to execute the "union of 2 entity sets" in a single request.
>
>                       
>
>                     Put simple:
>
>                     - I've an entity set named Accounts.
>
>                     - I could request for an EntityCollectionX using
>
>                     http://serviceRoot/Accounts?$filter=XXX
>
>                     - I could request for an EntityCollectionY using
>
>                     http://serviceRoot/Accounts?$filter=YYY
>
>                     - Then I could merge the responses on the client side.
>
>                       
>
>                     I'd like to do something similar to this request
>
>                     http://serviceRoot/Union(Accounts?$filter=XXX
>                     <http://serviceRoot/Union%28Accounts?$filter=XXX>, Accounts?$filter=YYY)
>
>                     Where Union could be an odata function that takes as parameters 2
>
>                     requests that are the collections to merge.
>
>                     (I know I could combine the filters but this is just an example I've a
>
>                     more complicated case)
>
>                       
>
>                     It seems that odata doesn't provide a "standard way" to merge entity
>
>                     sets or it does ???
>
>                     What's the best way to reach this objective ?
>
>                       
>
>                     Thank you very much, Riccardo.
>
>                       
>
>               
>
>               
>


RE: odata v4 union of 2 entity sets

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

There’s no standard way of requesting the union of arbitrary OData requests with custom query options etc.

You can only define a function import that returns a collection of the desired entity type, and explicitly model input parameters that allow you to “encode” the list of requests that you want to combine.

Or you can submit a batch request for the individual requests and merge the results on the client.

If you actually need the server to do the union and allow flexible filter conditions on the source entity set, you might want to check whether you can express your custom query options as part of $filter with e.g. custom functions.

Can you give an example for a “union” request that cannot be achieved by just combining the filter conditions?

Thanks in advance!
--Ralf

From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Dienstag, 11. August 2015 13:59
To: user@olingo.apache.org
Subject: Re: odata v4 union of 2 entity sets

Thanks Ralf,
I know I can apply boolean operators to the filter query option to obtain a complex filter
but as I've said in a previous email the problem is that the request could be more complex (custom query options etc).

So in general I'd like to be able to combine the result of 2 different requests (on the same set) in the response to a single request .
So I thought that a good way could be the use of an odata function, something similar to http://host/service/Union(Accounts<http://host/service/Union%28Accounts>, XXX, YYY).



On 11/08/15 09:58, Handl, Ralf wrote:
In the example given below the union of

http://serviceRoot/Accounts?$filter=XXX

http://serviceRoot/Accounts?$filter=YYY
is

http://serviceRoot/Accounts?$filter=XXX or YYY


From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Dienstag, 11. August 2015 07:30
To: user@olingo.apache.org<ma...@olingo.apache.org>
Subject: Re: odata v4 union of 2 entity sets

Ok, odata doesn't support operations on sets such as union, intersection and difference...
So what's the best way to implement such operations ?

  1.  http://host/service/Accounts?$filter=XXX&*filterUnion=YYY
where *filterUnion is a custom query option
  2.  http://host/service/Union(Accounts<http://host/service/Union%28Accounts>, XXX, YYY))
where Union is an odata function
  3.  Can you suggest a better way ?

Thank you, Riccardo.

On 10/08/15 21:36, Ramesh Reddy wrote:

If you are really into data integration at this layer may be you want take look into Teiid (http://teiid.org shameless plug, sorry) then use already built OData layer on top?





----- Original Message -----

Hi Ramesh,

thank you very much for the response.



Maybe I don't see the rationale but I still have 2 problems:

1) Suppose I use

http://host/service/$crossjoin(Accounts,Accounts)?$filter=<http://host/service/$crossjoin%28Accounts,Accounts%29?$filter=>??? but I'm

not able to apply 2 different filters to the same Accounts set, I'm wrong?

2) I mentioned the union operation but I also need other operations on

sets such as intersection,difference etc... Could I perform the other

operations always using the $crossjoin?





On 10/08/15 18:25, Ramesh Reddy wrote:

OData V4 does not have any "$union" feature currently. There is a

"$crossjoin" feature.

http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090

may be you can use that?



----- Original Message -----

Hi all,

I'd like to have a suggestion on how to implement an odata v4 service

that is able to execute the "union of 2 entity sets" in a single request.



Put simple:

- I've an entity set named Accounts.

- I could request for an EntityCollectionX using

http://serviceRoot/Accounts?$filter=XXX

- I could request for an EntityCollectionY using

http://serviceRoot/Accounts?$filter=YYY

- Then I could merge the responses on the client side.



I'd like to do something similar to this request

http://serviceRoot/Union(Accounts?$filter=XXX<http://serviceRoot/Union%28Accounts?$filter=XXX>, Accounts?$filter=YYY)

Where Union could be an odata function that takes as parameters 2

requests that are the collections to merge.

(I know I could combine the filters but this is just an example I've a

more complicated case)



It seems that odata doesn't provide a "standard way" to merge entity

sets or it does ???

What's the best way to reach this objective ?



Thank you very much, Riccardo.









Re: odata v4 union of 2 entity sets

Posted by Riccardo Mariani <ma...@gmail.com>.
Thanks Ralf,
I know I can apply boolean operators to the filter query option to 
obtain a complex filter
but as I've said in a previous email the problem is that the request 
could be more complex (custom query options etc).

So in general I'd like to be able to combine the result of 2 different 
requests (on the same set) in the response to a single request .
So I thought that a good way could be the use of an odata function, 
something similar to http://host/service/Union(Accounts 
<http://host/service/Union%28Accounts>, XXX, YYY).




On 11/08/15 09:58, Handl, Ralf wrote:
>
> In the example given below the union of
>
> http://serviceRoot/Accounts?$filter=XXX
> http://serviceRoot/Accounts?$filter=YYY
>
> is
>
> http://serviceRoot/Accounts?$filter=XXX or YYY
>
> *From:*Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
> *Sent:* Dienstag, 11. August 2015 07:30
> *To:* user@olingo.apache.org
> *Subject:* Re: odata v4 union of 2 entity sets
>
> Ok, odata doesn't support operations on sets such as union, 
> intersection and difference...
> So what's the best way to implement such operations ?
>
>  1. http://host/service/Accounts?$filter=XXX&*filterUnion=YYY
>     where *filterUnion is a custom query option
>  2. http://host/service/Union(Accounts
>     <http://host/service/Union%28Accounts>, XXX, YYY))
>     where Union is an odata function
>  3. Can you suggest a better way ?
>
> Thank you, Riccardo.
>
> On 10/08/15 21:36, Ramesh Reddy wrote:
>
>     If you are really into data integration at this layer may be you want take look into Teiid (http://teiid.org  shameless plug, sorry) then use already built OData layer on top?
>
>     ----- Original Message -----
>
>         Hi Ramesh,
>
>         thank you very much for the response.
>
>         Maybe I don't see the rationale but I still have 2 problems:
>
>         1) Suppose I use
>
>         http://host/service/$crossjoin(Accounts,Accounts)?$filter=
>         <http://host/service/$crossjoin%28Accounts,Accounts%29?$filter=>??? but I'm
>
>         not able to apply 2 different filters to the same Accounts set, I'm wrong?
>
>         2) I mentioned the union operation but I also need other operations on
>
>         sets such as intersection,difference etc... Could I perform the other
>
>         operations always using the $crossjoin?
>
>         On 10/08/15 18:25, Ramesh Reddy wrote:
>
>             OData V4 does not have any "$union" feature currently. There is a
>
>             "$crossjoin" feature.
>
>             http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090
>
>             may be you can use that?
>
>             ----- Original Message -----
>
>                 Hi all,
>
>                 I'd like to have a suggestion on how to implement an odata v4 service
>
>                 that is able to execute the "union of 2 entity sets" in a single request.
>
>                 Put simple:
>
>                 - I've an entity set named Accounts.
>
>                 - I could request for an EntityCollectionX using
>
>                 http://serviceRoot/Accounts?$filter=XXX
>
>                 - I could request for an EntityCollectionY using
>
>                 http://serviceRoot/Accounts?$filter=YYY
>
>                 - Then I could merge the responses on the client side.
>
>                 I'd like to do something similar to this request
>
>                 http://serviceRoot/Union(Accounts?$filter=XXX
>                 <http://serviceRoot/Union%28Accounts?$filter=XXX>, Accounts?$filter=YYY)
>
>                 Where Union could be an odata function that takes as parameters 2
>
>                 requests that are the collections to merge.
>
>                 (I know I could combine the filters but this is just an example I've a
>
>                 more complicated case)
>
>                 It seems that odata doesn't provide a "standard way" to merge entity
>
>                 sets or it does ???
>
>                 What's the best way to reach this objective ?
>
>                 Thank you very much, Riccardo.
>


RE: odata v4 union of 2 entity sets

Posted by "Handl, Ralf" <ra...@sap.com>.
In the example given below the union of

http://serviceRoot/Accounts?$filter=XXX

http://serviceRoot/Accounts?$filter=YYY
is

http://serviceRoot/Accounts?$filter=XXX or YYY


From: Riccardo Mariani [mailto:mariani.riccardo.79@gmail.com]
Sent: Dienstag, 11. August 2015 07:30
To: user@olingo.apache.org
Subject: Re: odata v4 union of 2 entity sets

Ok, odata doesn't support operations on sets such as union, intersection and difference...
So what's the best way to implement such operations ?

  1.  http://host/service/Accounts?$filter=XXX&*filterUnion=YYY
where *filterUnion is a custom query option
  2.  http://host/service/Union(Accounts, XXX, YYY))
where Union is an odata function
  3.  Can you suggest a better way ?

Thank you, Riccardo.

On 10/08/15 21:36, Ramesh Reddy wrote:

If you are really into data integration at this layer may be you want take look into Teiid (http://teiid.org shameless plug, sorry) then use already built OData layer on top?





----- Original Message -----

Hi Ramesh,

thank you very much for the response.



Maybe I don't see the rationale but I still have 2 problems:

1) Suppose I use

http://host/service/$crossjoin(Accounts,Accounts)?$filter=??? but I'm

not able to apply 2 different filters to the same Accounts set, I'm wrong?

2) I mentioned the union operation but I also need other operations on

sets such as intersection,difference etc... Could I perform the other

operations always using the $crossjoin?





On 10/08/15 18:25, Ramesh Reddy wrote:

OData V4 does not have any "$union" feature currently. There is a

"$crossjoin" feature.

http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090

may be you can use that?



----- Original Message -----

Hi all,

I'd like to have a suggestion on how to implement an odata v4 service

that is able to execute the "union of 2 entity sets" in a single request.



Put simple:

- I've an entity set named Accounts.

- I could request for an EntityCollectionX using

http://serviceRoot/Accounts?$filter=XXX

- I could request for an EntityCollectionY using

http://serviceRoot/Accounts?$filter=YYY

- Then I could merge the responses on the client side.



I'd like to do something similar to this request

http://serviceRoot/Union(Accounts?$filter=XXX, Accounts?$filter=YYY)

Where Union could be an odata function that takes as parameters 2

requests that are the collections to merge.

(I know I could combine the filters but this is just an example I've a

more complicated case)



It seems that odata doesn't provide a "standard way" to merge entity

sets or it does ???

What's the best way to reach this objective ?



Thank you very much, Riccardo.








Re: odata v4 union of 2 entity sets

Posted by Riccardo Mariani <ma...@gmail.com>.
Ok, odata doesn't support operations on sets such as union, intersection 
and difference...
So what's the best way to implement such operations ?

 1. http://host/service/Accounts?$filter=XXX&*filterUnion=YYY
    where *filterUnion is a custom query option
 2. http://host/service/Union(Accounts, XXX, YYY))
    where Union is an odata function
 3. Can you suggest a better way ?

Thank you, Riccardo.



On 10/08/15 21:36, Ramesh Reddy wrote:
> If you are really into data integration at this layer may be you want take look into Teiid (http://teiid.org shameless plug, sorry) then use already built OData layer on top?
>
>
> ----- Original Message -----
>> Hi Ramesh,
>> thank you very much for the response.
>>
>> Maybe I don't see the rationale but I still have 2 problems:
>> 1) Suppose I use
>> http://host/service/$crossjoin(Accounts,Accounts)?$filter=??? but I'm
>> not able to apply 2 different filters to the same Accounts set, I'm wrong?
>> 2) I mentioned the union operation but I also need other operations on
>> sets such as intersection,difference etc... Could I perform the other
>> operations always using the $crossjoin?
>>
>>
>> On 10/08/15 18:25, Ramesh Reddy wrote:
>>> OData V4 does not have any "$union" feature currently. There is a
>>> "$crossjoin" feature.
>>> http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090
>>> may be you can use that?
>>>
>>> ----- Original Message -----
>>>> Hi all,
>>>> I'd like to have a suggestion on how to implement an odata v4 service
>>>> that is able to execute the "union of 2 entity sets" in a single request.
>>>>
>>>> Put simple:
>>>> - I've an entity set named Accounts.
>>>> - I could request for an EntityCollectionX using
>>>> http://serviceRoot/Accounts?$filter=XXX
>>>> - I could request for an EntityCollectionY using
>>>> http://serviceRoot/Accounts?$filter=YYY
>>>> - Then I could merge the responses on the client side.
>>>>
>>>> I'd like to do something similar to this request
>>>> http://serviceRoot/Union(Accounts?$filter=XXX, Accounts?$filter=YYY)
>>>> Where Union could be an odata function that takes as parameters 2
>>>> requests that are the collections to merge.
>>>> (I know I could combine the filters but this is just an example I've a
>>>> more complicated case)
>>>>
>>>> It seems that odata doesn't provide a "standard way" to merge entity
>>>> sets or it does ???
>>>> What's the best way to reach this objective ?
>>>>
>>>> Thank you very much, Riccardo.
>>>>
>>


Re: odata v4 union of 2 entity sets

Posted by Ramesh Reddy <ra...@redhat.com>.
If you are really into data integration at this layer may be you want take look into Teiid (http://teiid.org shameless plug, sorry) then use already built OData layer on top?


----- Original Message -----
> Hi Ramesh,
> thank you very much for the response.
> 
> Maybe I don't see the rationale but I still have 2 problems:
> 1) Suppose I use
> http://host/service/$crossjoin(Accounts,Accounts)?$filter=??? but I'm
> not able to apply 2 different filters to the same Accounts set, I'm wrong?
> 2) I mentioned the union operation but I also need other operations on
> sets such as intersection,difference etc... Could I perform the other
> operations always using the $crossjoin?
> 
> 
> On 10/08/15 18:25, Ramesh Reddy wrote:
> > OData V4 does not have any "$union" feature currently. There is a
> > "$crossjoin" feature.
> > http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090
> > may be you can use that?
> >
> > ----- Original Message -----
> >> Hi all,
> >> I'd like to have a suggestion on how to implement an odata v4 service
> >> that is able to execute the "union of 2 entity sets" in a single request.
> >>
> >> Put simple:
> >> - I've an entity set named Accounts.
> >> - I could request for an EntityCollectionX using
> >> http://serviceRoot/Accounts?$filter=XXX
> >> - I could request for an EntityCollectionY using
> >> http://serviceRoot/Accounts?$filter=YYY
> >> - Then I could merge the responses on the client side.
> >>
> >> I'd like to do something similar to this request
> >> http://serviceRoot/Union(Accounts?$filter=XXX, Accounts?$filter=YYY)
> >> Where Union could be an odata function that takes as parameters 2
> >> requests that are the collections to merge.
> >> (I know I could combine the filters but this is just an example I've a
> >> more complicated case)
> >>
> >> It seems that odata doesn't provide a "standard way" to merge entity
> >> sets or it does ???
> >> What's the best way to reach this objective ?
> >>
> >> Thank you very much, Riccardo.
> >>
> 
> 

Re: odata v4 union of 2 entity sets

Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Ramesh,
thank you very much for the response.

Maybe I don't see the rationale but I still have 2 problems:
1) Suppose I use 
http://host/service/$crossjoin(Accounts,Accounts)?$filter=??? but I'm 
not able to apply 2 different filters to the same Accounts set, I'm wrong?
2) I mentioned the union operation but I also need other operations on 
sets such as intersection,difference etc... Could I perform the other 
operations always using the $crossjoin?


On 10/08/15 18:25, Ramesh Reddy wrote:
> OData V4 does not have any "$union" feature currently. There is a "$crossjoin" feature. http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090 may be you can use that?
>
> ----- Original Message -----
>> Hi all,
>> I'd like to have a suggestion on how to implement an odata v4 service
>> that is able to execute the "union of 2 entity sets" in a single request.
>>
>> Put simple:
>> - I've an entity set named Accounts.
>> - I could request for an EntityCollectionX using
>> http://serviceRoot/Accounts?$filter=XXX
>> - I could request for an EntityCollectionY using
>> http://serviceRoot/Accounts?$filter=YYY
>> - Then I could merge the responses on the client side.
>>
>> I'd like to do something similar to this request
>> http://serviceRoot/Union(Accounts?$filter=XXX, Accounts?$filter=YYY)
>> Where Union could be an odata function that takes as parameters 2
>> requests that are the collections to merge.
>> (I know I could combine the filters but this is just an example I've a
>> more complicated case)
>>
>> It seems that odata doesn't provide a "standard way" to merge entity
>> sets or it does ???
>> What's the best way to reach this objective ?
>>
>> Thank you very much, Riccardo.
>>


Re: odata v4 union of 2 entity sets

Posted by Ramesh Reddy <ra...@redhat.com>.
OData V4 does not have any "$union" feature currently. There is a "$crossjoin" feature. http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398090 may be you can use that?

----- Original Message -----
> Hi all,
> I'd like to have a suggestion on how to implement an odata v4 service
> that is able to execute the "union of 2 entity sets" in a single request.
> 
> Put simple:
> - I've an entity set named Accounts.
> - I could request for an EntityCollectionX using
> http://serviceRoot/Accounts?$filter=XXX
> - I could request for an EntityCollectionY using
> http://serviceRoot/Accounts?$filter=YYY
> - Then I could merge the responses on the client side.
> 
> I'd like to do something similar to this request
> http://serviceRoot/Union(Accounts?$filter=XXX, Accounts?$filter=YYY)
> Where Union could be an odata function that takes as parameters 2
> requests that are the collections to merge.
> (I know I could combine the filters but this is just an example I've a
> more complicated case)
> 
> It seems that odata doesn't provide a "standard way" to merge entity
> sets or it does ???
> What's the best way to reach this objective ?
> 
> Thank you very much, Riccardo.
>