On Fri, 2020-08-21 at 12:51 -0700, Bill Osmond wrote:
> 
>     declare namespace ernm="http://ddex.net/xml/ern/411";;
> 
>     for $r in /ernm:NewReleaseMessage
>     for $track_release in $r/ReleaseList/TrackRelease
>     for $party in $r/PartyList/Party
>     for $sound_recording in $r/ResourceList/SoundRecording
>     for $release in $r/ReleaseList/Release
>     where
>       $track_release/ReleaseLabelReference = $party/PartyReference
>       and $track_release/ReleaseResourceReference =
> $sound_recording/ResourceReference
>       and $track_release/ReleaseResourceReference =
> $release/ResourceGroup/ResourceGroup/ResourceGroupContentItem/Release
> ResourceReference

BaseX is probably smart enough to rewrite this, but check -

for $r in /ernm:NewReleaseMessage
 for $track_release in $r/ReleaseList/TrackRelease
 where $track_release/ReleaseLabelReference = $party/PartyReference

 return
   for $party in $r/PartyList/Party
    for $sound_recording in $r/ResourceList/SoundRecording
    where $track_release/ReleaseResourceReference =
          $sound_recording/ResourceReference
    return
      for $release in $r/ReleaseList/Release
      where
        $track_release/ReleaseResourceReference =
$release/ResourceGroup/ResourceGroup/ResourceGroupContentItem/ReleaseRe
sourceReference 
        return
           <identity>...

> Am I wrong, and would an additional value index help here? Or is my
> query
> just bad?

You're computing every possible combiation of 5 items and then
filtering out the ones you want.

Filtering out earlier would probably help. Also, moving the tests least
lilely to match to the outside would reduce the number of tests sooner.

A value index might well help, but as Bridger wrote, check in the gUI
to see the query plan. BaseX might already be doing the sort of rewrite
i suggested.

Liam


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Reply via email to