Andrey,
Hm. The document was imported from another source.
> @name attribute has values like 'A#B' or '1-7'...
> But, of course, I can try to rename them.
Actually, I mean to transform some (e.g. *a, b, c* names) element/attribute
pairs either into single element or single attribute:
*<c name="a">some value</c> -----> <a>some value</a>*
Such transformation will give us an ability to create indexes we need:
*create index "index" on fn:collection("samples")/root/item by ./a as
xs:string*
Then you will be able to retrieve items with exact value of "a":
*index-scan("index", "12345", "EQ")*
returns "item" (s) from the "samples" collection which has (have) exactly *
<a>12345</a>* inside.
"myChild" has 7211 <item>`s.
>
> "samples" is a sample for document with 162382 <item>`s.
Ok. I got it. Will this proportion be the same in the future? Or current
collections are just examples to try on and are subject to change.
> Each item has only one c...@name eq "a"] and one c...@name eq "b"] and one
> c...@name eq "c"].
Yes, I understand this. I meant something different.
Please, run the following queries and send us results:
1. count(distinct-values(collection("samples")/root/item/c...@name =
"a"]/text()))
2. count(distinct-values(collection("samples")/root/item/c...@name =
"b"]/text()))
3. count(distinct-values(collection("samples")/root/item/c...@name =
"c"]/text()))
3. count(distinct-values(collection("myChild")/root/item/c...@name =
"a"]/text()))
4. count(distinct-values(collection("myChild")/root/item/c...@name =
"b"]/text()))
5. count(distinct-values(collection("myChild")/root/item/c...@name =
"c"]/text()))
6. avg(for $i in distinct-values(collection("myChild")/root/item/c...@name =
"a"]/text())
return count( collection("samples")/root/item/c...@name = "a"]/text() = $i ))
7. avg(for $i in distinct-values(collection("myChild")/root/item/c...@name =
"b"]/text())
return count( collection("samples")/root/item/c...@name = "b"]/text() = $i ))
8. avg(for $i in distinct-values(collection("myChild")/root/item/c...@name =
"c"]/text())
return count( collection("samples")/root/item/c...@name = "c"]/text() = $i ))
9. count(for $it in collection("samples")/root/item
let $t1 := $it/c...@name = "a"]/text(),
$t2 := $it/c...@name = "b"]/text(),
$date := $it/c...@name = "c"]/text(),
$m := collection("myChild")/root/item[ c...@name = "a"]/text() = $date
and
c...@name = "b"]/text() = $t1
and
c...@name = "c"]/text() = $t2]
return
if( local:good($it,"FT1") and
local:good($it,"FTX") and
local:good($it,"FT2"))
then
<input>
<data0>
{
$m/c...@name = "FT1"],
$m/c...@name = "FTX"],
$m/c...@name = "FT2"]
}
</data0>
<cur>
{
$it/c...@name = "FT1"],
$it/c...@name = "FTX"],
$it/c...@name = "FT2"]
}
</cur>
</input>
else ())
10. count(for $it in collection("samples")/root/item
let $t1 := $it/c...@name = "a"]/text(),
$t2 := $it/c...@name = "b"]/text(),
$date := $it/c...@name = "c"]/text(),
where collection("myChild")/root/item[ c...@name = "a"]/text() = $date and
c...@name = "b"]/text() = $t1
and
c...@name = "c"]/text() = $t2]
return 1)
Ivan Shcheklein,
Sedna Team
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion