Вы находитесь на странице: 1из 2

Proof-based Automated Web API Composition and Integration

Ruben Verborgh1 , Thomas Steiner2 , Erik Mannens1 , Rik Van de Walle1 , and Joaquim Gabarro Valles2
1

iMinds Multimedia Lab Ghent University, Belgium


{ruben.verborgh,rik.vandewalle}@ugent.be
Universitat Politecnica de Catalunya Department LSI, Spain
tsteiner@lsi.upc.edu

Abstract
Many providers offer Web APIs that expose their services to
an ever increasing number of mobile and desktop applications.
However, all interactions have to be explicitly programmed
by humans. Automated composition of those Web APIs could
make it considerably easier to integrate different services
from different providers. In this paper, we therefore present an
automated Web API composition method, based on theoremproving principles. The method works with existing Semantic
Web reasoners at a Web-scale performance. This makes proofbased composition a good choice for Web API integration.
We envision this method for use in different fields, such as
multimedia service and social service composition.

cation, with automated integration, a machine would interpret


machine-readable documentation, choose an API and interact
with this API at runtime without human intervention. An important step in this direction is the automated matching and
composition of Web APIs. In this paper, we therefore present
an automated composition method for RESTdesc-described
Web APIs, building upon our previous work.

Related work

RESTdesc is a Web API description method that captures


