[xquery-talk] Collections - family relationships

David Lee dlee at calldei.com
Sun Jan 5 14:23:05 PST 2014


Re: fn:uri-collection() !! 
Another new function for me ... looks useful If/and/only/if it correlates to what you want ...
Seems there is no guarantee that
   uri-collection()!doc(.)   produces the same results as collection()

this is a broad field, that incidentally I think is underappreciated.  
Hans-Juergen brought up similar ideas at recent Balisage conferences about the "space" beyond XQuery ...
That area where documents exist but standards fear to tread ....

This "Info Space" as he calls it (I think it's a great word ...) could really use some serious brain-power to dig into and standardize.  XQuery itself leaves it mostly in the realm where dragons life - for good reasons ... but as XML matures 
And we evolve into XML Databases and the web of all things,  pushing the envelope of defining where documents come from,
And what rules and API's we want to standardize on them could be really useful.




----------------------------------------
David A. Lee
dlee at calldei.com
http://www.xmlsh.org


-----Original Message-----
From: Andrew Welch [mailto:andrew.j.welch at gmail.com] 
Sent: Sunday, January 05, 2014 5:09 PM
To: Michael Kay
Cc: David Lee; talk at x-query.com; ihe.onwuka at gmail.com
Subject: Re: [xquery-talk] Collections - family relationships

On 5 January 2014 21:20, Michael Kay <mike at saxonica.com> wrote:
>
> On 5 Jan 2014, at 20:59, David Lee <dlee at calldei.com> wrote:
>
>> Given those truths ...
>> If you do have a sequence from fn:collection() or another function you *can* find the position of a document in that collection and its 'sibling'
>>
>> Note: this may be a horribly inefficient thing to do so buyer beware ....
>>
>> let $c := fn:collection(),
>>     $doc := local:pick-a-random-doc( $c ),
>>     $prev := $c[ fn:index-of( $c , $doc ) - 1 ]   (: Might be bad to do on the first or  only document :)
>>   return $c
>>
>>
>
> This only works if all the documents have distinct string-values.
>
> A more efficient and reliable approach would be
>
> min(for $c at $i in collection() where $c is $doc return $i)


Couldn't you use uri-collection() to give you an order, rather than the collection() directly?


--
Andrew Welch
http://andrewjwelch.com



More information about the talk mailing list