Service Oriented Framework For Analysis

SARA (Semantic Analysis of RESTful APIs)

We propose the SARA approach for the analysis and detection of linguistic patterns and antipatterns in RESTful APIs. SARA takes advantage of a second order semantic similarity metric and Latent Dirichlet Allocation (LDA) topic modelling technique to detect linguistic patterns and antipatterns. SARA consist of four steps as shown in the Figure below:


Step 1. Analysis of Linguistic Patterns and Antipatterns: This manual step consists in analysing the description of REST linguistic patterns and antipatterns from the literature to identify the properties relevant to their detection.We use these relevant properties to define algorithmic rules for patterns and antipatterns.

Step 2. Implementation of Interfaces and Detection Algorithms: This manual step involves the implementation of detection algorithms for patterns and antipatterns based on the rules defined in Step 1 and the service interfaces for RESTful APIs, which include the list of methods to be invoked.

Step 3. REST Methods Invocation: This automatic step deals with the consumption of RESTful APIs by calling their methods to access their underlying methods automatically from the interfaces defined in Step 2.

Step 4. Detection of Linguistic Patterns and Antipatterns: The last automatic step deals with the semantic analysis of resource URIs and API documentations by applying automatically the detection algorithms (implemented in Step 2) on resource URIs and documentations of RESTful APIs obtained in Step 3 for the detection of linguistic patterns and antipatterns.

Semantic Analysis of RESTful APIs

The semantic analysis of REST URIs and documentation involves four automatic steps (as shown in the Figure below): (1) collection of APIs documentation corpus and performing some pre-processing, e.g., exclusion of stop words; (2) truncating URI nodes to their base form, i.e., lemmatisation, using Stanford Core NLP; (3) based on the collected corpora, performing topic model extraction relying on LDA; and, (4) measuring the second order similarity between the acquired topic model and nodes in a URI.


The SOFA Framework

The SOFA framework uses a Service Component Architecture (SCA) [8]. It relies on FraSCAti [33] for its runtime support. In a previous work [27], we added 13 REST patterns and antipatterns related to the design of RESTful requests/responses. Then, we extended SOFA with detection support of RESTful linguistic patterns and antipatterns using linguistic analyses based onWordNet and Stanford CoreNLP [28]. For this paper, we further extend SOFA for the semantic analyses of RESTful resource URIs and their documentations for the detection of REST linguistic patterns and antipatterns relying on LDA topic modeling technique [7] and DISCO-based second order semantic similarity metric.

Specifically, we extended the REST Handler component to facilitate the detection of RESTful linguistic patterns and antipatterns by wrapping each RESTful API in an SCA component and applying the detection algorithms on the SCA-wrapped RESTful APIs. By wrapping each API, we can introspect each full request URI with its actual runtime parameters, relying on FraSCAti IntentHandler, a runtime interceptor. We invoke methods from a service interface defined with an IntentHandler to introspect the request details, which allows on-the-fly syntactic and semantic analyses of parameterised request URIs and their corresponding documentation. The Figure in the below shows the SOFA framework positioning the end user who executes the framework to perform the detection.


Linguistic Antipatterns in RESTful APIs

The REST linguistic antipatterns that we defined as heuristics and detected are described here.

List of RESTful APIs

All the RESTful APIs that we analysed are listed here.

Experiments and Results

Our Hypotheses:

H1. Accuracy:The set of all defined rules have an average precision and recall of more than 75%, i.e., at least three out of four are true positives and we do not miss more than one out of four of all existing patterns and antipatterns.

H2. Extensibility:Our SOFA framework is extensible and allows adding new service-oriented and REST patterns and antipatterns. In addition, SOFA facilitates the integration of new RESTful APIs.

H3. Performance: The implemented detection algorithms can perform their task with low detection times|namely, on average, in the order of seconds.

Linguistic patterns and antipatterns detected in 15 RESTful APIs using SARA approach.

Detection results of the 10 REST linguistic patterns and antipatterns (numbers in parenthesis show the number of methods tested for each API).

Comparison between the DOLAR and SARA approaches for the detection of Contextualised vs. Contextless Resource Names.

Detection results for Pertinent vs. Non-pertinent Documentation on 16 RESTful APIs.

Detection results for Pertinent vs. Non-pertinent Documentation: numbers in parenthesis are numbers of URI documentation analysed for each API.

Comparison of DOLAR and SARA validation results on Dropbox (Validation 1) and partial validation results on Facebook, Dropbox, Twitter, and YouTube (Validation 2). 'P' represents the numbers of detected positives and 'TP' the numbers of true positives.

Validation of Pertinent vs. Non-pertinent Documentation and Contextual vs. Contextless Resource Names using SARA.

Detailed Detection Results for all Request URIs

The following data-set contains all results for all request URIs from all the RESTful APIs we analysed.

1. Alchemy
2. Bestbuy
3. Bitly
4. Charlieharvey
5. Dropbox
6. Externalip
7. Facebook
8. GoogleBook
9. Instagram
10. Linkedin
11. Musicgraph
12. Ohloh
13. Stackexchange
14. Teamviewer
15. Twitter
16. Walmart
17. YouTube
18. Zappos


Logo Logo