[Om] Referencing OM symbols in text

Andrew Robbins andjrob at gmail.com
Mon Mar 11 07:16:58 CET 2013


Lars,

I would prefer a simple colon as well. But unlike David's "pseudo namespace
style" interpretation, I would like to go on a tangent for a bit.

The elephant in the room regarding mathematics and the semantic web is that
of identifiers. Both mathematics and semantic web technologies will suffer
until people remedy this. There are essentially 3 types of identifiers in
common use: URIs (in RDF), QNames (in XML), and OMSymbols (in MathML). In
order to convert between them, this is how I've personally internalized the
solution to this problem:

- [URI => QName] If the URI originated from an OMSymbol, then split on '#'.
The new QName's namespaceURI is the first part (including '#'), and the
localName is the second part. If the URI starts with '{', then it is (an
INVALID URI) produced by javax.xml.namespace.QName#toString(), in which
case we split on '}' and do as above. If the URI contains '::', then it is
a VALID URI produced by ECMAScript for XML (E4X)
QName.prototype.toString(), in which case we split on '::' and do as above.
If the URI ends with a '/' followed by a valid NCName, then split on that,
and do as above. Otherwise, give up.

- [QName => URI] If the URI ends in '#' or '/' or some other punctuation,
then concatenate. If we're using Java, return "{$namespaceURI}$localName".
If we're using E4X, return "$namespaceURI::$localName". If there are any
applicable standards (such as XSDatatypes), defer to those. Otherwise, give
up.

- [URI => OMSymbol] If the URI originated from an OMSymbol, then split on
'#' and '/' and reverse the standard [OMSymbol => URI] mapping. Otherwise,
give up.

- [QName => OMSymbol] If the QName's namespaceURI ends in '#' then split on
'/' the new OMSymbol's cdbase becomes the first part, and its cd becomes
the second part, the new OMSymbol's name is the QName's localName.
Otherwise, give up.

- [OMSymbol => QName] Concatenate, the QName's namespaceURI becomes
"$cdbase/$cd#", and its localName is the OMSymbol's name part.

- [OMSymbol => URI] Concatenate, return "$cdbase/$cd#$name".

With these mappings in mind:

<m:csymbol xmlns:m="http://www.w3.org/1998/Math/MathML"
cd="nums1">gamma</m:csymbol>
and
<OMOBJ xmlns="http://www.openmath.org/OpenMath" cdbase="
http://www.openmath.org/cd">
  <OMS cd="nums1" name="gamma"/>
</OMOBJ>

would be mapping-equivalent to:

<nums1:gamma xmlns:nums1="http://www.openmath.org/cd/nums1#"/>
and
<gamma xmlns="http://www.openmath.org/cd/nums1#"/>

which represent XML QNames, but in RDF "nums1:gamma" would represent a URI,
which is much closer to OpenMath style.

Just as a note, some of these mappings I'm using in my software projects.
I've been working on a lot of compilers lately, and I've been using a
variant of OpenMath/MathML to represent the AST. If you would like a
preview of what I've been working on:
https://github.com/andydude/python2drox is a quick prototype I made for
Python, and https://github.com/andydude/droscheme is a much more
complicated project that compiles Scheme to Go.

In conclusion, <nums1:gamma/> would (under these mappings) be valid for the
first argument for <OMA> and <m:apply> elements if nums1 was a declared
namespace prefix which matched the nums1 content dictionary URI.

Regards,
Andrew

On Fri, Mar 1, 2013 at 8:46 AM, Lars Hellström <
Lars.Hellstrom at residenset.net> wrote:

> Writing a paper, it occurs to me that since most of the OM I've seen has
> been the raw XML encodings of objects, I'm not so sure how one would
> preferably refer to an OM symbol in ordinary text. If rather than saying
> for example "Euler's gamma constant" one wishes to refer specifically to
> the OM symbol for this constant what would one say? The full XML tag is of
> course one possibility, but
>
>   ... the occurrence of <OMS cd="nums1" name="gamma"/> in this
>   formula is most fortuitous, because then ...
>
> doesn't feel natural. (And that is all supposed to be character data, so
> in an XML source document it would be encoded as <OMS cd="nums1"
> name="gamma"/> or something. This is about what someone printing the
> text on paper should see, not what a robot crawling by should pick up.)
>
> Some styles which I think I have seen are
>
>   gamma at nums1     ("email style"?)
>   nums1#gamma     (URI style)
>   nums1.gamma     (Popcorn style?)
>
> Anyone wants to share any thoughts on what might be preferable, and why?
> And how would one format these things? Is it for example:
>
>   \texttt{gamma at nums1}
>   \texttt{gamma}@\texttt{nums1}
>   \texttt{nums1\#gamma}
>   \texttt{nums1}\#\texttt{gamma}
>   \texttt{nums1.gamma}
>   $\mathrm{nums1.gamma}$
>
> or what?
>
> I have a feeling that the name at cd style might have been more common in
> the early 00 decade, but that it has waned in favour of cd#name. I also
> have a feeling that the name at cd style might be more in line with how
> these things would naturally be spoken aloud. But my experience in these
> matters is limited.
>
> Lars Hellström
>
> ______________________________**_________________
> Om mailing list
> Om at openmath.org
> http://openmath.org/mailman/**listinfo/om<http://openmath.org/mailman/listinfo/om>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openmath.org/pipermail/om/attachments/20130311/a97a3f03/attachment.html>


More information about the Om mailing list