sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.4k stars 473 forks source link

Provide an OpenMath interface #19970

Open slel opened 8 years ago

slel commented 8 years ago

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".

CC: @alex-konovalov @JohnCremona @defeo @dimpase @slel @sagetrac-markuspf @mezzarobba @sagetrac-mkohlhase @nthiery @sagetrac-twiesing

Component: interfaces: optional

Keywords: OpenMath, interface, interoperability

Issue created by migration from https://trac.sagemath.org/ticket/19970

slel commented 8 years ago

Description changed:

--- 
+++ 
@@ -8,4 +8,5 @@

 - accessors to the abstract classes.

+See also #19971 "Provide an SCSPC interface".
slel commented 8 years ago

Description changed:

--- 
+++ 
@@ -1,12 +1,15 @@
 To provide an OpenMath interface or "phrasebook", we need

 - abstract classes for OpenMath objects that can be serialized
-  into and importet from OpenMath XML format,
+  into and imported from OpenMath XML format,
   possibly even OpenMath binary format.

   Both are described at http://openmath.org/standard/

 - accessors to the abstract classes.

-See also #19971 "Provide an SCSPC interface".
+See also #19971 "Provide an SCSCP interface".

+Both tickets would improve interoperability of [SageMath](../wiki/SageMath)
+and other mathematics software (both ways: accessing other
+software from Sage, and accessing Sage from other software).
slel commented 8 years ago

Changed keywords from OpenMath to OpenMath, interface, interoperability

slel commented 8 years ago
comment:3

Edit ticket description adding link to py-OpenMath.

slel commented 8 years ago

Description changed:

--- 
+++ 
@@ -8,8 +8,13 @@

 - accessors to the abstract classes.

-See also #19971 "Provide an SCSCP interface".
+See also:

-Both tickets would improve interoperability of [SageMath](../wiki/SageMath)
-and other mathematics software (both ways: accessing other
-software from Sage, and accessing Sage from other software).
+-  #19971 "Provide an SCSCP interface".
+
+  Both tickets would improve interoperability of [SageMath](../wiki/SageMath)
+  and other mathematics software (both ways: accessing other
+  software from Sage, and accessing Sage from other software).
+
+- py-OpenMath package:
+  https://github.com/OpenMath/py-openmath
slel commented 6 years ago

Description changed:

--- 
+++ 
@@ -4,7 +4,7 @@
   into and imported from OpenMath XML format,
   possibly even OpenMath binary format.

-  Both are described at http://openmath.org/standard/
+  Both are described at https://openmath.org/standard

 - accessors to the abstract classes.

@@ -12,9 +12,10 @@

 -  #19971 "Provide an SCSCP interface".

-  Both tickets would improve interoperability of [SageMath](../wiki/SageMath)
+  Both tickets would improve interoperability of SageMath
   and other mathematics software (both ways: accessing other
   software from Sage, and accessing Sage from other software).

 - py-OpenMath package:
-  https://github.com/OpenMath/py-openmath
+  - on PyPI: https://pypi.org/project/openmath
+  - on GitHub: https://github.com/OpenMath/py-openmath
nthiery commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,21 +1,27 @@
-To provide an OpenMath interface or "phrasebook", we need
+OpenMath is a W3C standard for representing mathematical objects in xml format (or binary); the syntax and semantic for specific objects (polynomials, ...) is specified in content dictionaries, a standard collection of which is available on http://openmath.org .

-- abstract classes for OpenMath objects that can be serialized
-  into and imported from OpenMath XML format,
-  possibly even OpenMath binary format.
+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).

-  Both are described at https://openmath.org/standard

-- accessors to the abstract classes.
+[[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.

-See also:
+Installation of the [package on Pypi](https://pypi.org/project/openmath): 

--  #19971 "Provide an SCSCP interface".
+```
+    sage -pip install openmath
+```

-  Both tickets would improve interoperability of SageMath
-  and other mathematics software (both ways: accessing other
-  software from Sage, and accessing Sage from other software).

-- py-OpenMath package:
-  - on PyPI: https://pypi.org/project/openmath
-  - on GitHub: https://github.com/OpenMath/py-openmath
+To export more [SageMath](../wiki/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](https://github.com/OpenDreamKit/MitM-Sage#generic-system-near-openmath-export-for-python-and-sage-objects)
+
+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. those [papers](https://opendreamkit.org/2017/10/15/WP6-Usecase/).
+
+See also: #19971 "Provide an SCSCP interface".
slel commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,27 +1,29 @@
-OpenMath is a W3C standard for representing mathematical objects in xml format (or binary); the syntax and semantic for specific objects (polynomials, ...) is specified in content dictionaries, a standard collection of which is available on http://openmath.org .
+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 http://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).
+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
+[py-openmath](https://github.com/OpenMath/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.

-Installation of the [package on Pypi](https://pypi.org/project/openmath): 
+To install py-openmath using the [openmath package on Pypi](https://pypi.org/project/openmath):

-See this demo +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. those papers. +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".

slel commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,6 +1,6 @@
 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 http://openmath.org .
+"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