Integrating Web Services into Interactive Mathematical Documents
1. Introduction Architecture Web Services Conclusion
Integrating Web Services into Interactive
Mathematical Documents
CIAO workshop 2009
Christoph Lange, Florian Rabe, Jana Giceva
Jacobs University, Bremen, Germany
KWARC – Knowledge Adaptation and Reasoning for Content
April 2, 2009
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 1
2. Introduction Architecture Web Services Conclusion
Interactive Documents
Mathematical Documents are everywhere on the web (e. g.
MathWorld, PlanetMath, Wikipedia, . . . )
But they lack interactivity!
Examples of interactive services:
Do not just get any document that is available on the server,
but a document that is adapted to your preferences, previous
knowledge, field of application, . . .
Solve exercises
Evaluate/compute/check expressions
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 2
3. Introduction 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. MONET), but accessible from documents?
Yes, sometimes, but not really easy to integrate; most of the time
only used in their native environment
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 3
4. Introduction Architecture Web Services Conclusion
The (non-mathematical) Web 2.0
Asynchronous communication (AJAX): web applications that
feel like desktop applications (rich, responsive widgets)
Mashups: integrate services into documents
First prominent example: HousingMaps = Craig’s List housing
ads + Google Maps
So how about a mathematical Web 2.0 with mashups of web services?
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 4
5. Introduction 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
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
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 5
6. Introduction Architecture Web Services Conclusion
A Document Format that Enables Services
Math markup on the web:
MathML (W3C standard supported by Mozilla/Firefox and
Opera), both presentational and semantic (“content”) markup
We enforce some underspecified aspects of the specification
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 6
7. Introduction Architecture Web Services Conclusion
Switching between Alternative Displays
<OMATTR>
<OMATP >
<OMS cd=" f o l d i n g " name=" a b b r e v "/>
Wpot (R)
</OMATP >
−e 2
4π 0 R/2
</OMATTR>
renders as
<m a c t i o n a c t i o n t y p e =" a b b r e v " s e l e c t i o n ="1">
−e 2
4π 0 R/2
Wpot (R)
</maction >
Here: prepared by the author. But also: undo/redo of document
changes by other services
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 7
8. Introduction Architecture Web Services Conclusion
Grouping Subterms for Interactive Folding
Same as before, but always available (<maction
actiontype="folding">)
Example:
[1 + [2 · x ]] [1 + . . . ]
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 8
10. Introduction 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
<m a c t i o n t y p e =" e l i s i o n ">
<mspace/>
<mo f e n c e =" t r u e " omdoc : e g r o u p =" f e n c e "
omdoc : e l e v e l ="100">(</mo>
</maction >
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 10
11. Introduction 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 / j o b a d . 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 −l o o k u p " , " Look up d e f i n i t i o n " ,
" h t t p : / / j o b a d . mathweb . o r g / backend ? a c t i o n=d e f i n i t i o n −
&c d b a s e=$ c d b a s e&cd=$cd&name=$name " ) ;
</ s c r i p t>
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 11
12. Introduction 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
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 12
13. Introduction Architecture Web Services Conclusion
Definition and Type Lookup
Input: ID of a symbol σ; output: content-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
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 13
14. Introduction 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)
Future: preselect admissible conversions by client/server
negotiation
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 14
15. Introduction 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. The MMT system is one.
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 15
16. Introduction Architecture Web Services Conclusion
Conclusion
Architecture for interactive mathematical documents
Reader can interactively adapt appearance
Document interacts with web services
Knowledge representation: MathML maxed out (but degrades
gracefully)
Initial set of local and remote services, server can advertie
additional services
Try the demos at https://jomdoc.omdoc.org/wiki/JOBAD
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 16
17. Introduction Architecture Web Services Conclusion
Future Work
Services that we have thought about:
Notation selection
Guided tours (extension of lookup)
Flattening (of theory imports)
Search (this or similar formulae)
Links to web resources (e. g. Wikipedia)
Adaptive display of statement-level structures (proofs, rhetorical
structures)
Editing
Saving (first adapt a document, then save that state on the
server)
Your wishes?
Lange, Rabe, Giceva (Jacobs University) Integrating Web Services into Interactive Mathematical Documents 2, 2009
April 17