[MarkLogic Dev General] How to get accurate fragment counts using xdmp:estimate when the QName is a variable
Mary Holstege
mary.holstege at marklogic.com
Tue Sep 14 13:22:22 PDT 2010
On Tue, 14 Sep 2010 13:05:58 -0700, McBeath, Darin W (ELS-STL)
<D.McBeath at elsevier.com> wrote:
...
> The following query returns me the value I would expect.
>
> xdmp:estimate(//skos:ConceptScheme)
>
> However, if I have a variable $eQName which is essentially the QName for
> skos:ConceptScheme
>
> xdmp:estimate(//$eQName)
>
> returns me every fragment in the DB.
I think the problem is that your query isn't doing what you
think it is. It equivalent to //"skos:ConceptScheme",
the value of which is the string "skos:ConceptScheme" repeated
for every element in the database. So the estimate is
correct, but it isn't what you want.
The only way to get the result you wany from the path is
something like //*[fn:node-name(.)=$eQName].
//Mary
More information about the General
mailing list