<html><head><style type="text/css">.style1 {font-family: "Times New Roman";}</style></head><body>On 02/05/2018 08:52, Alberto González Palomo wrote:<BR>
> Michael Kohlhase wrote on 02/05/18 at 08:57:<BR>
>> we have come across the need to communicate OpenMath Objects to <BR>
>> JavaScript.<BR>
>><BR>
>> We could go traditional and send over XML and have JS parse that into JS<BR>
>> Objects, or we could use a JSON binding for OpenMath.<BR>
>><BR>
>> It actually seems that Nathan Carter has already done something very<BR>
>> much like that.  [1]<BR>
>><BR>
>> Would it make sense to standardize a JSON binding of OpenMath? After<BR>
>> all, JSON is one of the practical competitors for XML and used A LOT on<BR>
>> the web.<BR>
>><BR>
>> [1] <a href="https://lurchmath.github.io/openmath-js/site/" target="_blank">https://lurchmath.github.io/openmath-js/site/</a><BR>
> <BR>
>    For anyone else interested, here is a direct link to the docs: <BR>
> (please note that I'm not the author)<BR>
> <a href="https://github.com/lurchmath/openmath-js/blob/master/openmath.litcoffee#openmath-module" target="_blank">https://github.com/lurchmath/openmath-js/blob/master/openmath.litcoffee#openmath-module</a><BR>
> <BR>
> <BR>
>    Some concrete examples:<BR>
> <a href="https://github.com/lurchmath/openmath-js/blob/master/openmath-spec.litcoffee#should-decode-valid-simple-forms" target="_blank">https://github.com/lurchmath/openmath-js/blob/master/openmath-spec.litcoffee#should-decode-valid-simple-forms</a><BR>
> <BR>
> <BR>
>    For instance, let's compare the encoding of $x+5$:<BR>
> <BR>
>    - OpenMath:<BR>
>      <OMOBJ xmlns="http://www.openmath.org/OpenMath"><OMA><OMS <BR>
> cd="arith1" name="plus"/><OMV name="x"/><OMI>5</OMI></OMA></OMOBJ><BR>
> <BR>
>    - openmath-js:<BR>
>      {"t":"a", c:[ {"t":"sy", "cd":"arith1", "n":"plus"}, {"t":"v", <BR>
> "n":"x"}, {"t":"i", "v":"5"} ] }<BR>
> <BR>
>    There is another way to encode XML as JSON, called JSONML, which is <BR>
> pretty much LISP with square brackets:<BR>
> <a href="http://jsonml.org/" target="_blank">http://jsonml.org/</a><BR>
> <BR>
>    - JSONML:<BR>
>      ["OMOBJ", {"xmlns":"http://www.openmath.org/OpenMath"}, ["OMA", <BR>
> ["OMS", {"cd":"arith1", "name":"plus"}], ["OMV", {"name":"x"}], ["OMI", <BR>
> "5"] ]]<BR>
> <BR>
>    As a standard encoding, I'd rather recommend JSONML because it is a <BR>
> straight mapping of the XML syntax and there are implementations of it <BR>
> for several programming languages. I've used it extensively for web <BR>
> applications, generating HTML and XML for both personal projects and <BR>
> work for customers, and it works well in practice.<BR>
> <BR>
>    Cheers,<BR>
<BR>
I've no particular objection and we should say something about JSON <BR>
somewhere, even if only on the website and not in the standard.<BR>
<BR>
jsonml looks useful for us in that context as it doesn't require a new <BR>
openmath encoding as it's "just" an alternative serialisation of XML.<BR>
<BR>
That said, the benefits of json for passing openmath are largely <BR>
cosmetic in many cases as the cost isn't the xml tagging it's the cost <BR>
of sending numeric data via a text representation of its decimal form, <BR>
and JSON doesn't help with that.<BR>
<BR>
The original openmath binary encoding was of course there for that <BR>
reason but more generally one of schema-aware binary encodings of xml to <BR>
allow numeric data to be sent without serialising as strings of decimal <BR>
digits could be mentioned in that context (exi, or fast infoset or asn.1 <BR>
or ...) I'm a bit out of the loop of current standards in that area but <BR>
wikipedia has an overview <a href="https://en.wikipedia.org/wiki/Binary_XML" target="_blank">https://en.wikipedia.org/wiki/Binary_XML</a><BR>
<BR>
<BR>
David<BR>

<br /><br /><p style="font-family: Verdana; font-size:10pt; color:#666666;"><b>Disclaimer</b></p><p style="font-family: Verdana; font-size:8pt; color:#666666;">The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.<br /><br />This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.</p></body></html>