the functionality of Web APIs, describing an HTTP request
and its preconditions and postconditions [7,8]. RESTdesc
descriptions are expressed in Notation3, which is a minor
subset of RDF, the main Semantic Web language.
Composition of Web interfaces has mostly been discussed
Keywords: service composition, Web API composition
in the context of so-called Big Web services, i.e., services
that do not conform to the REST principles [3], but rather
1 Introduction
employ HTTP as a tunneling protocol. Their composition,
however, requires specific software; correctness verification
The number of publicly available Web APIs grows at a tremenis an issue, and so is scalability [4]. In contrast, our method
dous rate. By the end of 2012, more than 8,000 APIs are availdoes not require specific software since RESTdesc has been
able, some of which are consulted billions of times per day [2].
designed to work with generic reasoners.
Thanks to these Web APIs, mobile and desktop application
developers can provide the functionality of many providers
services in their consumer applications. The provided services 3 Web API composition
range from social activities (e.g., share on Facebook or Twitter Two partial problems are involved in creating a composition:
over various detailed information supplies (e.g., maps, events, Matching is the decision whether the invocation of a Web
or weather), to highly specific needs (e.g., multimedia maAPI call An is sufficient (and somehow necessary) to
nipulation or language analysis). However, integrating these
execute another call Am . In logical terms, this means:
APIs into an application requires manual development work,
Am (ci , cj ) An (cj , ck )
with An (ci , ck )
such as writing the HTTP requests that need to be executed
So the postconditions cj of calling Am with precondiand parsing the returned HTTP responses. Instructions on how
tions ci enable calling An , whereas the preconditions ci
to write this code can often be found on the APIs website in
alone are not sufficient to call An .
the form of human-readable API documentation.
Chaining is the repeated application of matching, to generate
Part of an automated solution to this problem is machinea chain of Web API calls A1 . . . An where every two
readable documentation. On the lowest level, this documentasuccessive calls match, i.e., m < n match(Am , Am+1 ).
tion describes the message format and modalities; on a higher However, in the most general sense, a composition is not
level, however, it also explains the specific functionality of- a chain of calls, but rather a graph in which multiple calls can
fered by the Web API, so a machine can autonomously decide provide the preconditions for another call. This indicates that
whether the API is appropriate for a certain use case. In the the problem of composition is more complicated than simply
past, we have proposed such a description method called determining all matches and identifying chains.
RESTdesc, which offers an efficient way to capture the funcInstead, we define a composition as an acyclic graph of
tionality of Web APIs [7,8] that is specifically tailored to Web API calls and distinguish between two kinds of composiREST or hypermedia APIs [6].
tions. In exploration-based composition, the task is to identify
The other part of the solution is automated composition graphs of API calls that are possible given the current appliand integration, which is the application of machine-readable cation state. In goal-driven compositions, an external agent
documentation to a specific problem. In other words, while (such as the user) indicates a certain goal that needs to be
programmers today need to interpret the human-readable doc- accomplished, and the composition is then a plan that satisfies
umentation to choose an API and to implement it in an appli- this goals conditions, starting from the current state.

Proof-based composition

1,000 API calls). The fastest reasoner in the test, EYE, was
able to create most compositions in well under one second on
The composition method we present in this paper is based an average consumer computer.
on the close relationship of logic implication and composition, and the fact that RESTdesc descriptions are in fact logic 6 Conclusion and future work
implication rules. The generalized notion of compositions as
a graph can be expressed as an implication:
In this paper, we have presented a reasoner-based composition
0
0
0
algorithm for RESTdesc-described Web APIs. A performance
An (cn , cn ) . . . Am (cm , cm ) Ak (ck , ck )
evaluation has indicated that our method is sufficiently fast to
or indeed, as logical entailment:
perform on a Web scale.
An (cn , c0n ), . . . , Am (cm , c0m ) ` Ak (ck , c0k )
We currently have an implementation in the domain of
In the above case, the Web API calls An to Am are necessary sensor networks [5], but plan to test this approach to other
to execute Ak . Stated differently, Ak is provable with An domains. One interesting direction we plan to investigate is
to Am . This means that the generation of a composition essen- multimedia analysis and adaptation, thus communicating with
tially comes down to generating a proof that the invocation of multimedia algorithms through Web APIs and then chaining
selected Web APIs leads to the fulfilment of a predefined goal, them together to perform complex actions in an automated
wherein a goal is defined as a desired end state entailed by the way, where compositions are dynamically generated according
combined postconditions. Concretely, to determine whether to the users needs.
a goal g can be reached from an initial state i, we should
construct a series of implications formed by Web API calls, Acknowledgements
which will form an implication graph that proves g from i.
RESTdesc describes Web APIs indeed as logic rules, ex- The described research activities were funded by Ghent Unipressed in Notation3, which has an associated logic frame- versity, the Institute for the Promotion of Innovation by Sciwork called N3Logic [1]. Therefore, composing RESTdesc- ence and Technology in Flanders (IWT), the Fund for Scientific
described APIs is possible by building an N3Logic proof with Research Flanders (FWO Flanders), and the European Union.
these descriptions. Several generic Notation3 reasoners exist
and due to the design of RESTdesc descriptions, they all are References
natively capable of generating RESTdesc compositions.
1. Berners-Lee, T., Connolly, D., Kagal, L., Scharf, Y., Hendler, J.:
The reasoner is supplied with the following inputs:
N3Logic: A logical framework for the World Wide Web. Theory
The initial state as an RDF document, which describes curand Practice of Logic Programming 8(3), 249269 (2008), http:
rently available resources and their state.
//arxiv.org/abs/0711.1533
Web API descriptions in RESTdesc format of various APIs
2. DuVander, A.: 8,000 APIs: Rise of the enterprise (Nov
the user has access to.
2012), http://blog.programmableweb.com/2012/11/26/
The goal state (optional) as an RDF document, which de8000-apis-rise-of-the-enterprise/
scribes the desired resource state.
3. Fielding, R.T., Taylor, R.N.: Principled design of the modern Web
If the goal state is omitted, the composition will be explorationarchitecture. Transactions on Internet Technology 2(2), 115150
(May 2002), http://dl.acm.org/citation.cfm?id=514185
based, meaning the reasoner will construct compositions
where the initial state is a precondition (possibly limited to 4. Milanovic, N., Malek, M.: Current solutions for Web service
composition. IEEE Internet Computing 8(6), 5159 (Nov 2004)
a certain number of compositions or to compositions of a cer5. Verborgh, R., Haerinck, V., Steiner, T., Van Deursen, D.,
tain length). If the goal state is available, the composition will
Van Hoecke, S., De Roo, J., Van de Walle, R., Gabarro Valles,
be goal-driven, meaning that only compositions will be found
J.: Functional composition of sensor Web APIs. In: Proceedings
that achieve the specified goal.
of the 5th International Workshop on Semantic Sensor Networks
(Nov 2012), http://ceur-ws.org/Vol-904/paper6.pdf
6. Verborgh, R., Steiner, T., Van Deursen, D., Coppens, S.,
5 Evaluation
Gabarro Valles, J., Van de Walle, R.: Functional descriptions
as the bridge between hypermedia APIs and the Semantic Web.
An important question is whether the proposed solution perIn: Proceedings of the Third International Workshop on RESTful Design. pp. 3340. ACM (Apr 2012), http://www.wsforms well on a Web scale, thus with hundreds of Web APIs
rest.org/2012/proc/a5-9-verborgh.pdf
and for compositions of various lengths. We have conducted
experiments with the EYE and cwm reasoners using a bench- 7. Verborgh, R., Steiner, T., Van Deursen, D., De Roo, J., Van de
Walle, R., Gabarro Valles, J.: Description and Interaction of RESTmark suite [5] that is freely available online.3 The benchmark
ful Services for Automatic Discovery and Execution. In: Proceedconsists of a description generator, which purposely creates
ings of the FTRA 2011 International Workshop on Advanced
descriptions that match on a given initial and goal state, and
Future Multimedia Services (Dec 2011)
a benchmarking utility that evaluates the performance.
8. Verborgh, R., Steiner, T., Van Deursen, D., De Roo, J., Van de
The results indicated that proof-based composition is posWalle, R., Gabarro Valles, J.: Capturing the functionality of
sible even for complex compositions (e.g., with more than
Web services with functional descriptions. Multimedia Tools and
Applications (2013), http://www.springerlink.com/index/
3
http://github.com/RubenVerborgh/RESTdescd041t268487gx850.pdf
Composition-Benchmark

Вам также может понравиться