Opened 5 years ago
Last modified 3 years ago
#19970 new enhancement
Provide an OpenMath interface
Reported by: | slelievre | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-wishlist |
Component: | interfaces: optional | Keywords: | OpenMath, interface, interoperability |
Cc: | alexk, cremona, defeo, dimpase, slelievre, markuspf, mmezzarobba, mkohlhase, nthiery, twiesing | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
OpenMath is a W3C standard for representing mathematical objects in XML (or binary) format; the syntax and semantic for specific objects (polynomials, ...) is specified in "content dictionaries", a standard collection of which is available at https://openmath.org .
Support for OpenMath serialization (importing from and exporting to OpenMath) would improve the interoperability between SageMath and other mathematics software (both ways: accessing other software from Sage, and accessing Sage from other software).
py-openmath is an implementation of OpenMath for Python; it provides a data structure for OpenMath expression trees (with serialization to from xml representation), together with converters between Python objects and OpenMath expression trees. The default converter can handle basic Python objects (integers, lists, ...) exported using the standard OpenMath content dictionaries. Additional conversions can be registered.
To install py-openmath using the openmath package on Pypi:
sage --pip install openmath
To export more SageMath objects the standard approach would be to use the existing Content Dictionaries (or creating new ones if non existing), and manually implement the conversions for each type of Sage object.
An alternative approach is to use py-openmath's generic serialization to OpenMath. With it, any (picklable) Python object is converted to an OpenMath expression describes how to reconstruct the object from basic Python objects and global functions; it's based on Python's pickle protocol, and can be seen as an alternative pickle format.
See this demo.
By construction, the resulting OpenMath is "system-near"; importing or exporting from another system requires an additional translation step, using alignments. The hope is that decoupling the serialization and the translation steps makes it easier to maintain the conversions. This is being explored as part of the Math-in-the-Middle research project; see e.g. these papers.
See also: #19971 "Provide an SCSCP interface".
Change History (8)
comment:1 Changed 5 years ago by
- Description modified (diff)
comment:2 Changed 5 years ago by
- Description modified (diff)
comment:3 Changed 5 years ago by
- Cc defeo slelievre mmezzarobba added
- Description modified (diff)
- Keywords interface interoperability added
comment:4 Changed 3 years ago by
- Description modified (diff)
comment:5 Changed 3 years ago by
- Milestone changed from sage-7.1 to sage-wishlist
comment:6 Changed 3 years ago by
- Description modified (diff)
comment:7 Changed 3 years ago by
- Description modified (diff)
comment:8 Changed 3 years ago by
- Description modified (diff)
Edit ticket description adding link to py-OpenMath.