Hi Ana (cc to the list),
I've tried using the "group by" clause, however, it only returns to me the list of the present provinces, without the frequence, or, if I use the "count" function, in only returns 1 (Since every curriculum on the collection only contains a single occurence the province)
Did you combine group by and count (as shown in the Wiki)? How does your current query look like?
Christian
Do you have any idea of how could I list the frequence of each province?
Thank you for your help.
2015-11-20 15:17 GMT-02:00 Christian Grün christian.gruen@gmail.com:
Hi Ana,
The "group by" clause will help you here [1]. Hope this helps; feel free to ask if you need more examples.
Christian
[1] http://docs.basex.org/wiki/XQuery_3.0#group_by
On Fri, Nov 20, 2015 at 6:06 PM, Ana Victória Ladeira ladeira.ana@gmail.com wrote:
Good afternoon!
I have a collection of XML files in which all files contain the attribute //ENDERECO-PROFISISONAL/@UF
In which UF is the province in which the person to whom the file makes reference to lives.
I want to develop a query that returns to me the number of occurences of each province in the collection. I've tried using count and distinct-values, but it always return the value "1" for me.
The query I'm trying to use is the following: for $x in
collection('Teste500')/CURRICULO-VITAE/DADOS-GERAIS/ENDERECO/ENDERECO-PROFISSIONAL let $y := count(distinct-values($x/@UF)) return $y
The desired result would be, in a collection of documents in which 5 people live in SP, 3 in DF and 9 in AM would be the following:
SP: 5 DF: 3 AM:9
Can somebody please help me with that? I'm still struggling with xQuery.
Hi Christian.
After messing around for a while with the queries, I've finally found one that works:
for $x in collection ('Teste500')/CURRICULO-VITAE/DADOS-GERAIS let $uf := $x/ENDERECO/ENDERECO-PROFISSIONAL/@UF group by $uf return <result> {data($uf)} {count($x)}</result>
2015-11-20 16:16 GMT-02:00 Christian Grün christian.gruen@gmail.com:
Hi Ana (cc to the list),
I've tried using the "group by" clause, however, it only returns to me
the
list of the present provinces, without the frequence, or, if I use the "count" function, in only returns 1 (Since every curriculum on the collection only contains a single occurence the province)
Did you combine group by and count (as shown in the Wiki)? How does your current query look like?
Christian
Do you have any idea of how could I list the frequence of each province?
Thank you for your help.
2015-11-20 15:17 GMT-02:00 Christian Grün christian.gruen@gmail.com:
Hi Ana,
The "group by" clause will help you here [1]. Hope this helps; feel free to ask if you need more examples.
Christian
[1] http://docs.basex.org/wiki/XQuery_3.0#group_by
On Fri, Nov 20, 2015 at 6:06 PM, Ana Victória Ladeira ladeira.ana@gmail.com wrote:
Good afternoon!
I have a collection of XML files in which all files contain the attribute //ENDERECO-PROFISISONAL/@UF
In which UF is the province in which the person to whom the file makes reference to lives.
I want to develop a query that returns to me the number of occurences
of
each province in the collection. I've tried using count and distinct-values, but it always return the value "1" for me.
The query I'm trying to use is the following: for $x in
collection('Teste500')/CURRICULO-VITAE/DADOS-GERAIS/ENDERECO/ENDERECO-PROFISSIONAL
let $y := count(distinct-values($x/@UF)) return $y
The desired result would be, in a collection of documents in which 5 people live in SP, 3 in DF and 9 in AM would be the following:
SP: 5 DF: 3 AM:9
Can somebody please help me with that? I'm still struggling with
xQuery.
basex-talk@mailman.uni-konstanz.de