[MarkLogic Dev General] Is this estimate really working correctly?
Darin McBeath
ddmcbeath at yahoo.com
Fri Dec 3 11:09:30 PST 2010
So, I want to count the number of skos:Concept records that have a skos:broader
child.
I have fragmented on skos:Concept (there are 352950 skos:Concept fragments in
the DB).
The following query works as expected:
declare namespace skos="http://www.w3.org/2004/02/skos/core#";
xdmp:estimate(//skos:Concept[skos:broader])
This returns 352944 (which is correct)
However,
xdmp:estimate(//skos:Concept[not(skos:broader)])
returns 352950 (every skos:Concept fragment in the DB instead of the expected
value of 6).
So, I then moved on to search.
xdmp:estimate(cts:search(//skos:Concept,
cts:not-query(cts:element-query((QName("http://www.w3.org/2004/02/skos/core#","broader")),
cts:and-query(())))))
returns a value of 6.
and
xdmp:estimate(cts:search(//skos:Concept,
cts:element-query((QName("http://www.w3.org/2004/02/skos/core#","broader")),
cts:and-query(()))))
returns a value of 352944.
So, since MarkLogic indexes parent-child relationships, why wouldn't the first
simple query ... just using xpath expressions ... return the correct result.
Thanks.
Darin.
p.s. No, I didn't bother to do a trace or xdmp:plan ;-) The xpath example
appears so simple (on the surface) I'm a bit stumped as to why this would not
correctly return an unfiltered result.
More information about the General
mailing list