Hi Eric,

Given this scenario:
Let's say this is file 1 and there are 1000 such different files
<info>
  <company>ibm</company>
  <year>2001</year>
  <country>US</country>
</info>

How do I get the count of years by country ='US' by using Java api

2001 - (20)
2002- (5)
2009 -(0)  etc

Thanks



On Sat, Feb 21, 2015 at 1:27 AM, Maisnam Ns <[email protected]> wrote:

> Thanks Eric for your help. Will try to use XMLStreamWriter.
>
> On Fri, Feb 20, 2015 at 11:09 PM, Erik Hennum <[email protected]>
> wrote:
>
>>  Hi, Maisnam:
>>
>> To get uncorrelated frequencies for three elements, you'll need to make
>> three separate requests, one for each element.
>>
>> Just so you're aware, you can also request tuples for the three
>> elements, but that request returns the frequencies for the co-occurrence
>> of values in a document and not the individual frequencies for each element.
>>
>> By the way, the query options builder has been deprecated for several
>> releases and could go away in any future release.  You should instead use a
>> DOM (such as JDOM or XOM) or XMLStreamWriter to generate the options XML.
>>
>>
>> Hoping that helps,
>>
>>
>>   Erik Hennum
>>
>>    ------------------------------
>> *From:* [email protected] [
>> [email protected]] on behalf of Maisnam Ns [
>> [email protected]]
>> *Sent:* Friday, February 20, 2015 2:40 AM
>> *To:* MarkLogic Developer Discussion
>> *Subject:* [MarkLogic Dev General] JAVA API Query formation
>>
>>    Hi ,
>>
>>  Can someone help me with the JAVA API query formation for the below
>> sample
>>
>>  Let's say this is file 1 and there are 1000 such different files
>>  <info>
>>   <company>ibm</company>
>>   <year>2001</year>
>>   <country>US</country>
>> </info>
>>
>>  I just want to get the country, year and the count.
>>
>>  US 2001  70
>>  US 2014   13
>>  JAPAN 2000 10
>>
>>  Something like the above, I am able to get the count of only one
>> element not two
>>
>> QueryOptionsHandle options = new QueryOptionsHandle().withValues(
>>             qob.values("product",
>>                     qob.range(
>>                         qob.elementRangeIndex(new QName("country"),
>>
>> qob.stringRangeType(QueryOptions.DEFAULT_COLLATION))),
>>                     "frequency-order"));
>>  The above query gives me
>>
>>  US 190
>>  CH  123
>>  IND  70
>>
>>
>>  Thanks
>>
>>
>>
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to