Building Intelligent Mashups

32
Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009 Building Intelligent Mashups An Introduction Adrian Giurca BTU Cottbus Dept. of Internet Technologies http://www.informatik.tu-cottbus.de/~agiur ca/ http://adrian-giurca.blogspot.com

Transcript of Building Intelligent Mashups

Page 1: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Building Intelligent MashupsAn Introduction

Adrian GiurcaBTU Cottbus

Dept. of Internet Technologies

http://www.informatik.tu-cottbus.de/~agiurca/ http://adrian-giurca.blogspot.com

Page 2: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

About me

• Adrian Giurca (42 years old)• I'm with BTU Cottbus from 2005 • Previously I was with University of Craiova, RO (from

1990)• I did my PhD (Dr. rer. nat) at University of Bucharest,

RO • During the last 15 years, I taught Logic Programming,

Natural Language Processing, Software Engineering, Project Management, Web Technologies, eBusiness Technologies, Semantic Web, and some others.

Page 3: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

This talk is about mashups

• What is an Intelligent Mashup?• How to build intelligent mashups?

• This talk is not about data but about software• Creating content is expensive but using it is

much more easy• We like users to create data and services

Page 4: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

What is a mashup?

• A mashup is a new song that is mixed from the vocal and instrumental tracks from different source songs (usually belonging to different genres).

• How the mixing is done gives the value of the mashup

• A Web Mashup is a Web application that is mixed from different other Web applications (usually belonging to different domains).

Page 5: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Why we need mashups

1. To increase innovation by unlocking and remixing information in ways not originally planned for.

2. To discover new business insights by easily assembling information from multiple sources.

3. To reduce development costs through lightweight integration, reuse and sharing.

4. To increase agility by supporting dynamic assembly and configuration of applications.

5. To speed up the development, usually using visual artifacts

Page 6: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

A Simple Mashup Classification

1. Server-Side Data Mashup – It is still hard to mashup up data across databases from different vendors.

2. Server-Side Software Mashup - Service orchestration, service choreography?

3. Client-Side Data Mashup - combines remote data (from, feeds, XML, or plain HTML ). New knowledge that didn’t exist before can result.

4. Client-Side Software Mashup - the application code is directly integrated in the browser to result in a distinct and new capability. There is a considerable browser potential in being able to easily wire together services into new functionality.

5. Presentation Mashup - Showing existent information in another way (e.g. Ajax Based “desktops”).

Page 7: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

IBM Trip Planner

• Many similarities with typical Web applications • Low or none user innovation/creativity. Users cannot

customize/add services (I want to use my own Weather Service!) …

Page 8: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

iGoogle

• … probably the most complex user-defined mashup

• ... is a collection of Gadgets • ... but Gadgets are

proprietary technology • … as well Microsoft

Gadgets, Apple Widgets, ...

• Users would like to build mashups by mixing from different services and platforms

• Users have to design to build their mashups

Page 9: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Real Mashups are client-side

• Server-side mashups look like classical server applications but using Data and API’s/Services offered by many platforms (Google, Amazon, Yahoo, YouTube, Flickr, Reuters, CNN, …). They have to be built by skilled programmers

• Client-side mashups are created by users (business people), typically using widgets (as programming components) and feeds (as data components).

Page 10: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

What is an Intelligent Mashup?

• An Intelligent Mashup uses Artificial Intelligence reasoning techniques to combine different Web Sources (Web Data, Web Services and Web Applications).

• Using both usual data (XML, Atom, RSS, HTML) and Semantic Web data (RDF, RDFS, OWL) allows reasoning on the Semantic Web, too.

• One way doing AI is to embed rule-based reasoning inside mashups.

Page 11: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Open Issues: Doing Business with Mashups

• How one can sell a mashup? (SaaS?)• What is the lifetime of a mashup?• How to deal with the lifetime of the data

sources we use? What about services we use?• What are the legal aspects involved in

mashups?

Page 12: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Open Issues: Modeling, Design and Reasoning

