Mapping the Responses of RESTful Services Based on their Values

23
MAPPING THE RESPONSES OF RESTFUL SERVICES BASED ON THEIR VALUES Blerina Bazelli, Marios Fokaefs, Eleni Stroulia University of Alberta, Canada

Transcript of Mapping the Responses of RESTful Services Based on their Values

Page 1: Mapping the Responses of RESTful Services Based on their Values

MAPPING THE RESPONSES OF RESTFUL SERVICES BASED ON THEIR VALUES

Blerina Bazelli, Marios Fokaefs, Eleni Stroulia

University of Alberta, Canada

Page 2: Mapping the Responses of RESTful Services Based on their Values

(Not always) A match made in heaven

A client-service relationship may break when: A web service becomes unavailable It becomes insufficient for the clients’

needs It changes frequently over time Its price increases

The client will migrate to another service.

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 3: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

7 years6,000 APIs

3,000 news stories

A Wealth of Similar(?) APIs

Page 4: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Three steps for API migration Discovery

Comparing the desired API against available ones To recognize if the differences are possible to adapt

Selection Comparing the desired API against a set of

discovered ones To identify the “best” one to use

Mapping Comparing two similar APIs To precisely decide how to adapt one to match the

other (for composition or for substitution)

Page 5: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

How to Recognize API Substitutability?Previous Approaches

Based on the similarity of signature syntax

Same operations, with same number and types of input/output data

signature specification Same pre- and post-conditions

signature semantics Synonymous identifiers (operations,

parameters)

Page 6: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

How to Recognize API Substitutability? Our Approach

Based on the similarity of the input and output values of their

corresponding invocations If two parameters have the same

instance value, they refer to the same thing.

Why responses? REST resource-based services Request Data Functionality

Analysis

Page 7: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

The Methodology

Interactive Steps1. Identify two substitutable APIs2. Map their corresponding operations3. Invoke the corresponding operations

pairwise, with the same parameter values

Automated Step4. Use the proposed algorithm to precisely

map the output parameters

see Future Directions

Page 8: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Comparison Rules –numbers

n1=106 n2 = 93

distance = 100 (13/106) = 12.2%

Page 9: Mapping the Responses of RESTful Services Based on their Values

Comparison Rules –strings

kitten → sitting kitten → sitten (substitution of "s" for "k") sitten → sittin (substitution of "i" for "e") sittin → sitting (insertion of "g" at the end)

distance = 100(3/7 ) = 42.8%

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 10: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Comparison Rules –bag of words

S1 = {a,b,d,e} S2 = {a,b,f,g,h}

distance = 100(1-2/4) = 50%

Page 11: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Comparison Rules –inclusion

When comparing two elements, If one is a prefix or a suffix of the other, Then they are similar

106 min

runtime movie_length

Page 12: Mapping the Responses of RESTful Services Based on their Values

Heuristics

String vs. String

String vs. Number

Number vs. Number

Date vs. Date

1. Transform to lowercase2. Compute Levenshtein

distance

Extract the number sequences

Maximum computed similarity

Inclusion

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Page 13: Mapping the Responses of RESTful Services Based on their Values

Evaluation

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

When is this method applicable?

When the APIs refer to a commonly shared domain of factual information Non factual judgment may cause

differentiation to the values of entities Proprietary the values of entities will not

be common across APIs

Page 14: Mapping the Responses of RESTful Services Based on their Values

Evaluation

1. Geolocation

2. Movies

Google Maps Microsoft Maps CloudMade Maps

Internet Movie Database (IMDb)

Rotten Tomatoes Filmaster TheMovieDB

Domains Web Services

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 15: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Results

Page 16: Mapping the Responses of RESTful Services Based on their Values

Source & Target elements that have been mapped correctly

Elements wrongly mapped as correct

Mapped only manually

First-best mapping: Precision & Recall

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 17: Mapping the Responses of RESTful Services Based on their Values

Results – Geolocation

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 18: Mapping the Responses of RESTful Services Based on their Values

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Results – Movies

Page 19: Mapping the Responses of RESTful Services Based on their Values

Many-to-many mapping :Mean Average Precision

p: pair of elements P: number of elements that can be

mapped AvePre: average precision per element

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 20: Mapping the Responses of RESTful Services Based on their Values

MAP: Geolocation

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 21: Mapping the Responses of RESTful Services Based on their Values

MAP: Movies

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands

Page 22: Mapping the Responses of RESTful Services Based on their Values

Future Directions

Combine more methods of comparison Instance value mapping Structure mapping Lexicographic and semantic mapping

Automate as many steps of the process as possible. Use a service discovery and selection

method. Extend the mapping process to input values

to map the operations. Automatically exercise the APIs (testing?)29th IEEE International Conference on Software

Maintenance 22 - 28 September 2013 - Eindhoven, The Netherlands

Page 23: Mapping the Responses of RESTful Services Based on their Values

Conclusions

A methodology for mapping services based on their run-time invocations

For Web services with factual and shared information, the evaluation demonstrated high precision & recall

The objective is to simplify the effort required to develop the adapters to migrate from one service to its substitute

29th IEEE International Conference on Software Maintenance 22 - 28 September 2013 - Eindhoven, The

Netherlands