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/10/30 17:53:32 UTC
$expand with $count=true
Hi Olingo users,
I'm using the latest java library v4.
I think that $count=true doesn't work with $expand.
For example EntitySet?$expand=NavigationPropertySet($count=true) doesn't
return the count of the navigation property set.
I think there is a missing writeCount() in the
method ODataJsonSerializer.writeExpandedNavigationProperty().
Am I wrong?
Thank you so much,
Riccardo.
Re: $expand with $count=true
Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Michael,
ok thanks for the advice, I'll also check the documents.
On 03/11/15 20:40, mibo wrote:
> Hi Riccardo,
>
> based on the sample in the JSON format specification about „expanded navigation property“ [1]:
>> {
>> "@odata.context": "http://host/service/$metadata#Customers/$entity",
>> ...
>> "Orders@odata.count": 42,
>> "Orders": [ ... ],
>> "Orders@odata.nextLink": "...",
>> ...
>> }
> and the sample service with the „inline count“:
> http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips($count=true)
>
> I think the response for the "$expand=NavigationPropertySet/$count“ looks like:
>
>> {
>> ...
>> "NavigationPropertySet@odata.count": 42,
>> ...
>> }
> So only the count of the „NavigationPropertySet“ will be in the response without the data of the „NavigationPropertySet“.
>
> Best Regards,
> Michael
>
> [1]: http://docs.oasis-open.org/odata/odata-json-format/v4.0/odata-json-format-v4.0.html#_Expanded_Navigation_Property
>
>
>> Am 03.11.2015 um 20:04 schrieb Riccardo Mariani <ma...@gmail.com>:
>>
>> Hi Michael,
>>
>> I need the following feature: $expand=NavigationPropertySet/$count so I could create the JIRA issue and implement the feature.
>> But I need some help mainly about the format of the response...
>> I know that if I ask for EntitySet/$count the response is a count in plain text.
>> If I ask for $expand=NavigationPropertySet/$count what should be the response?
>> Can you please show me an example of a response in json for example?
>>
>> Thank you so much,
>> Riccardo.
>>
>>
>> On 03/11/15 08:47, Bolz, Michael wrote:
>>> Hi Riccardo,
>>>
>>> Thanks for the source and highlighted part.
>>> Could you please attach this to the mentioned JIRA issue.
>>> Afterwards I will merge and check the solution.
>>>
>>>> So I should be able to query something like EntitySet?$expand=NavigationPropertySet/$count.
>>>> Is this feature supported by olingo?
>>> Sorry, I missed your question before.
>>> This is currently not supported with Olingo.
>>> However, you could create an “enhancement” issue in JIRA so that we will check to support this in an upcoming release.
>>> BTW: It seems that currently no sample service supports this feature ;o)
>>> http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips/$count
>>> http://services.odata.org/V4/OData/OData.svc/Categories/?$expand=Products/$count
>>>
>>> Best Regards,
>>> Michael
>>>
>>>> On 02 Nov 2015, at 21:22, Riccardo Mariani <ma...@gmail.com> wrote:
>>>>
>>>> Hi Michael,
>>>>
>>>> Below I highlighted in bold a possible solution to the problem modifying the ODataJsonSerializer.writeExpandedNavigationProperty().
>>>> Do you also have a response to my other previous question about "$expand with $count"?
>>>>
>>>> Thank you very much,
>>>> Riccardo.
>>>>
>>>> protected void writeExpandedNavigationProperty(final ServiceMetadata metadata, final EdmNavigationProperty property,
>>>> final Link navigationLink, final ExpandOption innerExpand, final SelectOption innerSelect, final CountOption innerCount,
>>>> final JsonGenerator json) throws IOException, SerializerException {
>>>> json.writeFieldName(property.getName());
>>>> if (property.isCollection()) {
>>>> if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
>>>> json.writeStartArray();
>>>> json.writeEndArray();
>>>> } else {
>>>>
>>>> if (innerCount != null && innerCount.getCount() != null) {
>>>> writeCount(navigationLink.getInlineEntitySet(), json);
>>>> }
>>>>
>>>> writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
>>>> innerSelect, false, json);
>>>> }
>>>> } else {
>>>> if (navigationLink == null || navigationLink.getInlineEntity() == null) {
>>>> json.writeNull();
>>>> } else {
>>>> writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
>>>> innerExpand, innerSelect, false, json);
>>>> }
>>>> }
>>>> }
>>>>
>>>> On 02/11/15 15:46, Bolz, Michael wrote:
>>>>> Hi Riccardo,
>>>>>
>>>>> Yes, you are right, the $count query option within the $expand clause does not work correctly.
>>>>> I created an issue (https://issues.apache.org/jira/browse/OLINGO-811) and will check/fix it.
>>>>> However, if you already have an idea or already a fix we would be also pleased about a contribution ;o)
>>>>>
>>>>> Best Regards,
>>>>> Michael
>>>>>
>>>>>
>>>>>
>>>>>> On 30 Oct 2015, at 17:53, Riccardo Mariani <ma...@gmail.com> wrote:
>>>>>>
>>>>>> Hi Olingo users,
>>>>>> I'm using the latest java library v4.
>>>>>>
>>>>>> I think that $count=true doesn't work with $expand.
>>>>>> For example EntitySet?$expand=NavigationPropertySet($count=true) doesn't return the count of the navigation property set.
>>>>>> I think there is a missing writeCount() in the method ODataJsonSerializer.writeExpandedNavigationProperty().
>>>>>> Am I wrong?
>>>>>>
>>>>>> Thank you so much,
>>>>>> Riccardo.
Re: $expand with $count=true
Posted by mibo <mi...@apache.org>.
Hi Riccardo,
based on the sample in the JSON format specification about „expanded navigation property“ [1]:
> {
> "@odata.context": "http://host/service/$metadata#Customers/$entity",
> ...
> "Orders@odata.count": 42,
> "Orders": [ ... ],
> "Orders@odata.nextLink": "...",
> ...
> }
and the sample service with the „inline count“:
http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips($count=true)
I think the response for the "$expand=NavigationPropertySet/$count“ looks like:
> {
> ...
> "NavigationPropertySet@odata.count": 42,
> ...
> }
So only the count of the „NavigationPropertySet“ will be in the response without the data of the „NavigationPropertySet“.
Best Regards,
Michael
[1]: http://docs.oasis-open.org/odata/odata-json-format/v4.0/odata-json-format-v4.0.html#_Expanded_Navigation_Property
> Am 03.11.2015 um 20:04 schrieb Riccardo Mariani <ma...@gmail.com>:
>
> Hi Michael,
>
> I need the following feature: $expand=NavigationPropertySet/$count so I could create the JIRA issue and implement the feature.
> But I need some help mainly about the format of the response...
> I know that if I ask for EntitySet/$count the response is a count in plain text.
> If I ask for $expand=NavigationPropertySet/$count what should be the response?
> Can you please show me an example of a response in json for example?
>
> Thank you so much,
> Riccardo.
>
>
> On 03/11/15 08:47, Bolz, Michael wrote:
>> Hi Riccardo,
>>
>> Thanks for the source and highlighted part.
>> Could you please attach this to the mentioned JIRA issue.
>> Afterwards I will merge and check the solution.
>>
>>> So I should be able to query something like EntitySet?$expand=NavigationPropertySet/$count.
>>> Is this feature supported by olingo?
>>
>> Sorry, I missed your question before.
>> This is currently not supported with Olingo.
>> However, you could create an “enhancement” issue in JIRA so that we will check to support this in an upcoming release.
>> BTW: It seems that currently no sample service supports this feature ;o)
>> http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips/$count
>> http://services.odata.org/V4/OData/OData.svc/Categories/?$expand=Products/$count
>>
>> Best Regards,
>> Michael
>>
>>> On 02 Nov 2015, at 21:22, Riccardo Mariani <ma...@gmail.com> wrote:
>>>
>>> Hi Michael,
>>>
>>> Below I highlighted in bold a possible solution to the problem modifying the ODataJsonSerializer.writeExpandedNavigationProperty().
>>> Do you also have a response to my other previous question about "$expand with $count"?
>>>
>>> Thank you very much,
>>> Riccardo.
>>>
>>> protected void writeExpandedNavigationProperty(final ServiceMetadata metadata, final EdmNavigationProperty property,
>>> final Link navigationLink, final ExpandOption innerExpand, final SelectOption innerSelect, final CountOption innerCount,
>>> final JsonGenerator json) throws IOException, SerializerException {
>>> json.writeFieldName(property.getName());
>>> if (property.isCollection()) {
>>> if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
>>> json.writeStartArray();
>>> json.writeEndArray();
>>> } else {
>>>
>>> if (innerCount != null && innerCount.getCount() != null) {
>>> writeCount(navigationLink.getInlineEntitySet(), json);
>>> }
>>>
>>> writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
>>> innerSelect, false, json);
>>> }
>>> } else {
>>> if (navigationLink == null || navigationLink.getInlineEntity() == null) {
>>> json.writeNull();
>>> } else {
>>> writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
>>> innerExpand, innerSelect, false, json);
>>> }
>>> }
>>> }
>>>
>>> On 02/11/15 15:46, Bolz, Michael wrote:
>>>> Hi Riccardo,
>>>>
>>>> Yes, you are right, the $count query option within the $expand clause does not work correctly.
>>>> I created an issue (https://issues.apache.org/jira/browse/OLINGO-811) and will check/fix it.
>>>> However, if you already have an idea or already a fix we would be also pleased about a contribution ;o)
>>>>
>>>> Best Regards,
>>>> Michael
>>>>
>>>>
>>>>
>>>>> On 30 Oct 2015, at 17:53, Riccardo Mariani <ma...@gmail.com> wrote:
>>>>>
>>>>> Hi Olingo users,
>>>>> I'm using the latest java library v4.
>>>>>
>>>>> I think that $count=true doesn't work with $expand.
>>>>> For example EntitySet?$expand=NavigationPropertySet($count=true) doesn't return the count of the navigation property set.
>>>>> I think there is a missing writeCount() in the method ODataJsonSerializer.writeExpandedNavigationProperty().
>>>>> Am I wrong?
>>>>>
>>>>> Thank you so much,
>>>>> Riccardo.
>>>>
>>>
>>
>
Re: $expand with $count=true
Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Michael,
I need the following feature: $expand=NavigationPropertySet/$count so I
could create the JIRA issue and implement the feature.
But I need some help mainly about the format of the response...
I know that if I ask for EntitySet/$count the response is a count in
plain text.
If I ask for $expand=NavigationPropertySet/$count what should be the
response?
Can you please show me an example of a response in json for example?
Thank you so much,
Riccardo.
On 03/11/15 08:47, Bolz, Michael wrote:
> Hi Riccardo,
>
> Thanks for the source and highlighted part.
> Could you please attach this to the mentioned JIRA issue.
> Afterwards I will merge and check the solution.
>
>> So I should be able to query something like
>> EntitySet?$expand=NavigationPropertySet/$count.
>> Is this feature supported by olingo?
>
> Sorry, I missed your question before.
> This is currently not supported with Olingo.
> However, you could create an “enhancement” issue in JIRA so that we
> will check to support this in an upcoming release.
> BTW: It seems that currently no sample service supports this feature ;o)
> http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips/$count
> <http://services.odata.org/V4/%28S%28kb3m31znaqv0xd4oqq0esxfv%29%29/TripPinServiceRW/People?$expand=Trips/$count>
> http://services.odata.org/V4/OData/OData.svc/Categories/?$expand=Products/$count
>
> Best Regards,
> Michael
>
>> On 02 Nov 2015, at 21:22, Riccardo Mariani
>> <mariani.riccardo.79@gmail.com
>> <ma...@gmail.com>> wrote:
>>
>> Hi Michael,
>>
>> Below I highlighted in bold a possible solution to the problem
>> modifying the ODataJsonSerializer.writeExpandedNavigationProperty().
>> Do you also have a response to my other previous question about
>> "$expand with $count"?
>>
>> Thank you very much,
>> Riccardo.
>>
>> protected void writeExpandedNavigationProperty(final
>> ServiceMetadata metadata, final EdmNavigationProperty property,
>> final Link navigationLink, final ExpandOption innerExpand,
>> final SelectOption innerSelect, *final CountOption innerCount,*
>> final JsonGenerator json) throws IOException, SerializerException {
>> json.writeFieldName(property.getName());
>> if (property.isCollection()) {
>> if (navigationLink == null ||
>> navigationLink.getInlineEntitySet() == null) {
>> json.writeStartArray();
>> json.writeEndArray();
>> } else {
>>
>> *if (***innerCount != null && *innerCount.getCount() != null**) {**
>> ** writeCount(**navigationLink.getInlineEntitySet(), json);**
>> ** }*
>>
>> writeEntitySet(metadata, property.getType(),
>> navigationLink.getInlineEntitySet(), innerExpand,
>> innerSelect, false, json);
>> }
>> } else {
>> if (navigationLink == null || navigationLink.getInlineEntity()
>> == null) {
>> json.writeNull();
>> } else {
>> writeEntity(metadata, property.getType(),
>> navigationLink.getInlineEntity(), null,
>> innerExpand, innerSelect, false, json);
>> }
>> }
>> }
>>
>> On 02/11/15 15:46, Bolz, Michael wrote:
>>> Hi Riccardo,
>>>
>>> Yes, you are right, the $count query option within
>>> the $expand clause does not work correctly.
>>> I created an issue
>>> (https://issues.apache.org/jira/browse/OLINGO-811) and will
>>> check/fix it.
>>> However, if you already have an idea or already a fix we would be
>>> also pleased about a contribution ;o)
>>>
>>> Best Regards,
>>> Michael
>>>
>>>
>>>
>>>> On 30 Oct 2015, at 17:53, Riccardo Mariani
>>>> <mariani.riccardo.79@gmail.com
>>>> <ma...@gmail.com>> wrote:
>>>>
>>>> Hi Olingo users,
>>>> I'm using the latest java library v4.
>>>>
>>>> I think that $count=true doesn't work with $expand.
>>>> For example EntitySet?$expand=NavigationPropertySet($count=true)
>>>> doesn't return the count of the navigation property set.
>>>> I think there is a missing writeCount() in the
>>>> method ODataJsonSerializer.writeExpandedNavigationProperty().
>>>> Am I wrong?
>>>>
>>>> Thank you so much,
>>>> Riccardo.
>>>
>>
>
Re: $expand with $count=true
Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Riccardo,
Thanks for the source and highlighted part.
Could you please attach this to the mentioned JIRA issue.
Afterwards I will merge and check the solution.
> So I should be able to query something like EntitySet?$expand=NavigationPropertySet/$count.
> Is this feature supported by olingo?
Sorry, I missed your question before.
This is currently not supported with Olingo.
However, you could create an “enhancement” issue in JIRA so that we will check to support this in an upcoming release.
BTW: It seems that currently no sample service supports this feature ;o)
http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips/$count <http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips/$count>
http://services.odata.org/V4/OData/OData.svc/Categories/?$expand=Products/$count <http://services.odata.org/V4/OData/OData.svc/Categories/?$expand=Products/$count>
Best Regards,
Michael
> On 02 Nov 2015, at 21:22, Riccardo Mariani <ma...@gmail.com> wrote:
>
> Hi Michael,
>
> Below I highlighted in bold a possible solution to the problem modifying the ODataJsonSerializer.writeExpandedNavigationProperty().
> Do you also have a response to my other previous question about "$expand with $count"?
>
> Thank you very much,
> Riccardo.
>
> protected void writeExpandedNavigationProperty(final ServiceMetadata metadata, final EdmNavigationProperty property,
> final Link navigationLink, final ExpandOption innerExpand, final SelectOption innerSelect, final CountOption innerCount,
> final JsonGenerator json) throws IOException, SerializerException {
> json.writeFieldName(property.getName());
> if (property.isCollection()) {
> if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
> json.writeStartArray();
> json.writeEndArray();
> } else {
>
> if (innerCount != null && innerCount.getCount() != null) {
> writeCount(navigationLink.getInlineEntitySet(), json);
> }
>
> writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
> innerSelect, false, json);
> }
> } else {
> if (navigationLink == null || navigationLink.getInlineEntity() == null) {
> json.writeNull();
> } else {
> writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
> innerExpand, innerSelect, false, json);
> }
> }
> }
>
> On 02/11/15 15:46, Bolz, Michael wrote:
>> Hi Riccardo,
>>
>> Yes, you are right, the $count query option within the $expand clause does not work correctly.
>> I created an issue (https://issues.apache.org/jira/browse/OLINGO-811 <https://issues.apache.org/jira/browse/OLINGO-811>) and will check/fix it.
>> However, if you already have an idea or already a fix we would be also pleased about a contribution ;o)
>>
>> Best Regards,
>> Michael
>>
>>
>>
>>> On 30 Oct 2015, at 17:53, Riccardo Mariani <mariani.riccardo.79@gmail.com <ma...@gmail.com>> wrote:
>>>
>>> Hi Olingo users,
>>> I'm using the latest java library v4.
>>>
>>> I think that $count=true doesn't work with $expand.
>>> For example EntitySet?$expand=NavigationPropertySet($count=true) doesn't return the count of the navigation property set.
>>> I think there is a missing writeCount() in the method ODataJsonSerializer.writeExpandedNavigationProperty().
>>> Am I wrong?
>>>
>>> Thank you so much,
>>> Riccardo.
>>
>
Re: $expand with $count=true
Posted by Riccardo Mariani <ma...@gmail.com>.
Hi Michael,
Below I highlighted in bold a possible solution to the problem modifying
the ODataJsonSerializer.writeExpandedNavigationProperty().
Do you also have a response to my other previous question about "$expand
with $count"?
Thank you very much,
Riccardo.
protected void writeExpandedNavigationProperty(final ServiceMetadata
metadata, final EdmNavigationProperty property,
final Link navigationLink, final ExpandOption innerExpand, final
SelectOption innerSelect, *final CountOption innerCount,*
final JsonGenerator json) throws IOException, SerializerException {
json.writeFieldName(property.getName());
if (property.isCollection()) {
if (navigationLink == null || navigationLink.getInlineEntitySet()
== null) {
json.writeStartArray();
json.writeEndArray();
} else {
*if (***innerCount != null && *innerCount.getCount() != null**) {**
** writeCount(**navigationLink.getInlineEntitySet(), json);**
** }*
writeEntitySet(metadata, property.getType(),
navigationLink.getInlineEntitySet(), innerExpand,
innerSelect, false, json);
}
} else {
if (navigationLink == null || navigationLink.getInlineEntity() ==
null) {
json.writeNull();
} else {
writeEntity(metadata, property.getType(),
navigationLink.getInlineEntity(), null,
innerExpand, innerSelect, false, json);
}
}
}
On 02/11/15 15:46, Bolz, Michael wrote:
> Hi Riccardo,
>
> Yes, you are right, the $count query option within the $expand clause
> does not work correctly.
> I created an issue (https://issues.apache.org/jira/browse/OLINGO-811)
> and will check/fix it.
> However, if you already have an idea or already a fix we would be also
> pleased about a contribution ;o)
>
> Best Regards,
> Michael
>
>
>
>> On 30 Oct 2015, at 17:53, Riccardo Mariani
>> <mariani.riccardo.79@gmail.com
>> <ma...@gmail.com>> wrote:
>>
>> Hi Olingo users,
>> I'm using the latest java library v4.
>>
>> I think that $count=true doesn't work with $expand.
>> For example EntitySet?$expand=NavigationPropertySet($count=true)
>> doesn't return the count of the navigation property set.
>> I think there is a missing writeCount() in the
>> method ODataJsonSerializer.writeExpandedNavigationProperty().
>> Am I wrong?
>>
>> Thank you so much,
>> Riccardo.
>
Re: $expand with $count=true
Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Riccardo,
Yes, you are right, the $count query option within the $expand clause does not work correctly.
I created an issue (https://issues.apache.org/jira/browse/OLINGO-811 <https://issues.apache.org/jira/browse/OLINGO-811>) and will check/fix it.
However, if you already have an idea or already a fix we would be also pleased about a contribution ;o)
Best Regards,
Michael
> On 30 Oct 2015, at 17:53, Riccardo Mariani <ma...@gmail.com> wrote:
>
> Hi Olingo users,
> I'm using the latest java library v4.
>
> I think that $count=true doesn't work with $expand.
> For example EntitySet?$expand=NavigationPropertySet($count=true) doesn't return the count of the navigation property set.
> I think there is a missing writeCount() in the method ODataJsonSerializer.writeExpandedNavigationProperty().
> Am I wrong?
>
> Thank you so much,
> Riccardo.