• What is a mashup information model? (Ongoing Research on Widgets standards)

• What are the mashup business processes? (A BPMN extension?)

• How to model the user behavior on the mashup page? (A rule-based model?)

• How to reason on the basis of user activity? (JSON Rules?)

Page 13: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Open Issues: Implementation

• How to catch user activity? (users interacts with HTML forms and events (DOM Events)...)

• What's happening when a data source is unavailable? Do we have to define exceptions/faults? (Probably yes)

• How to prohibit malware code? (use frameworks? )

• How can be implemented widget dependency i.e. how we exchange data between widgets? (With forms, events and rules?)

Page 14: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Lets Do Intelligent Mashups

• … software mashups

• … using AI techniques to implement reasoning

• …can play both server-side and client-side:o server-side: using reasoning engines (rule-based reasoning ,

description logic based reasoning, …) o client-side: using client-side reasoning engines (?)

Page 15: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Reasoning inside server-side mashups

• Old knowledge better infrastructure and technologieso Classical AI applications tailored by actual technologies (e.g.

running Drools instead of CLIPS or running Jena Rules instead of Prolog rules) providing better integration with the existent middleware

o AI based combination of (Semantic) Web Services

• Proso Deriving new knowledge assets using well known classical AI

applicationso Deriving intelligent Web Services (based on AI integration with

actual technologies) aka Semantic Web Services• Cons

o Need skilled developerso Less social

Page 16: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Reasoning inside client-side mashups

• Innovative AI applications using the browser infrastructure and technologieso combining remote information from different services together

with the information derived from the user activityo using Event-Condition-Action Rules to describe the reasoning

• Proso Designed and created by users (No high skilled developers)o Deriving new knowledge assets (e.g. new feeds)o Improving the user activity towards live achieving of the user

goals• Cons

o Consume the users hardware resources( Pros?)o Keep their data on third party serverso Security at the browser level

Page 17: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

2. How to build intelligent mashups

Challenges and potential solutions. What we achieved until now.

Page 18: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

The actual challenges

• No industry-wide agreement on a widget standard yet.

• Big players try to promote only their own APIs and services

• Security concerns around mashing internal data with external (non trusted?) API

• Potential for malicious, malformed code (rogue widgets)

• Industry looking to establish standard cross-domain secure communication mechanism

Page 19: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

A Proposal: JSON Rules

• Based on JSON (any rule is a JSON object)• Uses a Drools-like condition language• Uses JavaScript function calls as actions• Supports both Production Rules and• Event-Condition-Action Rules

Page 20: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

A Simple Rule and its Execution Effect

<div class='note'><ul><li>First issue</li><li>Second issue </li></ul></div>

<div class="note"><p>Another note</p></div>

On any occurrence of a "mouse click" on any element with class='note' having as first child an ul element, change the first child background color to blue.

Mouse click

Page 21: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Criticism

• This can be done immediately with JavaScript and event listeners

but– You should register listeners on all necessary

elements, or, using event bubbling one may have some simplification

– Event listeners implements just a simple kind of rule: ON event DO Action

– What about much more complex rules?

Page 22: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Can you do this fast with JS?

• [Usability] If The user reads Reuters news about swine flu, then deliver him similar news from CNN and possibly update his swine flu Google Map

• [Advertising] If the user loads financial news offers him a three months subscription to Financial Times

• [Accesibility] Whenever the user clicks more than 3 times a menu item add this item to the fast menu items.

Page 23: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Encoding the rule (JSON Rule)

{ "id":"rule101", "appliesTo": [ "http://www.mysite.com", "http://www.google.com/" ],"eventExpression": { "type": "click", "target": "$X" }, "conditions": [ "$X:Element( class == 'note', $Y:firstChild)", "$Y.tagName == 'ul'"], "actions": [ "changeBackground($Y, 'blue')" ] }

On any occurrence of a DOM click on any element with class='note' having as first child an ul element, change the first child background color to blue.

Page 24: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Basic components and roles

