Hi Kestutis --
I am definitely NOT Christian, but the general pattern of these things looks like:
let $known as xs:string+ := db:open('master')/descendant::key/string()
let $samples as xs:string+ := db:open('samples')/descendant::key/string()
return $samples[not(. = $known)]
That is, you get a sequence of all the key values you care about in the canonical DB. You get a similar sequence of all the key values you care about in the sample DB. (What those would really be depends on your actual data and how it's structured; I'm assuming that you've got an element named "key" in there, but I doubt that's actually the case.)
The return clause says:
"for every member of the sequence $samples, keep it in the returned sequence only if the predicate (= the expression in the square brackets) is true"
The predicate says "the context item (= the current member of the sequence being considered) is compared to the canonical list using sequence comparison which will return true if any member of the sequence on the left is a member of the sequence on the right. The not function negates this value, so we're testing for when the context item is not a member of the known values."
So you get only those values which are in the samples but not the master DB.
let $master := (1,2,3,5,9,14,8,91)
let $sample := (3,5,11)
return $sample[not(. = $master)]
is a trivial example you could run in the BaseX GUI.
I hope this is close to an answer to the question you wanted to ask.
--
Graydon Saunders |
graydonish@gmail.comÞæs oferéode, ðisses swá mæg.
-- Deor ("That passed, so may this.")