Each conceptDef is a fragment  (its parent, terminology is a fragment Root)
I rewrote it as this :

doc("/NDFRT/NDFRT_Public_2009.05.12_TDE.xml")/terminology/conceptDef[empty(definingConcepts/concept)]

But it didnt speed things up much.
My guess is that the non-existance of elements is not indexed.   I would think 
there would be some way in ML to index that information but I cant find it.

Instead what I did was pre-process the XML file to generate a 'tree structure' 
of the elements containing just the id's.
Like

 <concept id="1">
    <concept id="2">
            <concept id="3"/>    
            <concept id="4"/>   
    </concept>
    </concept>
  </concept>

This tree xml is 4MB instead of 50MB and processing through it to find out what 
things have child elements is almost instant.

Then I cross reference back to the main XML using the id and thats instant as 
well.

SO while this isnt blocking me, I'm curious.  Is there a way to tell ML to 
index the non existence of elements or attributes ?  I would think thats a very 
common search. I tried searching for word matches with the empty text but that 
didnt work.






-----Original Message-----
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: Thursday, November 19, 2009 12:02 PM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] search for non-existing elements

The FLOWR is not likely to make it faster, as it has to do the same amount of 
work.

I think you said that conceptDef is a fragment root, is that right?  

//conceptDef looks for all conceptDef elements at all levels of the tree.  If 
you know the path to your conceptDef elements, that might help, as it will only 
need to look where you tell it.  For example:

doc("/NDFRT/NDFRT_Public_2009.05.12_TDE.xml")/foo/bar/conceptDef
        [empty(definingConcepts/concept)]

If you know something more about the content of definingConcepts, you might be 
able to do something clever in your test as well.

-Danny

-----Original Message-----
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Andrew Welch
Sent: Thursday, November 19, 2009 8:40 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] search for non-existing elements

> doc("/NDFRT/NDFRT_Public_2009.05.12_TDE.xml")//conceptDef[empty(definingConcepts/concept)]

> This is taking about 10 seconds right now.

> Any suggestions ?   Thanks !

...just a suggestion, but try rewriting it as a flowr expression, such as:

for $c in //conceptDef
where fn:empty($c/definingConcepts/concept)
return $c




-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to