Page 25: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Internal Encoding (plain JSON)

{"id": "rule101","priority": 1,"appliesTo": ["http://www.mysite.com","http://www.google.com/"],"eventExpression":{ "type":"click", "target":{"variable":{"name":"$X"}} },"condition":[{"description":{"type":1, "binding": {"variable":{"name":"$X"}},"constraints":[{"propertyRestriction":{"property":"class", "operator":"EQ", "value":"note" } },{"propertyBinding":{"property":"firstChild", "variable":{"name":"$Y"} } } ]}},{"javaScriptBooleanCondition":"$Y.tagName == 'ul'"}],"actions":[ { "functionName":"changeBackground", "functionArgs":["$Y","blue"] } ]}

Page 26: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Basic engine activities

© E. Pascalau & A. Giurca (submitted paper at KESE 2009)

Page 27: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Using JSON Rules in Mashups

1. Embed the engine:

1. Create an engine instance and run a ruleset:

<script type="text/javascript" src="http://.../jsonRulesEngine_Version.js"></script>

var ruleSystem = new org.jsonrules.JSONRulesMainSystem();ruleSystem.run("http://.../rulesRepo.txt");

1. The mashup is ready to be used. The event manager listens for all DOM events and possible user-defined events and triggers corresponding rules accordingly.

You are not constraint on using only rules

Page 28: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Benefits and Drawbacks (1)

1. Easy Modeling – rules are a natural way to express things and relationships (are they ?)

2. Complex business workflows (mBPMN?);3. Declarative programming - (Some people like rules

some others not). 4. Information can be fetched and displayed in

anticipation of the user response;5. Support for intelligent user interfaces6. Allow re-syndication7. Service aggregation - Using ECA rules 8. Move the reasoning process to the client-side

resulting in reduced network traffic and faster response;

Page 29: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Benefits and Drawbacks (2)

1. Search based on public Web services - via Ajax2. Complex side effects - Rule actions allow any

JavaScript function call3. Any presentation layer - Induced by CSS availability

(CSS is rule-based too)4. Pages can be updated in response to the user input,

including the usage of cached data;5. Speed - Scalability tests should be performed 6. Stability - As much as any other JavaScript-based

application7. Security - As much as any other JavaScript-based

application

Page 30: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Past and Present Work

• Analysis on basic mashup platforms (IBM Mashup Editor, Yahoo Pipes, Semantic Pipes, Microsoft Popfly, Google Mashup Editor) towards a top level ontology for defining mashup concepts (final stage – report will came soon)

• A Rule Language tailored to the DOM Processing supporting ECA Rules (different extensions wait their time)

• A Rule Engine (final stage - online soon)

Page 31: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

What we don't have but like to

• An extension of BPMN towards modeling mashup business processes (mBPMN)

• mBPMN patterns directly serialized to JSON Rules

• A tool for using mBPMN (Oryx?)• A complex use case (on the way)

Page 32: Building Intelligent Mashups

Future Trends in Service-Oriented Computing, Hasso Plattner Institut, Potsdam, June 18-19, 2009

Advertising

• We spread the world with some publications A. Giurca and E. Pascalau. JSON Rules, Proc. of 4th Knowledge Engineering and

Software Engineering, (KESE 2008), at KI 2008, September 23, 2008, Kaiserlautern, Germany.

E. Pascalau and A. Giurca. Towards enabling SaaS for Business Rules. ISM'2009, March 23-24, 2009, Leipzig, Germany.

E. Pascalau and A. Giurca. A Rule-Based Approach of Creating and Executing Mashups, 9th IFIP Conference on e-Business, e-Services, and e-Society (I3E 2009), September 23-25, 2009, Nancy, France.

• We'll give a tutorial at the 32nd Annual Conference on Artificial Intelligence (KI 2009) September 15–18, 2009, Paderborn, Germany (available online soon)

• Three more papers are under review (the engine architecture, the relationship with cloud computing, and the information model of an intelligent mashup)

• Two Master theses are defined (to be defended in 2010)