<<

arXiv:2005.02628v1 [cs.NI] 6 May 2020 norgn eut speetd vlae,addiscuss and III. evaluated, Section presented, is cer – producing results – encouraging algorithm proposed properties The parameters, result). (the input output of the ontolo denotes an from that II. concepts on Section depending generated a in tomatically compositions valid described services, executing approach actually Without knowledge-based automaticall services a a suitable proposes select using paper to the able method services, novel Web REST-based order compose In language. to programming data-intercha ECMAScript JSON on well-known based as a format such Notation), Program formats Object lightweight (Application (JavaScript using APIs by State their pragm Interfaces) describe (REpresentational several ming to are REST able There the solutions [2]. style to architectural according Transfer) usu- (Extensible are built XML services Web ally this standardized Nowadays, dialect. context, a Language) Service Markup enterprise – (Web WSDL the Language) in Description In expressed traditionally interface. was interface public defin A functionality a popularity. vast straightforward through with a years provides tha many Service for Web [1] used (SOAs) already been Architectures has Service-Oriented of elements is oeln,AtmtcCmoiin SNL,OpenAPI JSON-LD, Composition, Automatic Modelling, tics, xed h eatckoldedfie yormodel. our by defined knowledge invo semantic algorith for composition the compositions adjusted extends an better semantic propose obtain also JSON-LD We to services. with order OpenAPI constructs in OpenAPI by (ontolo annotations these models expressed enhance knowledge APIs uses to proposal REST Our by specifications. Additionally, descriptions implemented on compositions. used services practically valid creat is manner, algorithm to composition matched inherite automatic are are an parameters properties how in Concept describes attri also type. paper define and The that name properties by concept expressed using level, parameter si a a models of concepts previous with as Most parameters reasoni model hierarchy. service cases. of describing semantic non-trivial automation in proper limited solve the the to enabling as required is required The standards functionality. is annotation specific multi new, aggregating semantics some of of create process to the services improve Web to aimed direction ntecretsfwr landscape, software current the In ne Terms Index the at expressiveness the increasing is method proposed Our Abstract AtmtcWbsriecmoiini research a is composition service Web —Automatic ae nOeAISmni Annotations Semantic OpenAPI on Based WbSrieCmoiin noois Seman- Ontologies, Composition, Service —Web e evc opsto Method Composition Service Web A .INTRODUCTION I. nriNtd,SbnC uaa alDa,LaaT¸ uc˘ar Liana Diac, Paul Buraga, C. Sabin Netedu, Andrei { icantd,bsc,pu.ic stefania.tucar paul.diac, busaco, mircea.netedu, e services Web lxnr onCz nvriyo a¸,Romania Ias¸i, of University Cuza Ioan Alexandru aut fCmue Science Computer of Faculty r h core the are fWeb of that m eau- re butes din ed and , mple by y gies) lved tain atic nge use the ple gy ng ed re d. e, - t on fve,tepopular the view, pragmatic a of From algorithm. point proposed the using busines by intelligent conducted for support IV. proper Section see the – offer operations to servic order de- involved each in of constructs easily description semantic OpenAPI JSON-LD be the by augmenting way, could pragmatic system. a knowledge in (micro)service-based scribed, involved complex the a Additionally, within costs duces euse’ entities. rep- form requester’s that that resource tasks abstract performing functionality an of capability as a viewed resents be can and o network interaction machine-to-machine inter-operable support e frltdmtosdsrbdb h aeitrae This specificati interface. various same adopting the by declared by be described could interface methods related of set Preliminaries A. o directions further and conclusions with research. ends and V. VI), Section tion in before, presented possible study be discove the not in to could as it necessary such where added was cases approach on that compositions Our conceptualization results. suitable expected augmenting a and descriptions parameters conceptual input services Web convey to edto,20 https://www.w3.org/TR/wsdl20/ – 2007 mendation, some having i.e. – https://www.w3.org/TR/ws-gloss/ at invoked parameters or as accessed values be some can using that time endpoint a minimal the or 2 1 o oiaigcs td,svrleprmnswr also were experiments several study, case motivating a For re- and productivity improves proposal our that think We • rmacmuainlpito iw e evc sa is service Web a view, of point computational a From A (Sec- approaches related various enumerates paper The • nti ae,w ee oaWbsriea a as service Web a to refer we paper, this In e evcsGosr,WCWrigGopNt,20 – 2004 Note, R Group W3C 2.0, Version Working (WSDL) Language Description W3C Services Web Glossary, Services Web SL20–acasclWbstandard Web classical a – 2.0 WSDL meta-language, ndfeetfraslk AL(e nte Markup Notation). API) Another Object (Yet (REST (JavaScript YAML JSON service or Web like Language) a formats of declar- different interface solution in modern public a the – ing Specification 3.0 OpenAPI e service Web rmtepito iwo rvdrsette and entities provider’s of view of point the from I RBE DEFINITION PROBLEM II. } @info.uaic.ro ersnsasfwr ytmdsge to designed system software a represents 1 schema.org 2 oe a chosen was model ae nteXML the on based igemethod single coherent a e a ver ecom- ons: e, s f r prior knowledge. In our context, we also work only with property is an instance of one or more concepts – this is “information providing” Web services, or stateless services denoted by domain property. that do not alter their state and are not sensitive to the outside Properties are inherited: if ca isA cb, and cb has world states, time or any external factors. some property hnamex,typexi then ca also has property The main focus of the proposed method is on improving hnamex,typexi. For example, if an apple is a fruit, and fruit the semantic description of services motivated by the lack has property hhasColor, Colori expressing that fruit instances of means of expressing several composition techniques on have a color, then apples also must have a color. previously known models and software solutions mentioned It is important that property names do not repeat for in Section VI. any unrelated concepts. For any concepts that are in a isA We enhanced the service composition problem by modeling relation, all properties are passed to the specialization one by semantics in the manner described below. It was inspired inheritance. This restriction is only imposed to avoid confusion by our previous experience and the shortcomings we found and does not reduce the expressiveness, as properties can be on expressing certain natural cases of composition. More renamed. precisely, it was not possible to describe service parameters Syntactically, to define a property, the following are to with properties or any relations/interaction between these be known: its name, its type, and the most general concept parameters. Adding the new elements to the problem definition that the property can describe. For example, consider that the is also done with inspiration from the used by hasColor property can describe the apple concept, but also the popular ontologies such as schema.org [3]. more general fruit concept. If concept fruit isA physicalObject, Using this approach, we managed to fix the issues that the next more general concept than fruit – i.e., its parent appeared in examples where the previous model failed. Our in the concepts tree –, under the assumption that not all main addition is consisting of concept properties and how physical objects are colored, then we can say that hasColor they are used for composition, allowing interaction between can most generally describe fruit, but not any physicalObject concepts and their properties based on simple constructions or any other more general concept. However, it can describe that increase the expressiveness. other concepts in the tree, together with all their descendants. For simplicity, we consider further that all the properties are B. Proposed Formal Model defined within C, thus the concepts, isA relation and properties Service parameters are defined over a set of concepts. Let structure are in C – the particular ontological model. C be the set of all concepts that appear in a repository of A partially defined concept denotes a pair (c, propSet), services, that are all possible concepts or the problem universe. where c is a concept from C and propSet is a subset of the As in the previous modeling, the concepts are first organized properties that c has defined directly or through inheritance by using the isA or subsumes relation. This is a binary relation from more generic concepts. At some moment of time (or between concepts and can be considered somewhat similar to in some stage of a workflow), a partially defined concept the inheritance in object-oriented programming. If a concept describes what is currently known about a concept. It does not ca isA cb then ca can substitute when there is need of a cb. refer to a specific concept instance, but rather generally to the Also, for any concept c in C, there can be only one direct, information that could potentially be found for any instance more generic concept then c, i.e. we do not allow multiple of that concept. inheritance. Obviously, isA is transitive and, for convenience, A Web Service w is defined by a pair of input and output reflexive: ca isA ca. This implies that C together with the isA parameters: (win, wout). Both are sets of partially defined relation form a tree (a taxonomy) or, more generally, a forest concepts. All are defined over the same structure C, so all (a set of taxonomies or a complex ontology). service providers must adhere to C, thus adding the require- ment that C is publicly available and defined ahead of time. In However, the new element added to the problem are concept order to be able to validly call a service, all input parameters properties. Any concept has a set of properties, possibly empty. in w must be known together with their specified required Each property p is a pair hname, typei. The name is just an in properties. After calling the service, all output parameters w identifier of the property, and for simplicity, it can be seen as out will be learned with the properties specified at output. a string – for concrete cases, this identifier is actually an IRI (Internationalized Resource Identifiers)3, a superset of URIs Parameter matching. Let P be a set of partially defined (Uniform Resource Identifiers). The type is also a concept concepts, and w = (win, wout) a Web service. The set P from the same set of concepts C and can be considered as the matches service w (or, equivalently, w is callable if P is range of a property. known) if and only if ∀ partially defined concept pdc = (c, From an ontological point of view [4], a property p is propSet) ∈ win, ∃ p = (cspec, propSuperSet) ∈ P such that defined as a relation between Web resources. The values of cspec isA c and propSet ⊆ propSuperSet. a property are instances of one or more concepts (classes) – We further define the addition of wout to P as: expressed by range property. Any resource that has a given

3IRI (Internationalized Resource Identifiers – https://tools.ietf.org/html/rfc3987 c has p P ⊕ w c, p c′, propSet′ w and p ∈ propSet′ ∄ c, propSet P (1) or P w = ∃( ) ∈ out ( ) ∈ ( ∪ out)  ′ !    c isA c   [ c has p  ′ ′ ′  c, propSet ∪ p ∃(c , propSet ) ∈ wout and p ∈ propSet ∃(c, propSet) ∈ P (2)  ′ !    c isA c   [

  or the union of wout with P under the constraint of P matching III. AUTOMATIC SERVICE COMPOSITION w (defined as parameter matching above). Also, by c has p ALGORITHM we refer to the fact that property p is stated for c directly A. Algorithm Description or by inheritance. P ⊕ w contains (1) new concepts that are The proposed algorithm is intended to describe a generic in w and (2) concepts already in P possibly with new out solution that generates a valid composition. Tough it considers properties from w specified for corresponding concepts or out some basic optimizations like special data structures and their specializations. indexes, there are many ways in which it can be improved, In words, after a call to a service, all its output parameters so we shortly describe some of them after the basic algorithm are selected, and for each concept together with its selected description. ′ properties (c, propSet) in wout, propSet is added to c, c s parent In a simplified form, considered main entities have the in the concepts tree or the ascendants until we reach the first following structure: node that gains no new information or the root. More precisely, class Concept { // full or partial type for each p in propSet we add p to our for c, Uri uri; // unique identifier String name; // a label for the parent of c, and so on until p is no longer defined for Concept parent; // isA relation the node we reached. The node where this process stops can // proper and inherited properties differ from one p property to another p′ property, but once the Set properties; process stops for all properties in propSet there is no need to } go further. class Property { Uri uri; // unique identifier String name; // a label Chained matching. Let P be a set of partially defined Concept type; // property’s range } concepts and (w1, w2,...,wk) an ordered list of services. We say that P⊕w1 ⊕w2 ⊕···⊕wk is a chain of matching services class WebService { Uri uri; iff w matches P ⊕ w1 ⊕ w2 ⊕···⊕ w −1; ∀i =1 ...k. This i i String name; is the rather primitive model for multiple service calls, that // I/O parameters is a requirement for defining the composition. For simplicity, Set in, out; we avoid for now more complex workflows that could handle } parallel and sequential service execution constructs. Global data structures that are most important and often used by the algorithm are presented below: Web Service Composition problem. Given an ontology // knowledge: concepts, isA, properties having a set of concepts C and a repository of Web services Set C; W = (w1, w2,...,wn), and two sets of partially defined concepts Init and Goal, all defined over C, find a chain // repository of services Set webServices; of matching services (wc1, wc2,...wck) such that (∅,Init) ⊕ // user’s query as two fictive services wc1 ⊕ wc2 ⊕···⊕ wck ⊕ (Goal, ∅). WebService Init, Goal;

The (∅, Init) and (Goal, ∅) are just short ways of writing // the known partially defined concepts the initially known and finally required parameters, by using // known.get(c) = concept’s known properties mock services. Map > known; We can also imagine (Init, Goal) as a Web (micro-)service // required.get(c).get(p) services that – in this context, the problem requires finding an “implemen- // have property p of concept C in input Map >> tation” of a Web (micro-)service using the services available required; in a certain development environment (e.g., a public or private repository). // remaining.get(w).get(c) = set. Then we simulate its call, basically by learning all its out- // properties of concept C put parameter information, with the help of callWebService() // necessary to call the W service method below. We add the selected service to the composition Map >> remaining; and remove it from callableServices so it won’t get called again. If callableServices empties before reaching the Goal, // services for which all input is already then the query is unsolvable. known Set callableServices; // ’discover’ and expand the output of a Web The algorithm described next uses the above structures, and service is composed of three methods: initialization, the main com- callWebService(WebService ws) { position search method which calls the last (utility) method, for (Concept c : ws.out) { Concept cp = c; // concept goes up in tree that updates the knowledge base with the new outputs learned // true if anything new was learned at level form a service call. boolean added = true; Several obvious instructions are skipped for simplicity like parsing input data and initializing empty containers. while (added && cp != null) { added = false; void initialize() { for (Property p : c.properties) { // read C, services, query as (Init.out, if (cp.properties.contains(p) && Goal.in) !known.get(cp).contains(p)) { Init.in = Goal.out = ∅ ; added = true; webServices.add(Goal); // learn p at cp level: known.get(cp).add(p); for (WebService ws : webServices) { for (WebService ws: for (Concept c : ws.in) { required.get(cp).get(p)) { for (Property p : c.properties) { remaining.get(ws).get(cp).remove(p); required.get(c).get(p).add(ws); if (remaining.get(ws).get(cp) remaining.get(ws).get(c).add(p); .isEmpty()) { } // container creation skipped } // all properties of cp in ws.in are } } known remaining.get(ws).remove(cp); After reading the problem instance, the described data } structures have to be loaded. Init and Goal can be used as if (remaining.get(ws). isEmpty()) { web services to reduce the implementation size, if they are // all concepts in ws.in known callableServices.add(ws); initialized as above. Then, for each parameter in service’s } } input, we add the corresponding concepts with their specified } } properties to the indexes (maps) that efficiently get the services cp = cp.parent; that have those properties at input and the properties that } } remain yet unknown but required to validly call a service. } List findComp(WebService Init, Goal) { List composition; //result When calling a Web service, its output is learned and also callService(Init); // learn initial expanded, i.e. we mark as learned properties also for more while (!(required.get(Goal).isEmpty() || generic concepts. This improves the algorithm’s complexity, callableServices.isEmpty())) { as it is better to prepare detection of newly callable services WebService ws = callableServices.first(); than to search for them by iteration after any call. This is callableServices.remove(ws); possible by marking in the tree the known properties for each composition.add(ws); level and iterating only to levels that get any new information, callWebService(ws); } as higher current service’s output would be already known. if (!remaining.get(Goal).isEmpty()) { The optimization also comes from the fact that all services return null; // no valid composition with inputs with these properties are hence updated only once } else { return composition; (for each learned concept and property). As it gets learned, } information is removed from the remaining data structure first } at the property level and then at the concept level. When The main method that searches for a valid composition there’s no property of any concept left to learn, the service satisfying user’s query is findComp(). The result is simplified gets callable. This can happen only once per service. The for now as an ordered list of services. As long as the Goal main loop might stop before reaching the tree root if at some service is not yet callable, but we can call any other new generalization level, all current services’ output was already service, we pick the first service from the callableServices known, and this is determined by the added flag variable. B. Possible Improvements number of services in the repository. The column result com- There are several improvements that can be added to the position size measures the length of the composition found by the algorithm. The last column, dependency list size, measures algorithm. One important metric that the algorithm does not consider is the size of the produced composition. As can the length of the composition generated by the tests generator algorithm. The dependency list constitutes a valid composition, be seen from the overview description above, the solution is hidden within the repository and may contain useless services both deterministic and of polynomial time complexity. This is possible because the length of the composition is not a neces- as the dependency is not guaranteed. sary minimum. Finding the shortest composition is NP-Hard IV. EXTENDING OPENAPI WITH JSON-LD even for problem definitions that do not model semantics. CONSTRUCTS The proposed model introduces properties, but this addition Another aim of this research is to show how current Ope- does not significantly increase the computational problem nAPI specification4 and our proposed extension to the JSON- complexity. Nevertheless, even if the shortest composition is LD model can be used for automatic Web (micro-)service hard to find, there are at least two simple ways to favor finding composition. shorter compositions with good results. One is based on the observation that when a service is A. From Formalism to Semantic Descriptions called, it is chosen from possibly multiple callable services. As a first step, we applied the above mathematical model This choice is not guided by any criteria. It is possible to add and algorithm for a set of Web services defined with the help of at least a simple heuristic score to each service that would OpenAPI specification expressed by JSON (JavaScript Object estimate how useful is the information gained by that service Notation)5 constructs. call. To take this even further, this score can be updated for OpenAPI specification is used to describe Web services the remaining services when information is learned. (APIs) aligned to the REST (REpresentational State Transfer) Another improvement is based on the observation that architectural style [2]. This specification defines in a standard- services can be added to the composition even if they might ized manner a meta-model to declare the interfaces to RESTful produce no useful information – there is no condition check APIs in a programming language-agnostic manner. that they add anything new, or the information produced could These APIs correspond to a set of Web services that forms also be found from services added later to the composition. a repository. For our conducted experiments, we considered To mitigate this, another algorithm can be implemented that an API as a collection of services where each different URI would search the resulting composition backward and remove path of the API denoted a different service – this can also be services that proved useless in the end. useful in the context of microservices. Thus, we can group Both of the above improvements can have an impact on the services based on information related to the location of the running time as well, as the algorithm stops when the goal is group of services. In practice, this is very useful as generally reached. a Web server would likely host a multitude of Web services. We used OpenAPI specification to describe the input and C. Empiric Evaluation output parameters of each different service. Those parameters To test the algorithm implementation, we first used some are Web resources that represent, in our mathematical model, handwritten examples, including the one in Section V. Then, partially defined concepts. OpenAPI also helps us match we implemented a random test generator to analyze the parameters on a syntactic level by specifying the data types performance on larger instances. of the parameters. The generator first creates a conceptual model (a dummy Example. As a real-life case, the public REST API (Web ontology) with random concepts and properties and then a service) provided by Lyft6 is described. For the operation of service repository based on the generated ontology. Service getting details about an authenticated user (GET /profile), parameters are chosen from direct and inherited properties. In the result – i.e., w.out in our mathematical model and, in fact, the last step, an ordered list of services is altered by rebuilding output data as a JSON object composed by various properties each service input. The first one gets its input from Init, which – is the following: is randomly generated at the beginning. Each other service in • id: string – Authenticated user’s identifier. order gets its input rebuilt from all previous services outputs, • first name: string – First name. or from valid properties of generalizations of those concepts. • last name: string – Last name. Finally, Goal has assigned a subset of the set of all outputs of • has taken a ride: boolean – Indicates whether the user the services in the list. The total number of services and the has taken at least one Lyft ride. list size are input parameters for the generator. The intended dependency between services in the list is not guaranteed, so Each property can have as a result – the range mentioned in shorter compositions could potentially exist. Section II – a datatype denoted by a concept, according to the

Table I shows the algorithm performance. The first two 4OpenAPI Specification – https://github.com/OAI/OpenAPI-Specification columns briefly describe the input size, by the number of 5JSON (JavaScript Object Notation) – https://json.org/ concepts and properties in the generated ontology and total 6Lyft API – https://developer.lyft.com/docs TABLE I: Algorithm run times and resulting composition size on random generated instances.

ontology size repository run time result composition dependency list (#concepts + #properties) size: #services in seconds size: #services size: #services 10 (5 + 5) 10 0.002 3 5 20 (10 + 10) 20 0.003 4 10 50 (30 + 20) 20 0.007 12 20 20 (10 + 10) 50 0.011 6 20 proposed mathematical model. The Web resources processed } } by a service are then linked to assertions embedded into JSON- } /* a response object composed by LD descriptions. All JSON-LD statements could be converted properties and values, e.g. { response: string } / into RDF (Resource Description Framework) or OWL (Web } * } Ontology Language) [4] to be further processed, including } } . For this example, the first name property of the returned an abstract JSON-LD annotation has the following form, JSON object could be mapped – via JSON-LD annotations – where the context is a knowledge model used to denote Web to the givenName property of Person concept (class) defined service entities and the Concept1 and Concept2 classes are by the schema.org conceptual model or – as an alternative – used for each parameter instead of a generic JSON datatype by FOAF (Friend Of A Friend) vocabulary7. Additionally, the (in this case, a string). output parameter – i.e., the returned JSON object – could be { seen as an instance of Person class. This approach could be "@context": "http://ontology.info/", further refined, if a Customer and Driver class are defined "@id": "parameter", as a subclass of Person concept. The subclass relation from "@type": "Concept1" // w.in the (onto)logical model – formally written as Customer ⊑ "response": { Person – is equivalent to the isA relation of the mathematical "@type": "Concept2" // w.out } formalism presented in Section II. Using this taxonomy of } classes, the algorithm could select the Web service as a candidate solution for Web service composition. Furthermore, a convenient mapping – a-priori given or Secondly, we chose the JSON-LD model to describe the automatically generated – between JSON datatypes (string, entities used by a group of services. For each different Web number, boolean, object, array) and ontological concepts could resource specified in the OpenAPI description of considered be attached as meta-data for the considered set of Web services Web services, a corresponding semantic description could in order to facilitate the matching process. This enhancement be stated. This semantic description attaches to each Web is inspired by ontology alignment strategies [5]. The mapping resource a URI specifying a concept in an ontology. Similarly, itself could be directly expressed in JSON-LD via @context for each property of the corresponding Web resource. construct used to map terms (in our case, datatype names and/or property names) to concepts denoted by URIs. The B. Generic Approach concepts, properties, restrictions, and related entities (such Generally, considering an OpenAPI specification stored in as individuals and annotations) form the knowledge base – a JSON document: usually, specified by using OWL and RDF standards [4]. { "openapi": "3.0.0", V. CASE STUDY: A TRANSPORT AGENCY "paths": { To illustrate the benefits of our approach, we have con- "/resource": { "get": { sidered the following example, according to the problem "operationId": "service", definition in Section II. Also, we have used concepts from "parameters": [ { schema.org. The services’ interfaces are stored in an OpenAPI "name": "parameter", compliant document. The resources (service parameters) are "in": "query", described via JSON-LD by using the method exposed in "schema": { "type": "string" } } ], Section IV. "responses": { The case study specifies the car company operating pro- "200": { cesses via web services. The car company services are simplis- "description": "Success", tic and perform small tasks that can significantly benefit from "schema": { a web service composition solution. Describing the services "$ref":"#/definitions/Response" using OpenAPI and JSON-LD, the approach showcases how 7FOAF (Friend Of A Friend) Vocabulary Specification – easy it is to represent complex relations between resources http://xmlns.com/foaf/spec/ by combining object-oriented concepts in both structure and semantics. On top of this, because the REST services are sim- The Java implementation of the algorithm from Section III ilar on an architectural level, the solution guarantees that the reads the OpenAPI specification document describing the situation presented in the case study can easily be extended and above scenario and finds the highlighted composition based on applied in real-world scenarios. For the conducted experiment, schema.org conceptual model. We also validated the OpenAPI our example contains six services, several resources, but also and JSON-LD files using available public software tools the query to be solved by a composition of all six services in included in Swagger Editor9 and JSON-LD Playground10. the correct order. The scenario is the following. We are supposing that a cus- VI. RELATED WORK tomer needs a vehicle to transport a given payload. This person Various approaches [6]–[8] were considered to tackle the knows his/her current GeoLocation(latitude, longitude) and a problem of Web service composition in the case of “classical” time frame Action(startTime, endTime) in which the transport specification of Web services by using the old SOAP, WSDL should arrive. The Goal is to obtain the Action(location) (Web Service Description Language), and additional WS-* where the vehicle will arrive. The six services – each of them standards and initiatives [1]. Also, several semantic-based implementing a single operation – are specified below: formal, conceptual, and software solutions are proposed by getCountryFromLocation using DAML-S and its successor OWL-S11 service ontologies in = GeoLocation(lat,lon) (in the present, they are almost neglected by the existing out = Country(name) communities of practice) and language extensions to Web getTransportCompany service descriptions. in = AdministrativeArea(name) For instance, the following initiatives, methods, and soft- out = Organization(name) ware solutions could be mentioned: getClosestCity • A mathematical model of the service in = GeoLocation(lat,lon) out = City(name) composition problem considering AI planning and causal link matrices [9]. getLocalSubsidiary in = Organization(name), City(name) • A linear programming strategy for service selection out = LocalBusiness(email) scheme considering non-functional QoS (Quality of Ser- vice) attributes [10]. getVehicle • in = Vehicle(payload), Automated discovery, interaction, and composition of the LocalBusiness(email) Web services that are semantically described by DAML-S out= Vehicle( ontological constructs [11]. vehicleIdentificationNumber) • A high-level conceptual architecture and model for Web makeArrangements service deployment, providing support for service inter- in = Vehicle( action, mediation, and composition of services [12]. vehicleIdentificationNumber), • A process ontology (called OWL-S) to describe various Organization(name,email), aspects of Web services using SOAP protocol [13]. Action(startTime,endTime) • A service composition planner by using hybrid artificial out = Action(location) intelligence techniques and OWL-S model [14]. In OpenAPI terms, a HTTP GET method is defined to • A hybrid framework which achieves the semantic web obtain a JSON representation of the desired Web resource, service matchmaking by using fuzzy and OWL-S for each getResource operation – i.e. using GET /country statements [15]. with GeoLocation as input parameter and Country as output. • An automated software tool using MDA (Model-Driven Without JSON-LD constructs, these parameters have regular Architecture) techniques to generate OWL-S descriptions JSON datatypes like string or number. from UML models [16]. As defined by schema.org, LocalBusiness8 isA Organiza- • Various efforts for annotating SOAP-based Web ser- tion – or, equivalent, in (onto)logic terms: LocalBusiness ⊑ vice descriptions by using semantic approaches – e.g., Organization. Similarly, Country isA AdministrativeArea. SAWSDL (Semantic Annotations for WSDL and XML A valid composition satisfying the user request can consist Schema) – within the METEOR-S system [17]. of the services in the following order: Init → getCoun- In contrast, there are relatively few recent proposals focused tryFromLocation → getTransportCompany → getClosestCity on resolving the problem of automatic service composition in → getLocalSubsidiary → getVehicle → makeArrangements → the context of the new pragmatic way of describing the public Goal. The order is relevant, but not unique in this case. This REST APIs by using OpenAPI specification. Several solutions can be verified by considering all resources added by each and tools are covered in [18] and [19]. From the modeling service and also by the use of the isA relation. For example, LocalBusiness(email) can be used as Organization(email). 9Swagger Editor – http://editor.swagger.io/ 10JSON-LD Playground – https://json-ld.org/playground/ 8LocalBusiness, a particular physical business or branch of an organization 11OWL-S: Semantic Markup for Web Services – – https://schema.org/LocalBusiness https://www.w3.org/Submission/OWL-S/ service compositions perspective, our formal model presents We are aware that the proposed method presents several several similarities to the solutions proposed by [20] and [21]. shortcomings – e.g., lack of support regarding service meta- Concerning enhancing Web services with semantic descrip- data such as quality of service, various restrictions, work and tions [22], several recent initiatives considering OpenAPI- data-flows, and others. These aspects will be considered, for- based approaches are focused on: malized, and implemented in the next stages of our research. • Extending the OpenAPI specification with a meta-model giving developers proper abstractions to write reusable REFERENCES code and allowing support for design-time consistency [1] T. Erl, SOA: Principles of Service Design. Prentice Hall, 2007. verification [23]. This approach is not using any semantic [2] R. T. Fielding, “Chapter 5: REpresentational State Transfer (REST),” descriptions and does not provide support for reasoning Architectural Styles and the Design of Network-based Software Archi- via JSON-LD annotations. tectures (Ph. D. Thesis), 2000. • [3] R. V. Guha, D. Brickley, and S. Macbeth, “Schema.org: Evolution of Using fuzzy methods to match services consid- Structured Data on the Web,” Communications of the ACM, vol. 59, ering QoS metrics [24], or denoted by OpenAPI specifi- no. 2, pp. 44–51, 2016. cations [25]. [4] D. Allemang and J. Hendler, Semantic Web for the Working Ontologist: • Generating, in an automatic manner, the suitable Effective Modeling in RDFS and OWL. Elsevier, 2011. [5] P. Shvaiko and J. Euzenat, “Ontology Matching: State of the Art GraphQL-based wrappers for REST APIs described by and Future Challenges,” IEEE Transactions on knowledge and data OpenAPI documents [26]. engineering, vol. 25, no. 1, pp. 158–176, 2013. • Using the RESTdesc12 for service composition and invo- [6] J. Rao and X. Su, “A Survey of Automated Web Service Composition Methods,” in International Workshop on Semantic Web Services and Web cation processes in the context of the of Things Process Composition. Springer, 2004, pp. 43–54. – e.g., smart sensors [27]. [7] N. Milanovic and M. Malek, “Current Solutions for Web Service • Capturing the semantics and relationships of REST APIs Composition,” IEEE Internet Computing, vol. 8, no. 6, pp. 51–59, 2004. [8] M. B. Blake, W. Cheung, M. C. Jaeger, and A. Wombacher, “Wsc-06: by using a simplified description model (Linked REST The web service challenge,” in The 8th IEEE International Conference APIs), to automatically discover, compose, and orches- on E-Commerce Technology and The 3rd IEEE International Conference trate Web services [28]. on Enterprise Computing, E-Commerce, and E-Services (CEC/EEE’06). IEEE, 2006, pp. 62–62. [9] F. L´ecu´eand A. L´eger, “A Formal Model for VII.CONCLUSIONANDFUTUREWORK Composition,” in International Semantic Web Conference. Springer, 2006, pp. 385–398. The paper focused on REST-based Web services composi- [10] V. Cardellini, E. Casalicchio, V. Grassi, and F. L. Presti, “Flow- tion by using a straightforward method that adopts a concep- based service selection for Web service composition supporting multiple tual approach for modeling semantics of (micro)service pa- QoS classes,” in Web Services, 2007. ICWS 2007. IEEE International Conference on. IEEE, 2007, pp. 743–750. rameters. Starting with a formal model described in Section II, [11] K. Sycara, M. Paolucci, A. Ankolekar, and N. Srinivasan, “Automated an automatic service composition algorithm was proposed and Discovery, Interaction and Composition of Semantic Web Services,” Web evaluated – see Section III. Semantics: Science, Services and Agents on the , vol. 1, no. 1, pp. 27–46, 2003. To prove the feasibility of the proposed formalism, we ex- [12] C. Preist, “A Conceptual Architecture for Semantic Web Services,” in tended OpenAPI description of stateless services with JSON- International Semantic Web Conference. Springer, 2004, pp. 395–409. LD constructs, in order to conceptually explain the involved [13] D. Martin, M. Burstein, D. Mcdermott, S. Mcilraith, M. Paolucci, entities (resources) of the service’s interface. This new method K. Sycara, D. L. Mcguinness, E. Sirin, and N. Srinivasan, “Bringing Semantics to Web Services with OWL-S,” World Wide Web, vol. 10, was detailed in Section IV. no. 3, pp. 243–277, 2007. For practical reasons, we adopted the popular schema.org [14] M. Klusch, A. Gerber, and M. Schmidt, “Semantic Web Service Compo- model to quickly determine taxonomic relationships between sition Planning with OWLS-xplan,” in Proceedings of the 1st Int. AAAI Fall Symposium on Agents and the Semantic Web. sn, 2005, pp. 55–62. concepts according to the described algorithm. This was [15] G. Fenza, V. Loia, and S. Senatore, “A Hybrid Approach to Semantic exemplified by the case study presented in Section V. Our Web Services Matchmaking,” International Journal of Approximate approach is general enough to choose convenient ontologies Reasoning, vol. 48, no. 3, pp. 808–828, 2008. [16] J. T. Timm and G. C. Gannod, “A Model-driven Approach for Specifying for each specific set of composable (micro-)services. We Semantic Web Services,” in IEEE International Conference on Web consider that our proposal is also a suitable solution for Services. IEEE, 2005, pp. 313–320. service-based business Web applications deployed in various [17] A. P. Sheth, K. Gomadam, and A. H. Ranabahu, “Semantics enhanced services: Meteor-s, SAWSDL and SA-REST,” Bulletin of the Technical cloud computing platforms. Committee on Data Engineering, vol. 31, no. 3, p. 8, 2008. An alternative approach is to use the SHACL (Shapes [18] M. Garriga, C. Mateos, A. Flores, A. Cechich, and A. Zunino, “RESTful Constraint Language) model13 to specify certain restrictions Service Composition at a Glance: A Survey,” Journal of Network and Computer Applications, vol. 60, pp. 32–53, 2016. on RDF and, equally, on JSON-LD data – this direction of [19] A. L. Lemos, F. Daniel, and B. Benatallah, “Web Service Composition: research is to be investigated in the near future in order to a Survey of Techniques and Tools,” ACM Computing Surveys (CSUR), provide support for accessing semantically enriched digital vol. 48, no. 3, p. 33, 2016. [20] S. Baccar, M. Rouached, R. Verborgh, and M. Abid, “Declarative Web content [29]. Services Composition using Proofs,” Service Oriented Computing and Applications, pp. 1–19, 2018. 12RESTdesc – http://restdesc.org/ [21] D. P. F. Cremaschi, Marco, “A Practical Approach to Services Composi- 13Shapes Constraint Language (SHACL), W3C Recommendation, 2017 – tion Through Light Semantic Descriptions,” in European Conference on https://www.w3.org/TR/shacl/ Service-Oriented and Cloud Computing. Springer, 2018, pp. 130–145. [22] R. Verborgh, A. Harth, M. Maleshkova, S. Stadtm¨uller, T. Steiner, M. Taheriyan, and R. Van de Walle, “Survey of Semantic Description of REST APIs,” in REST: Advanced Research Topics and Practical Applications. Springer, 2014, pp. 69–89. [23] D. Sferruzza, J. Rocheteau, C. Attiogb´e, and A. Lanoix, “Extending OpenAPI 3.0 to Build Web Services from their Specification,” in International Conference on Web Information Systems and Technologies, 2018. [24] P. Wang, K.-M. Chao, C.-C. Lo, C.-L. Huang, and Y. Li, “A fuzzy model for selection of qos-aware web services,” in 2006 IEEE International Conference on e-Business Engineering (ICEBE’06). IEEE, 2006, pp. 585–593. [25] C. Peng, P. Goswami, and G. Bai, “Fuzzy Matching of OpenAPI Described REST Services,” Procedia Computer Science, vol. 126, pp. 1313–1322, 2018. [26] E. Wittern, A. Cha, and J. A. Laredo, “Generating graphql-wrappers for rest (-like) apis,” in International Conference on . Springer, 2018, pp. 65–83. [27] D. Ventura, R. Verborgh, V. Catania, and E. Mannens, “Autonomous Composition and Execution of REST APIs for Smart Sensors,” in SSN- TC/OrdRing@ ISWC, 2015, pp. 13–24. [28] D. F. Serrano Suarez, “Automated API Discovery, Composition, and Orchestration with Linked ,” Ph.D. dissertation, 2018. [29] O. Levina, “Towards a Platform Architecture for Digital Content,” in Proceedings of the 15th International Joint Conference on e-Business and Telecommunications, ICETE 2018 – Volume 1: DCNET, ICE-B, OPTICS, SIGMAP and WINSYS. SciTePress, 2018, pp. 340–347.