- From: Adam Retter <adam.retter@googlemail.com>
- Date: Thu, 26 Mar 2015 12:44:34 +0000
- To: expath@googlegroups.com
- Cc: EXPath <public-expath@w3.org>
I don't think the serialized string representation of JSON would solve
your problem. If you take a Map in XQuery 3.1 and serialize it, you
have no guarantee what order the serialization will produce the keys
in (unless I am mistaken)?
On 26 March 2015 at 12:35, 'Hans-Juergen Rennau' via EXPath
<expath@googlegroups.com> wrote:
> Yes, Adam, I think XML would be easier. So it seems to me the chief
> candidates for representing JSON structures within function signatures are
> (a) a serialized JSON string, favoured by Christian, or (b) an XML
> equivalent.
>
> Cheers,
> Hans-Jürgen
>
>
>
> Adam Retter <adam.retter@googlemail.com> schrieb am 11:53 Donnerstag,
> 26.März 2015:
>
>
> mongo:command($id, 'db', (
> function() {('createIndexes', 'coll')},
> function() {('indexes', '...')}
> ))
>
> Basically instead of using a map of key-value pairs (which is just a
> function from key->value), you use an array/sequence (which is
> ordered) of functions which return key->value pairs. You could model
> this in several different ways, for example another way would be:
>
> mongo:command($id, 'db', function() {
> array {
> ('createIndexes', 'indexes'),
> function($key as xs:string) {
> switch($key) {
> case 'createIndexes':
> 'coll'
> case 'indexes':
> ...
> }
> }
> }
> })
>
> I would abstract this structural pattern and provide functions to help
> create it, as you will be nesting this to be able to create
> effectively ordered maps of maps.
>
> Although.... it might just be easier to use XML! :-)
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "EXPath" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to expath+unsubscribe@googlegroups.com.
> To post to this group, send email to expath@googlegroups.com.
> Visit this group at http://groups.google.com/group/expath.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "EXPath" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to expath+unsubscribe@googlegroups.com.
> To post to this group, send email to expath@googlegroups.com.
> Visit this group at http://groups.google.com/group/expath.
> For more options, visit https://groups.google.com/d/optout.
--
Adam Retter
skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
Received on Monday, 30 March 2015 08:21:37 UTC