ICT role in 21st century education and its challenges
MUp Early Preview V6
1. M ( em-’up )
A Functional Logic Programming Mashup Language
!
Early Preview
Monday, March 2, 2009 1
2. Agenda
• What is MUp?
• Features
• How it works
• Console & Tools
• MUp architecture
• MU language
• Examples
• Validation scenarios
• Comparison with similar products
• Results
• RoadMap
• Project Resources
Monday, March 2, 2009 2
3. What is MUp (1)
• MUp stay for Mash Up.
• MUp is a framework for creating mashup of web contents.
• MUp is based on a specific high level language called MU.
• MUp is written in Java.
• MUp defines two runtime profiles : JRE and Javascript.
Monday, March 2, 2009 3
4. What is MUp (2)
• MUp is compiled in Javascript with GWT (Google Web Toolkit).
• MUp Javascript profile runs entirely client side (inside a browser).
• MUp can be used client side to define Javascript widgets embedded in Web pages.
• MUp can be used server side to integrate heterogeneous contents.
Monday, March 2, 2009 4
5. MUp Features
• Simplifies data aggregation and transformation.
• Provides support for unification of JSON objects over JSON models.
• Provides Graph manipulation native support.
• Provides Type Morphing support.
• Provides (forward) XPath native support.
• Provides JSONPath native support.
• Provides UI Induction capabilities.
Monday, March 2, 2009 5
6. How it works (1)
MUp supports a special language to perform data mashing,
this language is called MU.
MU is both a logic and functional language, it provides also procedural constructs.
All predicates provided by MU can be grouped in functional sets.
The main functional sets are:
Source Operations: allow to retrieve web resources.
Inspect Operations: allow to decompose data retrieved from Web.
Model Operations: allow to create JSON models from raw data.
Renderization Operations: allow to renderize JSON models.
Monday, March 2, 2009 6
7. How it works (2)
MU functional sets:
XPath JPath
Get Post
Type
Source Operations Inspect Operations
Context PContext Jsonize Apply
Renderize
Unify
StackTrace
Model Operations
Context operations
Renderization Operations
Substring Regex
if for
Add Put
Flow Control String Operations
Remove
Data operations
-
Type As<Type>
+ /
* == <
%
Type Management
OR != AND
Math Operations
Conditional / Logical
Operations
Monday, March 2, 2009 7
8. A simple processing flow
a
b
Get Post
c Source() : Get('http://www.mysource.org/rss');
d
Source Operations
a Type Path
b
Entries() : Path('/rss/item/description', Source() );
c
d Inspect Operations
Jsonize
Model() : Jsonize('{ entry : quot;_quot; }', Entries() );
[a,b,c,d]
Model Operations
a
Renderize
b
GUI() : Renderize( Model() );
c
d Renderization Operations
Monday, March 2, 2009 8
9. A complex processing flow
a e
b f
Get Post Get Post
c g
d h
Source Operations Source Operations
a e
b f
Type Path Type Path
c g
Inspect Operations Inspect Operations
d h
Jsonize
[ [a,b,c,d] , [e,f,g,h] ]
Model Operations
a e
b f Renderize
Renderization
c g Operations
d h
Monday, March 2, 2009 9
10. MUp Console (1)
MUp provides a Web console that can be executed inside any browser
supported by GWT (Firefox, Safari, IE).
MUp Console provides a text area to launch commands and an
operation’s history.
Monday, March 2, 2009 10
11. MUp Console (2)
Console Tab
Executed
command
Command
result
command
input area
Monday, March 2, 2009 11
12. MUp Console: tools (1)
Editable
Inspector Panel
Tree view
JSON Inspector
Editable
Text view
Monday, March 2, 2009 12
15. MUp Architecture (2)
Console: the MU console.
Tools: the tools included in the console.
MU Core : provides core functionalities for the MUp framework.
Parser: parser for MU language.
GUI: GUI abstraction able to renderize JSON objects in widgets.
Monday, March 2, 2009 15
16. MUp Architecture (3)
Processor: abstract processor able to interpret compiled MU operations.
Cast Manager: provides support for type morphing.
Digester: XML/HTML generic path digester.
Native: abstraction layer of native implementation.
JRE Native : implementation of Native layer in Java Runtime Environment.
GWT Native : implementation of Native layer on GWT Javascript.
Monday, March 2, 2009 16
17. MU Language (1)
MU is based on an hybrid programming paradigm based on functional, procedural and logic
constructs.
An example of procedural expression is:
Procedure(a,b) : r1=Process(a), r2=Process(b), if( Gt(r1,r2), Process(r1), Process(r2) );
An example of functional expression is:
Function(a,b) : sum( F1(a), F2(b) );
An example of logic expression is:
Predicate(a,b) : P1(a) & P2(b) | P3(a,b);
Monday, March 2, 2009 17
18. MU Language (2)
MU native types JSON counterpart
BooleanValue boolean
NumericValue integer / float
StringValue string
ListValue array
MapValue object
GraphValue object
JSONValue object
Monday, March 2, 2009 18
19. MU Language (3)
MU language types are polymorphic: every native type can be always
casted to another native type.
Casting among primitive types is managed by Cast Manager.
Boolean
Non
Numeric
primitive
JSON String
List
Graph
!
Under Development
Map
Monday, March 2, 2009 19
20. MU Advanced Language (1)
MU supports Erlang/Prolog language features like predicate overloading.
Factorial(0) : 1;
Factorial(n) : Mult( n , Factorial( Minus(n,1) ) );
Predicate overloading is based on unification: given a set of predicates with the same name, it
will be invoked the first predicate in order of definition which signature unifies with given
arguments.
Unlike Erlang/Prolog, MU implements unification over JSON data structures.
Monday, March 2, 2009 20
21. MU Advanced Language (2)
Unification samples:
# Basic unification #
P1(a, b, c) =::= (List(1,2,3)) ==> P1(a:=1,b:=2,c:=3)
# List unification. #
P1([a,b|c]) =::= (List(1,2,3,4,5)) ==> P1(a:=1,b:=2,c:=[3,4,5])
# Object unification. #
P1( { “k1” : a, “k2” : b | o} ) =::= ({“k1” : 1 , “k2” : “2”, “k3” : “3”}) ==> P1(a:=1,b:=”2”,c:={ “k3” : “3” })
Monday, March 2, 2009 21
22. MU Language Examples (1)
# This is a comment. #
PI() : 3.14; # Declaring a const. #
Const() : quot;This string is const.quot;;
# Functional programming. #
TriangleArea(l1, l2) : Div( Mult(l1,l2), 2 );
MinorOf(a,b) : if( Lt(a,b), a, b );
# Iterative constructs.
PrintRange(start, stop) :
for( Range(start,stop,1), x, Print(x) );
Monday, March 2, 2009 22
24. MU Language Examples (3)
# JSON Path integration #
var = DoSomething(), var.p1.p2.p3[i];
# XPath integration #
var = GetFeed(), var//title;
!
Under Development
Monday, March 2, 2009 24
25. MU UI Model
UIButton
UILabel
UIComponent
UITextArea
UIList
UIPanel
UIContainer
UIWindow
Monday, March 2, 2009 25
26. GUI Induction (1)
The GUI Induction is the ability of the language of
automatically generate a GUI for a JSON data. In
The Renderize() predicate provides the hidden processing
flow shown on the right. JSON data
To customize the GUI generation it is possible to use the
couple Modelize() / Concretize() instead of the Renderize() Modelize()
operation.
JSON UI
Apply()
The Modelize() operation generates a JSON UI Model by Model
applying a set of default transformations.
Concretize()
The JSON UI Model can be customized by using the Apply()
operation.
GUI native
model
The Concretize() operation transforms a JSON UI Model in a
GUI Native Model .
Out
!
Under Development
Renderize()
Monday, March 2, 2009 26
27. GUI Induction (2)
Examples of GUI Inductions based on the unification are:
# Change Background color. #
ChangeBG( { “background” : bg | o } ) : Add(o, Map(“background”, “red”) );
# Change panel orientation if size exceed 10. #
ChangePO( { o } ) : if( Gt( Size(o), 10 ) , Add(o, Map(“orientation”, “vertical”) ) );
!
Under Development
Monday, March 2, 2009 27
28. Validation scenarios
Validation scenarios are applications of MUp on real and synthetic
data meant to verify the applicability of all the implemented
features.
Monday, March 2, 2009 28
29. Synthetic validation scenario:
description
“We have a Web service S1 returning a list of restaurants in a
specified city, providing for each restaurant the street in which it is
located.
We've also a Web service S2 returning a list of hotels near a given
street.
We want to combine these sources to obtain a list of restaurants
in a given city with a sublist of hotels near each restaurant.”
Monday, March 2, 2009 29
32. Real validation scenario:
description
“Given an RSS feed extract all title elements inside it and show a
panel containing them.”
Monday, March 2, 2009 32
36. Results / Issues
• The GWT profile raises problems when recompiling with
performance flags.
• GWT is not enough mature for the complexity of this
project, in the following months resources will be invested
on the JRE profile.
Monday, March 2, 2009 36
37. RoadMap (1)
( http://code.google.com/p/em-up/wiki/RoadMap )
Ongoing Tasks
• Implement the GraphValue data type:
1. implement the core type. (2) DONE
2. implement the manipulation operations. (3) DONE
3. implement the triple syntax. (3)
4. add graph search and transformation operators. (3)
• Add support for JSON storaging and querying. (4)
• Empower the JSON Model syntax. (3)
Monday, March 2, 2009 37
38. RoadMap (2)
Rewrite the MUp Console Shell with Gwt-EXT. (3)
Complete the User Documentation. (3)
Complete the build system. (2)
Add command-line console. (3)
Complete the XPath support (some operators are missing).
Monday, March 2, 2009 38
39. RoadMap (3)
Complete the JSONPath support (some operators are missing).
Add Regexp support for string manipulation. (2)
TODOs reduction in code and documentation. (10)
Add arithmetic expression support in language. (2)
--- MILESTONE ---
Monday, March 2, 2009 39
40. Documentation & Code
The MU documentation is hosted in
http://code.google.com/p/em-up/
and can be found here:
The MU source code will be released soon under the
Apache License,Version 2.0 .
Monday, March 2, 2009 40
41. Articles
“MU: an hybrid language for Web Mashups”
Davide Palmisano & Michele Mostarda
TODO: add Article URL
!
Under Development
Monday, March 2, 2009 41