On 19/12/2023 09:53, Marco Duiker - LandGoed wrote:
Please help me with the following problem:

I try to construct the current status of a series of objects along the
following simple rules:

  *  the current status of on object with a certain `identificatie`
    (id) is the newest version of that object
  * except when the newest object has the property
    `<status>beëindigen</status>` then the object stops existing.

I use a fold-left to proces these rules with a simple function
implementing those rules. This gives me unexpected results.

I've reduced the problem to a single stand alone query in which the
last object (`obj3`) has the property `<status>beëindigen</status>`.

So I would expect this line:
`let $stand4 := fold-left(($obj3, $obj2, $obj1), (), function($stand,
$obj) { local:stand-totaal($stand, $obj) })`
to give me an empty result as `obj3`has the property
<status>beëindigen</status>
but I am getting `obj1` as demonstrated in the following stand alone
query.


At least another XQuery 3.1 processor that BaseX (tried with SaxonC HE
12.4) also outputs


3 &lt;-&gt; 2 &lt;-&gt; 1 ============
<sl:stand
xmlns:sl="http://www.geostandaarden.nl/bestanden-ow/standlevering-generiek";>
   <ow-dc:owObject
xmlns:ow-dc="http://www.geostandaarden.nl/imow/bestanden/deelbestand";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
      <r:RegelVoorIedereen
xmlns:r="http://www.geostandaarden.nl/imow/regels";>
<r:identificatie>nl.imow-mnre1034.juridischeregel.OR0000000027</r:identificatie>
<r:idealisatie>http://standaarden.omgevingswet.overheid.nl/idealisatie/id/concept/Exact</r:idealisatie>
         <r:artikelOfLid>
            <r:RegeltekstRef xmlns:xlink="http://www.w3.org/1999/xlink";
xlink:href="nl.imow-mnre1034.regeltekst.OR0000000027"/>
         </r:artikelOfLid>
<r:thema>http://standaarden.omgevingswet.overheid.nl/thema/id/concept/WaterEnWatersystemen</r:thema>
         <r:locatieaanduiding>
            <l:LocatieRef
xmlns:l="http://www.geostandaarden.nl/imow/locatie";
xmlns:xlink="http://www.w3.org/1999/xlink";
xlink:href="nl.imow-mnre1034.ambtsgebied.LND6030B"/>
         </r:locatieaanduiding>
      </r:RegelVoorIedereen>
   </ow-dc:owObject>
</sl:stand>


so it looks, if that is not the result you want, as if the problem is
likely in your code.

Reply via email to