Integrating Web Services into Interactive Mathematical Documents
1. Einführung Architecture Web Services Conclusion
Integrating Web Services into Interactive
Mathematical Documents
MKM 2009
Jana Giceva, Christoph Lange, Florian Rabe
Jacobs University, Bremen, Germany
KWARC – Knowledge Adaptation and Reasoning for Content
This work was supported by JEM-Thematic-Network ECP-038208.
July 12, 2009
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 1/16
2. Einführung Architecture Web Services Conclusion
Interactive Documents
Mathematics everywhere, but not
interactive!
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 2/16
3. Einführung Architecture Web Services Conclusion
Mathematical Web Services
Services for . . .
flexibly adapting documents to varying audiences
checking users’ solutions to exercises
evaluating expressions, solving problems
. . . are available (e. g. SCIEnce), but accessible from documents?
Yes, sometimes (Matita, ActiveMath), but not really easy to integrate
elsewhere; most of the time only used in their native environment
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 3/16
4. Einführung Architecture Web Services Conclusion
The (non-mathematical) Web 2.0
+
Craig’s List Google Maps
Housingmaps (Mashup)
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 4/16
5. Einführung Architecture Web Services Conclusion
JOBAD: An Architecture for Interactive
Documents
JavaScript API for OMDoc-based Active Documents
integrated backend or independent web services
unit content notation
converter dictionaries collection
Web Services
proxy renderer
menu layers elision folding unit definition notation initially
mouse keybd conversion lookup selection generates
Client Modules
action
GUI objects Services
Document XHTML+MathML+OpenMath, JavaScript
http://jomdoc.omdoc.org/wiki/JOBAD
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 5/16
6. Einführung Architecture Web Services Conclusion
A Document Format that Enables Services
Math markup on the web:
MathML (W3C standard supported by Mozilla/Firefox and partly
others), both presentational and semantic (‘‘content’’) markup
We enforce some underspecified aspects of the specification:
maction for alternative displays
terms must be grouped using mrow
cross-linked parallel markup, links from presentation to content
markup
other lightweight annotations allowed as custom attributes
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 6/16
7. Einführung Architecture Web Services Conclusion
Switching between Alternative Displays
<OMATTR> renders as
<OMATP>
<OMS cd =" f o l d i n g " <maction a c t i o n t y p e =" abbrev "
name=" abbrev " / > s e l e c t i o n ="1" >
Epot (R) −e2
4πє 0 R 2
</OMATP> Epot (R)
−e2
4πє 0 R 2 </ maction >
</OMATTR>
Here: prepared by the author. But also: fold subterms, undo/redo of
document changes by other services
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 7/16
9. Einführung Architecture Web Services Conclusion
Lightweight Annotations for Flexible Elisions
In general: leave out information that distracts the reader or
that doesn’t fit on the paper
In particular: redundant brackets around strong-binding
operators
But what if the reader is not yet familiar with certain operators?
⇒ make it interactive
5 ⋅ (x + y)n+3 ≤ (a ⋅ b)! ∨ ¬p ∧ ¬(q ≤ π)
<maction t y p e =" e l i s i o n " >
<mspace / >
<mo f e n c e =" t r u e " omdoc : egroup =" f e n c e "
omdoc : e l e v e l = " 1 0 0 " > ( < /mo>
</ maction >
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 9/16
10. Einführung Architecture Web Services Conclusion
Lightweight Annotations for Flexible Elisions
In general: leave out information that distracts the reader or
that doesn’t fit on the paper
In particular: redundant brackets around strong-binding
operators
But what if the reader is not yet familiar with certain operators?
⇒ make it interactive
5 ⋅ (x + y)n+3 ≤ (a ⋅ b)! ∨ (¬p ∧ ¬(q ≤ π))
<maction t y p e =" e l i s i o n " >
<mspace / >
<mo f e n c e =" t r u e " omdoc : egroup =" f e n c e "
omdoc : e l e v e l = " 1 0 0 " > ( < /mo>
</ maction >
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 9/16
11. Einführung Architecture Web Services Conclusion
Lightweight Annotations for Flexible Elisions
In general: leave out information that distracts the reader or
that doesn’t fit on the paper
In particular: redundant brackets around strong-binding
operators
But what if the reader is not yet familiar with certain operators?
⇒ make it interactive
(5 ⋅ (x + y)n+3) ≤ (a ⋅ b)! ∨ (¬p ∧ ¬(q ≤ π))
<maction t y p e =" e l i s i o n " >
<mspace / >
<mo f e n c e =" t r u e " omdoc : egroup =" f e n c e "
omdoc : e l e v e l = " 1 0 0 " > ( < /mo>
</ maction >
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 9/16
12. Einführung Architecture Web Services Conclusion
Lightweight Annotations for Flexible Elisions
In general: leave out information that distracts the reader or
that doesn’t fit on the paper
In particular: redundant brackets around strong-binding
operators
But what if the reader is not yet familiar with certain operators?
⇒ make it interactive
(5 ⋅ (x + y)n+3) ≤ ((a ⋅ b)!) ∨ ((¬p) ∧ (¬(q ≤ π)))
<maction t y p e =" e l i s i o n " >
<mspace / >
<mo f e n c e =" t r u e " omdoc : egroup =" f e n c e "
omdoc : e l e v e l = " 1 0 0 " > ( < /mo>
</ maction >
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 9/16
13. Einführung Architecture Web Services Conclusion
Lightweight Annotations for Flexible Elisions
In general: leave out information that distracts the reader or
that doesn’t fit on the paper
In particular: redundant brackets around strong-binding
operators
But what if the reader is not yet familiar with certain operators?
⇒ make it interactive
((5⋅(x +y)n+3) ≤ ((a⋅b)!))∨((¬p)∧(¬(q ≤ π)))
<maction t y p e =" e l i s i o n " >
<mspace / >
<mo f e n c e =" t r u e " omdoc : egroup =" f e n c e "
omdoc : e l e v e l = " 1 0 0 " > ( < /mo>
</ maction >
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 9/16
14. Einführung Architecture Web Services Conclusion
Lightweight Annotations for Flexible Elisions
In general: leave out information that distracts the reader or
that doesn’t fit on the paper
In particular: redundant brackets around strong-binding
operators
But what if the reader is not yet familiar with certain operators?
⇒ make it interactive
((5⋅(x+y)(n+3)) ≤ ((a⋅b)!))∨((¬p)∧(¬(q ≤ π)))
<maction t y p e =" e l i s i o n " >
<mspace / >
<mo f e n c e =" t r u e " omdoc : egroup =" f e n c e "
omdoc : e l e v e l = " 1 0 0 " > ( < /mo>
</ maction >
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 9/16
15. Einführung Architecture Web Services Conclusion
Integrating Web Services
No fixed access pattern (REST vs. XML-RPC vs. SOAP), no fixed
set of services
The server that serves a document is responsible for
advertising available services
. . . and shipping required JavaScript client code
< s c r i p t s r c = " . . / s c r i p t s / jobad . j s " / >
< s c r i p t type= " t e x t / j a v a s c r i p t " >
j o b a d I n i t ( " contextmenu " ) ;
jobadInit ( " elision " ) ;
j o b a d I n i t ( " d e f i n i t i o n −lookup " , " Look up d e f i n i t i o n " ,
" h t t p : / / jobad . mathweb . org / backend ? a c t i o n = d e f i n i t i o n −
&cdbase=$cdbase&cd=$cd&name=$name " ) ;
</ script>
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 10/16
16. Einführung Architecture Web Services Conclusion
Rendering
Rendering as a service?! Shouldn’t you get that for free with any
document?
Prerequisite for making output from other services
human-readable!
content markup (OpenMath) → presentation markup
(Presentation MathML)
future work: more control over notation selection
<OMA>
<OMS cd =" combinat1 "
n
k , or Ck , Cn
name=" b i n o m i a l " / > n k
<OMV name=" n " / >
<OMV name=" k " / >
</OMA>
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 11/16
17. Einführung Architecture Web Services Conclusion
Definition and Type Lookup
Input: ID of a symbol σ; output: content- or
presentation-markup definition (or type declaration) of σ
Utilize HTTP content negotiation: request MIME type
application/xhtml+xml to get a rendered formula
Alternative: in-place expansion (not always applicable)
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 12/16
18. Einführung Architecture Web Services Conclusion
Unit Conversion
Units in OpenMath: numbers multiplied with ‘‘unit symbols’’
(or arithmetic compositions of unit symbols, optionally with prefix)
<OMA>
<OMS cd="arith1" name="times"/>
<OMI>1</OMI>
<OMS cd="units_metric1" name="metre"/>
</OMA>
OpenMath-based conversion service exists:
Input: selected expression, target unit; output: converted
expression (rendered)
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 13/16
19. Einführung Architecture Web Services Conclusion
Integrated Backends
Theory: all services separate (clean conceptual model)
Practice: multiple services in an integrated backend (more
efficient, both w. r. t. space and time)
We are developing such integrated backends offering many
(not all) services.
Examples: the MMT system, the SWiM wiki
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 14/16
20. Einführung Architecture Web Services Conclusion
Conclusion
1 Architecture for interactive mathematical documents
2 Reader can interactively adapt appearance
3 Single document serves as interface to embedded and remote
services
4 Knowledge representation: MathML maxed out (but degrades
gracefully to static snapshots)
5 Initial set of local and remote services, server can advertise
additional services
6 Try the demos at
http://jomdoc.omdoc.org/wiki/JOBAD
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 15/16
21. Einführung Architecture Web Services Conclusion
Future
Services that we are planning
Notation selection (⋅/×/invisible, n /Ck , Cn )
k
n k
Guided tours (extension of lookup)
Flattening (of theory imports)
Search this or similar formulæ on the web
(→ http://search.mathweb.org)
Links to web resources (e. g. Wikipedia)
Interactive statement-level structures (proof steps, rhetorical
structures)
Saving (first adapt a document, then save that state on the
server)
Possible cooperations: SCIEnce (computation), interactive exercises
Your wishes?
Giceva, Lange, Rabe (Jacobs University) Integrating Web Services into Interactive Mathematical Documents July 12, 2009 16/16