Full text
11 Viability assessment of WPS 2.0 services as communication standard for expensive web-based machine learning analysis. A case of study: Indoor Location. Andrea Calia
Viability assessment of WPS 2.0 services as communication standard for expensive web-based machine learning analysis. A case of study: Indoor Location. PhD Óscar Belmonte Fernández Institute of New Imaging Technologies Universitat Jaume I, Castellón de la Plana, Spain PhD PhD Marco Painho NOVA Information Management School Universidade Nova de Lisboa, Lisbon, Portugal PhD Raúl Montoliu Colás Institute of New Imaging Technologies Universitat Jaume I, Castellón de la Plana, Spain February 2016 2
Acknowledgments I would like to express my gratitude to PhD Óscar Belmonte Fernández, PhD Marco Painho and PhD Raúl Montoliu Colás for the dedication and help they provided to me for writing this thesis. Thanks to the teachers of the Master in Spain, Germany and Portugal. I would like to extend my gratitude to the Geotec Research Group for giving me the opportunity to improve my skills and to meet great people. Special thanks to Nacho Miralles Tena. I also would like to thanks my colleagues of the BE-OP team at CERN for the help and support they gave me in the last step of the Master. Special thanks to my family who continuously gave me the support needed throughout my life. Finally, I would like to thank my girlfriend for her support and her patience. 3
Abstract Communication between client and server is a key factor in the modern age. Nowadays, telecommunications are at the base of every system and Software that is available. The way Software communicates can determine the efficacy of it. In the GIS world, a server is often used for offloading expensive tasks such as geospatial operations or statistical analysis. This technique improves the performance of the Software systems and makes them able to scale based on the demand on real time. For making the communication between client and server more efficient, interoperable and standard, the OGC released the standard WPS. WPS defines abstract operations that are able to describe a client server communication for remote process executions. This thesis focuses on the asynchronous execution feature introduced in the version 2.0 of WPS. The main goal is to study how asynchronous process execution can benefit a client both in performance and availability. The result are promising and it is demonstrated that WPS is a solid standard for describing web services operations. Based on the obtained results, future studies can extend the standard in order to make it more general and suitable for more situations. 4
Keywords async-wps Classification Geographical Information System Indoor Location Indoor Location Management Tool Java JavaScript kNN Machine Learning Web Development Web Processing Service 5
Acronyms API - Application Programming Interface BDD - Behavior Driven Development CRS - Coordinate Reference System CSS - Cascading Style Sheets CSV - Comma Separated Values GIS - Geographic Information System GLONASS - GLObal NAvigation Satellite System GML - Geography Markup Language GNSS - Global Navigation Satellite System GPS - Global Positioning System GUI - Graphical User Interface HTML - HyperText Markup Language HTTP - Hypertext Transfer Protocol IDE - Integrated Development Environment IoT - Internet of Things ISO - International Organization for Standardization JSON - JavaScript Object Notation KVP - Keyword Value Pair MIME - Multipurpose Internet Mail Extensions OGC - Open Geospatial Consortium OSGEO - Open Source Geospatial Foundation OWS - OGC Web Services Common Standard SQL - Structured Query Language UI - User Interface UML - Unified Modeling Language URI - Universal Resource Identifier URL - Uniform Resource Locator VCS - Version Control System WPS - Web Processing Service XML - Extensible Markup Language 6
Contents 1 Introduction 14 2 State of the art 16 3 Web Processing Service 2.0 18 3.1 Definition ................................... 19 3.1.1 GetCapabilities............................ 20 3.1.2 DescribeProcess............................ 23 3.1.3 Execute ................................ 26 3.1.4 GetStatus ............................... 31 3.1.5 GetResult............................... 33 3.2 Interaction between Client and Server: Sync and Async execution models 36 3.2.1 Processdiscovery........................... 36 3.2.2 Processexecution........................... 37 3.3 Issues and improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4 Web Processing Service Client Library: async-wps 41 4.1 Current implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.1.1 52north-wps-js ............................ 43 4.1.2 OpenLayers2............................. 43 4.2 Requirements ................................. 45 7
4.3 Development and Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 4.3.1 Technology and design decisions . . . . . . . . . . . . . . . . . . . 46 4.3.2 Requirements fulfillment . . . . . . . . . . . . . . . . . . . . . . . 48 4.3.3 Dependencies ............................. 53 4.3.4 Tests.................................. 54 4.3.5 Library compilation and test . . . . . . . . . . . . . . . . . . . . . 54 4.3.6 Sourcecode.............................. 55 4.4 Limitations .................................. 56 5 Case Study: Indoor Location 57 5.1 Definition ................................... 58 5.2 Classificationproblem ............................ 59 5.3 WPS 2.0 server: wps-classificator . . . . . . . . . . . . . . . . . . . . . . 60 5.3.1 Requirements ............................. 60 5.3.2 Development and Results . . . . . . . . . . . . . . . . . . . . . . 61 5.3.2.1 Technology and design decisions . . . . . . . . . . . . . . 61 5.3.2.2 Requirement fulfillment . . . . . . . . . . . . . . . . . . 62 5.3.2.3 Dependencies........................ 68 5.3.3 Sourcecode.............................. 69 5.4 Web Application: Indoor Location Management Tool . . . . . . . . . . . 70 5.4.1 Requirements ............................. 70 8
5.4.2 Development and Results . . . . . . . . . . . . . . . . . . . . . . 71 5.4.2.1 Technology and design decisions . . . . . . . . . . . . . . 71 5.4.2.2 Requirement fulfillment . . . . . . . . . . . . . . . . . . 73 5.4.2.3 Dependencies........................ 79 5.4.3 Limitations .............................. 80 5.4.4 Sourcecode.............................. 81 6 Discussion 82 7 Conclusion 87 8 Future work 90 9
2 State of the art WPS is a well recognised standard and is been used in a variety of projects successfully. Despite this, WPS defines abstract operations and data formats, but does not provide official implementations ready to be used [10]. In [13], the problem of connecting multiple WPS endpoints is undertaken. The proposed approach involves the extension of the WPS standard for including two parameters. The proposed implementation is a proof of concept and is able to mediate different WPS services in a computing Grid. The context of the work is the calculation of the Normalized Difference Vegetation Index. The work proposed in [5] uses WPS standard for providing high performance and scalable web service for analysing Earth Observation data. In such a context, WPS is able to orchestrate the communication between client and servers in order to provide more throughput in the data analysis. Also, a multilayer framework of WPS servers is able to manage the user requests and the cloud computing environment. To be able to process large quantity of data in real time, the cloud computing layer is built on top of Apache Hadoop. An interesting project is found in the work of Fenoy et all (20013) in which the ZOO Project is developed [10]. In this project, a WPS framework is build with the aim to integrate and link various algorithms and expose them using WPS interface. It provides connectors for developing algorithms using C/C++, Java, Perl, Python, PHP and JavaScript. This framework supports only the version 1.0 of WPS. In [2], the WPS standard is used for creating a service oriented infrastructure. The proposed problem involves the usage and coupling of various mathematical models in the context of Environmental modelling. In this scenario, each mathematical model is represented by a WPS web service. Then, a client is able to orchestrate the workflow because every web service use a standard WPS interface. The proposed system is based on the version 1.0 of WPS. 16
Stollberg et all. [33] presents the aggregation of WPS web services in a Service oriented Architecture. In this architecture, the WPS services are able to communicate between each other for exchanging information. For the first time, the term "Composite-WPS" is introduced. This term indicates the chaining of dependency of a specific WPS process. This allows, for example, to chain multiple WPS web services and, when invoked, they will be triggered automatically. This architecture is validated in a simulated bomb treatment scenario in the context of quick response to a disaster. Degree Framework [12] is a project that allows the easy development of WPS servers using Java as programming language. It has the particularity of supporting large amount of data using streaming techniques. This framework supports most of OGC standards (e.g. GML, WFS, WFS, WMS and WPS) in order to provide a full-stack open source software for spatial data infrastructure. The component offered by the framework include the management, visualization and access to geospatial information. The supported version of WPS is 1.0. Another open source WPS framework for Java programming language is WPSint [37]. It provides an easy integration with Spring1. This framework is meant to be used to easily develop web services and expose them in a way compatible with WPS. The project, even if it has some interesting features, is no longer maintained and it supports only the WPS standard version 0.4.0. For accessing WPS servers using JavaScript, there are two libraries: 52◦North WPS [38] and OpenLayers2 [15]. The first one is JavaScript project that offers a web interface for accessing WPS servers. Its usage is limited because the WPS client code is tightly coupled with the project and is not proposed as external module. The supported version of WPS is 1.0. The latter is a famous JavaScript library for creating geospatial web applications. It aims to be full-features including an implementation for the majority of OGC standards. WPS compatibility is only present in the second version of the library and the it is limited to WPS 1.0. Section 4 explain them in details 1https://spring.io/ 17
3 Web Processing Service 2.0 This section covers the WPS 2.0 standard. Its aim is to provide an overview of the core operations and the basic interactions between a client and a server that use WPS as a communication protocol. Its aim is to provide a simplified version to better understand the standard. The properties included refers only to the ones specified in the WPS 2.0 standard specification, to access or create a fully functional WPS 2.0 server it may involve to include options and properties of others OGC standards, such as OWS Commons [27]. 18
3.1 Definition WPS is a standard developed at the OGC. According to its website[29], OGC defines itself as "an international industry consortium of over 520 companies, government agencies and universities participating in a consensus process to develop publicly available interface standards". The main area of concern of OGC is geospatial information. One of the goals is to provide and improve, where exists, interoperability between geospatial software and services. WPS defines an abstract framework of communication between two entities, the client and the server. In this scenario, the server offers a particular process that the client needs to execute. As WPS is meant to be used on the Web the client and the server are normally distributed and may not reside on the same machine. For example, the server can belong to a private company that sells services or to a public university that provides services free of charge. The latest version of WPS is 2.0[28] and it has been published on the fifth of march of 2015. This revision of the standard introduces some significant advantages, such as: flexibility to be used using REST or SOAP; nested inputs and nested outputs; better process description; synchronous and asynchronous execution. To be able to support the new features, data and process models have been revised. Figure 1 shows the conceptual model of a WPS server. It can be summarized into: •Web Processing Service: the server itself. •Process: the operation that the server provides. For example, a Buffer or a Convex Hull operation. •Job: it represent and instance of an operation that executes a specified process with associated data. •Job Control Operation: it provides the ability to control a job that is executing 19
on the server. It can provide such operations as: load balancing; error report; log; dismiss; etc. •Data: data that the job uses to operate. •Status: the current status of the job. Figure 1: Conceptual model of a WPS server. From [28] Version 2.0 of WPS standard defines five operations that a compliant server needs to implement: GetCapabilities; DescribeProcess; Execute; GetStatus; GetResult. 3.1.1 GetCapabilities GetCapabilities operation allows the client to get metadata and information about the processes available on the WPS server. This operation is particularly useful in two scenarios: capabilities discovering of an unknown WPS server; checking for availability of a specific process of a known WPS server. Table 1 shows the properties of a WPS GetCapabilities request. Table 2 shows the properties of a WPS GetCapabilities response. In the case of an error, the WPS server should respond with a generic exception (specification at [27]). 20
Name Description Type Cardinality Mandatory Service Service identifier Fixed character string: "WPS" One Yes Extension Hook for future extension specifications Any Zero or more No Table 1: Specific properties of a GetCapabilities request. Based on Table 35 of WPS 2.0 standard specification [28] Name Description Type Cardinality Mandatory Service Service identifier Fixed character string: "WPS" One Yes Contents Contains a list of the offered processes. ProcessSummary, Table 4 One Yes Extension Hook for future extension specifications Any Zero or more No Table 2: Specific properties of a GetCapabilities response. Based on Table 36 of WPS 2.0 standard specification [28] 21
Name Description Type Cardinality Mandatory Title Name of the process String One Yes Abstract Brief description of the process String Zero or more No Keywords List of keywords that describe better the process String Zero or more No Identifier Unambiguous identifier for the process String One Yes Job Control Options Options for controlling this process List of options: "sync-execute"; "async-execute"; "dismiss" One or more Yes Output Transmission Transmission modes for output data List of transmission options: "value"; "reference" One or more Yes Process Model Type of the process description URI Zero or one No Table 4: Specification of a Process Summary property. Based on Table 37 and 29 of WPS 2.0 standard specification [28] 22
3.1.2 DescribeProcess DescribeProcess operation allows a client to get a detailed description of a process on a WPS compliant server. This information includes the description of the inputs and outputs of the process. It is very important to check this information before executing an operation, otherwise it may lead to unexpected behavior. Table 5 shows the properties of a DescribeProcess request. Table 6 shows the properties of a DescribeProcess response. In the case of an error, the WPS server should respond with an exception. Table 9 shows the possible exceptions for a DescribeProcess request. Name Description Type Cardinality Mandatory Identifier Process identifier String (special value "ALL" indicates that the will to retrieve the description for all the processes) One or more Yes Lang Indicates the language for the desired description String in the human-readable format from the standard IETF RFC 4646 [16] Zero or one No Table 5: Specific properties of a DescribeProcess request. Based on Table 38 of WPS 2.0 standard specification [28] 23
Name Description Type Cardinality Mandatory Lang Indicates the language for the desired description String in the human-readable format from the standard IETF RFC 4646 [16] Zero or one No Process Offerings Contains a list of the description for each queried process ProcessOffering, Table 8 One or more No Table 6: Specific properties of a DescribeProcess response. Based on Table 39 of WPS 2.0 standard specification [28] 24
Name Description Type Cardinality Mandatory Any Any property it may be useful to better describe the process. Any One or more Yes Job Control Options Options for controlling this process List of options: "sync-execute"; "async-execute"; "dismiss" One or more Yes Output Transmission Transmission modes for output data List of transmission options: "value"; "reference" One or more Yes Process Model Type of the process description URI Zero or one No Table 8: Specification of a Process Offerings property. Based on Table 40 and 29 of WPS 2.0 standard specification [28] Code Description HTTP Code NoSuchProcess The WPS server does not contains one or more queried processes 400 (Bad request) Table 9: Specific exceptions for a DescribeProcess request. Based on Table 41 of WPS 2.0 standard specification [28] 25
A WPS 2.0 server can provide custom states for a job. The standard does not limit the number of possible states and allows domain-specific states in the case they are meaningful. For example, a server with very high demand for long-running tasks, may include the state "Paused". This information can be used by the client to provide feedback to the end user of an application improving its user-friendliness. Table 17 shows the exceptions a WPS 2.0 compliant server should throw in the case of an error during a GetStatus request. Name Description Type Cardinality Mandatory Job ID The identifier of a job scheduled on the server String One Yes Table 15: Specific properties of a GetStatus request. Based on Table 47 of WPS 2.0 standard specification [28] Name Description Type Cardinality Mandatory Job ID Job identifiers String One Yes Status Indicates the current status of the specified job String, it may includes one of the following: "Succeeded"; "Failed"; "Accepted"; "Running" One Yes Expiration Date It specifies when the job and its results will no longer be accessible String following ISO-8601 [1] standard Zero or one No 32
Estimated Completion It specifies when the job is expected to be done String following ISO-8601 [1] standard Zero or one No Next Poll It specifies when it is recommended to request a status update String following ISO-8601 [1] standard Zero or one No Percent Completed The percentage of completion of this job Integer from 0 to 1 Zero or one No Table 16: Specification of a Status Info document. Based on Table 32 of WPS 2.0 standard specification [28] Code Description HTTP Code NoSuchJob The WPS server does not have any job with the specified identifier 400 (Bad request) Table 17: Specific exceptions of a GetStatus request. Based on Table 48 of WPS 2.0 standard specification [28] 3.1.5 GetResult The GetResult operation it is intended to be used to retrieve the result of an asynchronous job execution on a WPS 2.0 server. Table 18 shows the properties of a GetResult request. Table 19 shows the properties of a GetResult response. 33
In an error occurred during a GetResult operation, the server should return an exception. Table 21 shows the specific exceptions for a GetResult operation. Name Description Type Cardinality Mandatory Job ID The identifier of a job scheduled on the server String One Yes Table 18: Specific properties of a GetResult request. Based on Table 49 of WPS 2.0 standard specification [28] Name Description Type Cardinality Mandatory Job ID The identifier of a job scheduled on the server String One Yes Expiration Date It specifies when the job and its results will no longer be accessible String following ISO-8601 [1] standard Zero or one No Output Contains a list with the outputs for the specified job Data Output Type, Table 20 One or more Yes Table 19: Specific properties of a GetResult response. Based on Table 33 of WPS 2.0 standard specification [28] 34
Name Description Type Cardinality Mandatory ID Identifier of the output String One Yes Data Embedded data Any Zero or one Yes, only one should be usedOutput A nested output element Data Output Type, this table Zero or one Table 20: Specification of a Data Output Type. Based on Table 34 of WPS 2.0 standard specification [28] Code Description HTTP Code NoSuchJob The WPS server does not have any job with the specified identifier 400 (Bad request) ResultNotReady The specified job has not yet finished its execution 400 (Bad request) Table 21: Specific exceptions of a GetResult request. Based on Table 50 and 48 of WPS 2.0 standard specification [28] 35
3.2 Interaction between Client and Server: Sync and Async execution models The WPS standard is an abstract communication protocol between a client and a server. The aim of the client is to execute an operation (service) offered by the server. The WPS standard provides abstract operation for discovery, description and execution of a operation (service). As stated in Section 3.1, WPS 2.0 defines five operations: GetCapabilities; DescribeProcess; Execute; GetStatus; GetResult. The interaction between a client and a server in the context of WPS can be divided into two sections: process discovery and process execution. 3.2.1 Process discovery The WPS 2.0 operations involved in the process discovery are: GetCapabilities and DescribeProcess. A client needs to use those operations in order to know the processes offered by a WPS 2.0 server. The first step for a WPS client is to use the GetCapabilities operation. The result of this operation includes the metadata about the server, including the processes it offers. For example, in addition to the offered processes, a WPS server may specify an abstract that describes the included services, some keywords, the supported version of WPS and a contact person in case of error or misbehavior. With the information of the GetCapabilities operation, the client may select a suitable process that solves its needs. If it is the case, a DescribeProcess operation should be issued. This operation retrieves the metadata for the specific process of the server. In this way, the client knows exactly which input it should provide and which output it should expect. Another important information is the available execution models, for example it may be convenient to check if the server supports asynchronous execution model. 36
Figure 2 shows a UML interaction diagram that summarize the process discovery procedure. Figure 2: Process discovery interaction between a client and a WPS 2.0 compliant server. From Figure 15 of [28] 3.2.2 Process execution The process execution phase include the execution of a previously selected process available on the WPS server. Therefore, it is assumed that the client knows the identifier of the job it needs to access (if this is not the case, see Section 3.2.1). The version 2.0 of the WPS standard [28] introduces, among other features, the ability to specify the execution model of a process. There are two execution model defined in the standard: synchronous and asynchronous. In the synchronous execution model the client performs an Execute operation on the WPS server and waits for the result. The server response is either an error or the execution 37
result. In this paradigm, the client is blocked until the server finishes the scheduled job and produce a result (or, in many implementation, a timeout occurs). Synchronous execution is the classical client-server interaction and may be the optimal choice for the most of the cases. Figure 3a shows a UML interaction diagram that summarize the client-server interaction using synchronous execution. The asynchronous execution model is first introduced in the version 2.0 of the WPS standard [28]. The operations involved are: Execute; GetStatus; GetResult. The first operation the client should perform is Execute, specifying the Async execution model. This operation creates and schedules a job on the server. The client receives an identifier of the job as a response. After, the client can continue its calculations/operations as it is not blocked by the server. At regular intervals, the client should perform a GetStatus operation specifying the job identifier. The response include the current status of the job. Eventually, the job finishes and the result becomes available using the GetResult operation in conjunction with the job identifier. Clearly, this execution model is suitable in such situation in which the job takes long time to complete. For example, because the process is particularly time consuming, or because the data size is specially big. Figure 3b shows a UML interaction diagram that clarify the relation between the client and the WPS server. 38
(a) Interaction diagram for a synchronous execution model (b) Interaction diagram for an asynchronous execution model Figure 3: Process execution interaction between a client and a WPS 2.0 compliant server. (a) shows the interaction using synchronous request, while (b) using an asynchronous request. From Figure 3 and 4 of [28] 39
3.3 Issues and improvements Undoubtedly, WPS 2.0 introduces interesting features over the previous iteration of the standard. Nevertheless, the are some aspect that can be further improved. The following considerations comes from the experience earned while developing and studying the subject in the context of this Master thesis. The first consideration is the data format used for exchanging information between the client and the server. WPS does not enforce the use of XML but encourages it. This is not an issue, rather a limitation. Nowadays, web applications are moving to JSON as data format because of its simplicity and its seamless integration with JavaScript, which is the main language for developing web applications. Also, the exact format (hierarchy of elements, attributes, et cetera) of the data is not specified into the standard, but is implementation specific. This seams like a paradox giving the aim of the standard is interoperability. Even if the abstract data model is defined, a client still need to study the specific behavior of a certain server. One server can accept the mode="async" as an attribute for the root element of the XML document, while another server may expect is as a XML element per se. Giving a generic (preferred) way of structuring communication data would improve the interoperability of the standard to a real high level. Each supported data format, XML or JSON, can have a template indicating how a client should formulate the requests to a serve and how to expect the response. Finally, the asynchronous execution model implies the use of polling technique for requesting the status of the scheduled process execution. Although there are some attempt to improve the performance of polling [9][18], it efficiency in much less if compared to new techniques like WebSocket [30] and the new features of HTTP2 [17]. The use of these new technologies may lead to higher performance under certain scenarios. Possibly, the support for polling and streaming models would improve the flexibility and adaptability of the WPS standard. 40
4 Web Processing Service Client Library: async-wps This section explains in detail the development of the async-wps library. The motivation for developing async-wps comes naturally with the release of WPS standard version 2.0. The new standard offers very interesting features for web services and web applications. It standardizes the way a client and a server interact in a remote procedure call scenario. Also, the support for asynchronous execution makes the standard useful in performancesensible scenarios. Finally, the preferred communication format is XML in WPS. While XML is a very famous data interchange format, easy to read for humans and widely used in the industry, it may not be easy to work with from a programming language. To not worry about object to XML and viceversa conversion, a library is very welcome. JavaScript is the reference language for developing web applications. While there are attempt of establishing new languages (lastly Dart2from Google [8]), no one was widely adopted. JavaScript (formally and implementation of ECMAScript) is already supported by all web browsers. Also, JavaScript has been a growing programming language for server-side scripting. The rise of NodeJS and the support of ECMAScript 5 in the Java 8 version made JavaScript a very appealing programming language. 2https://www.dartlang.org/ 41
Foundation and it is compatible with the open source and free software philosophy. The source code and tests are developed with version 4.2.4 of NodeJS as target platform. This offers a good environment for the development and test of the system. It has much more flexibility then a browser environment and every phase of the development can be achieved in a IDE. For this purpose, WebStorm 10 from JetBrains11. Some of the most important feature of this IDE are: •Support for NodeJS environment •Smart code completion for JavaScript •Support for Mocha BDD testing •Integrated debugging tools •Code quality tools 4.3.2 Requirements fulfillment This section covers the requirements for the library and how are they solved. Requirement R01 The Listing 1 shows a sample code in JavaScript that illustrate the use of asyncwps API. This example shows an interaction between a client that uses the async-wps library and a WPS 2.0 server. The code makes use of the Promise API and shows the integration with the five supported operations: GetCapabilities; DescribeProcess; Execute; GetStatus; GetResult. 11https://www.jetbrains.com/webstorm/ 48
1function processCapabilities(...) { ; } 2function processDescription(...) { ; } 3function waitForCompletion(...) { ; } 4function processResult(...) { ; } 5function logError(...) { ; } 6 7let getURLFromForm = new Promise((resolve, reject) => { 8let url = document.getElementById(’url-input’).value; 9if( ! isValid(url) ) reject(’URL is not valid’); 10 else resolve(url); 11 }); 12 13 getURLFromForm 14 .then(wpsjs.GetCapabilities.executeGet) 15 .then(processCapabilities) 16 .then(wpsjs.DescribeProcess.executePost) 17 .then(processDescription) 18 .then(wpsjs.Execute.executePost) 19 .then(waitForCompletion) 20 .then(wpsjs.GetResult.executePost) 21 .then(processResult) 22 .catch(logError); 23 24 // The code below does not wait for the algorithm to be done to execute 25 ... Listing 1: Sample code for a interaction with a WPS 2.0 server in JavaScript. This code makes use of the Promise API found in the ECMAScript 2015 specification 49
Requirement R02 The library is developed with NodeJS as target platform. The support for a browser environment is achieved using two third-party libraries: Browserify12 and BabelJS13. Browserify is a JavaScript library that is able to pack a NodeJS projects is a way that is compatible with web browsers. The dependencies of the project are bundled together and a single JavaScript file is created. Also, Browserify provides a browser-compatible implementation of the NodeJS base library, for example the require function or the http NodeJS native module. In this way, a code that makes use of the http NodeJS module is able to run on a browser environment without changes. Furthermore, Browserify is able to compact and optimize the code. BabelJS is a JavaScript compiler that makes JavaScript code backward compatible with the desired JavaScript version. In order to be able to run code that makes use of new features in older JavaScript environments code modifications are needed. Browserify does this modifications automatically. It has implementations of the latest ECMAScript features for previous version of the language. For example, the Promise API is introduced in ECMAScript 2015. This means that a older JavaScript environment does not support it natively. In this case, Browserify provides a module that introduces this new feature, so that the developer does not have to modify the code. Requirement R03 ComplexData is a supported data type for inputs element in Execute operations. Code Listing 2 shows an example on how to use a ComplexData input type in a asynchronous Execute operation. As shown in line 6, async-wps offers a constant to specify a Complex- Type input (wps.Constants.COMPLEX_TYPE) and a content property for specifying the desired data. Requirement R04 12http://browserify.org/ 13https://babeljs.io/ 50
1var params = { 2mode: ’async’, 3identifier: ’process-id’, 4inputs: [ 5{ 6type: wpsjs.Constants.COMPLEX_TYPE, 7identifier: ’complex-input’, 8mimeType: ’text/xml’, 9encoding: ’utf-8’, 10 content: ’<complexData>...</complexData>’ 11 }] 12 }; Listing 2: Sample code for the specification of a ComplexData input for an Async process execution The license of the project is GPL 3.0. This license is fully open source and is sponsored by the Free Software Foundation. Requirement R05 The API of the library contains five objects. Each object represents a WPS 2.0 operation: GetCapabilities;DescribeProcess;Execute;GetStatus;GetResult. The library allow the operations to be executed using a HTTP GET or HTTP POST request. Therefore, each object provides two different methods: •executeGet(url): it executes a GET request to the specified URL. The parameters of the operation are specified using Query Parameters in the URL itself. •executePost(url, parameters): it executes a POST request to the specified URL. In this case, the parameters are provided using a JavaScript object. The properties of the object are extracted and a XML document is created. Finally, the document is attached to the request using the body of the POST request. 51
Each method return a JavaScript Promise object. When the promise resolves, the callback will receive a object with three properties: •parsedData: a JavaScript object that represents the response XML document maintaining the hierarchy of the attributes and properties. •rawData: string property with the full response XML document as retrieved from the server. •data: a JavaScript object that provides simpler access to some meaningful properties of the response XML document. Also, it can provide aggregated data and direct access to important properties that are deep in the hierarchy of the XML document. Requirement R06 The XML document manipulation required by the WPS standard is hidden to the user. The user specifies and receives input and outputs using JavaScript objects. Internally, the library creates and parse XML documents that need to be sent and are received from a WPS 2.0 server. The transformation from a XML document to a JavaScript object is done using the jsonix third-party library. This library uses predefined schemas to map a XML document to a JavaScript object. Schemas for all the OGC standards (including WPS 2.0) are available14. When a XML document is received, jsonix first identify the correctness of it according to the standard, then maps its properties to a JavaScript object. In order to be able to convert a JavaScript object to a valid WPS 2.0 XML document, templates are used. This technique uses some predefined texts with some special symbols that are used as placeholders for dynamic data. The async-wps library uses lodash template strings to achieve this goal. Code Listing 3 shows the template string for creating a GetStatus request. The function _.template(”) creates an "executable" version of 14https://github.com/highsource/ogc-schemas 52
1var template = _.template(‘ 2<wps:GetStatus service="WPS" version="2.0.0" 3xmlns:wps="http://www.opengis.net/wps/2.0" 4xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5xsi:schemaLocation="http://www.opengis.net/wps/2.0 ../wps.xsd "> 6<wps:JobID><%= jobID %></wps:JobID> 7</wps:GetStatus> 8‘) Listing 3: Template string for a GetStatus request document the template to which it is possible to pass parameters. In the showed example, the only necessary parameter is the jobID. 4.3.3 Dependencies This section provides a brief description of the library that are needed at runtime for async-wps to execute. All the libraries are open source and in the case of a browsercompatible build, they are bundled with async-wps. Mocha and Chai are testing dependencies. They are not required for a normal execution of the library but are used to run the tests. jsonix 15 This library provides a mapping between JavaScript objects and XML documents. It is able to make the conversion in both directions. Also, it is able to validate a XML document with a XMLSchema. To make a conversion, this library needs a mapping file in which is specified the rules for converting the XML document to a JavaScript object and vice versa. Mappings for any OGC standards are available online. 15https://github.com/highsource/jsonix 53
lodash 16 This library includes many utility functions to the JavaScript language. It has interesting functions for functional programming such as: map; reduce; pick; plunk; any; some. Also, it provides template string for creating text from predefined templates and dynamic data. mocha 17 This is a testing framework for JavaScript. Its strengths are in the simplicity of the definition of tests and the asynchronous execution of them. chai 18 This library provides fluid assertion functions. Its primary goal is to be used in conjunction with a testing framework. It provides both BDD and TDD styles assertions. 4.3.4 Tests The async-wps library code comes with unit testing to improve code quality and robustness. The tests are executed in a NodeJS environment using Mocha and Chai third-party libraries. A very simple testing WPS 2.0 server is provided with the library. It is implemented in NodeJS. This server expects and returns valid WPS 2.0 XML documents. The async-wps tests are intended to test the library functionality against the XML documents provided in Annex B of WPS 2.0 standard document [28]. 4.3.5 Library compilation and test The library async-wps ships with a build folder in which is possible to find compiled and ready-to-use version of the library. Code Listing 4 shows the steps to build and test 16https://lodash.com/ 17https://mochajs.org/ 18http://chaijs.com/ 54
1git clone https://github.com/andreacalia/wps-js.git 2npm install 3npm run test 4npm run build-all Listing 4: List of console commands to build and test the async-wps library manually the library (the commands are shown on a standard UNIX console system). 4.3.6 Source code The VCS for this project is Git19. Git is a distributed version control system that aims to be fast and easy to learn. It can manage projects of every size and it can be fully integrated with Github. Github20 is a web application that manages software projects that use Git as VCS. It supports collaboration, code review and more features that allows easy management of big projects. Github offers free hosting for open source projects. For this reason, the code of async-wps is hosted on Github and cab be found here: https://github.com/andreacalia/wps-js. 19https://git-scm.com/ 20https://github.com/ 55
4.4 Limitations Current implementation of the WPS 2.0 standard in async-wps is not complete. Most of the features the standard provides are already present in the library, as well as the API structure. A current limitation can be found in the automatic management of XML documents. These documents can be rather complicated and includes portions of other OGC standards. The support for every possible combination of OGC standards is complicated to achieve. Yet, the modular structure of async-wps allows easy integration. Another limitation is the support for only ComplexData input types. WPS 2.0 standard includes other two types of input type: LiteralData and BoundingBox. They are not currently included in the library. Placeholders are included and the library in already able to identify them, throwing a "not implemented" exception. These limitations do not affect the usability of the library for the sake of this thesis. The main goal of this thesis is to provide a starting point for a fully fledged WPS 2.0 support in JavaScript. This base needs to be modular, robust yet flexible and well tested. Those are the main focuses of the development. 56
5 Case Study: Indoor Location This section explains the case study for this thesis. Indoor Location is a hot topic now a days and it presents some interesting academic and business-related challenges. It can be used in a variety of situations. From security to advertisement. For example, it can be used to efficiently evacuate people from a crowded museum in case of emergency. Another example is to offer special prices to customers based on their location on the mall. Section 5.1 explains the definition of Indoor Location. Section 5.2 contains a brief introduction to the machine learning classification method and which is the scope of classification in the Indoor Location context taken into account in this thesis. Section 5.3 gives details of the WPS 2.0 server developed on the context of the thesis. Finally, Section 5.4 explains in details the tool created to manage Indoor Location data and how WPS 2.0 is used to communicate to the data-processing server. 57
1<wps:ProcessOfferings> 2<wps:ProcessOffering jobControlOptions="sync-execute async-execute" outputTransmission="value"> 3<wps:Process> 4<ows:Title>kNN classification</ows:Title> 5<ows:Identifier>kNN</ows:Identifier> 6<wps:Input> 7<ows:Title>trainData</ows:Title> 8<ows:Identifier>trainData</ows:Identifier> 9<wps:ComplexData> <wps:Format mimeType="application/json"encoding="UTF-8"/> 10 </wps:ComplexData> 11 </wps:Input> 12 <wps:Input> 13 <ows:Title>testData</ows:Title> 14 <ows:Identifier>testData</ows:Identifier> 15 <wps:ComplexData> <wps:Format mimeType="application/json"encoding="UTF-8"/> 16 </wps:ComplexData> 17 </wps:Input> 18 <wps:Output> 19 <ows:Title>Evaluation of evaluating the model</ows:Title> 20 <ows:Identifier>1</ows:Identifier> 21 <wps:ComplexData> <wps:Format mimeType="text/plain" encoding="UTF-8"/> 22 </wps:ComplexData> 23 </wps:Output> 24 </wps:Process> 25 </wps:ProcessOffering> 26 </wps:ProcessOfferings> Listing 6: Sample XML document for a DescribeProcess operation of the wps-classificator for describing the kNN process 64
1<wps:Execute version="2.0.0" response="document" mode="async"> 2<ows:Identifier>kNN</ows:Identifier> 3<wps:Input id="trainData"> 4<wps:Data> 5<wps:ComplexData> 6{ 7"data": "...", 8"classIndex": "BUILDINGID" 9} 10 </wps:ComplexData> 11 </wps:Data> 12 </wps:Input> 13 <wps:Input id="testData"> 14 <wps:Data> 15 <wps:ComplexData> 16 { 17 "data": "...", 18 "classIndex": "BUILDINGID" 19 } 20 </wps:ComplexData> 21 </wps:Data> 22 </wps:Input> 23 </wps:Execute> Listing 7: Sample XML document for the execution of the kNN classification with the specified input data 65
Requirement R02 The server wps-classificator supports both synchronous and asynchronous execution models. During a asynchronous execution, a token is created for the scheduled process and a StatusInfo (Listing 8) document is returned immediately. Behind the scene, the server starts a Thread that executes the operation with the given inputs. The Thread updates the status of the scheduled process on the Redis database. When it terminates, the result is stored on the database and the status is set to Succeded. Meanwhile, the client can query for the status of the scheduled process, as its status is retrieved from the database. Finally, the client asks for the results of the process, Result document 9. In contrast, the synchronous execution does not start a Thread, instead the process execution is done during the request. The result of the process is sent as the response of the execution request (Listing 9). 66
1<wps:StatusInfo xmlns:ows="http://www.opengis.net/ows/2.0" 2xmlns:wps="http://www.opengis.net/wps/2.0" 3xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4xsi:schemaLocation="http://www.opengis.net/wps/2.0 ../wps.xsd"> 5<wps:JobID>8132019285681</wps:JobID> 6<wps:Status>Accepted</wps:Status> 7<wps:NextPoll>2016-01-02T12:23:08.230Z</wps:NextPoll> 8</wps:StatusInfo> Listing 8: Response of an asynchronous WPS execute request or a GetStatus request. It includes the JobId that can be used to query the status and result of the processing 1<wps:Result> 2<wps:JobID>8282212079926</wps:JobID> 3<wps:ExpirationDate>2016-01-02T12:25:28.467Z</wps:ExpirationDate> 4<wps:Output id="1"> 5<wps:Data> 6Correlation coefficient 0.5602 7Mean absolute error 0.7143 8Root mean squared error 1.8898 9Relative absolute error 51.6129 % 10 Root relative squared error 85.1691 % 11 Total Number of Instances 7 12 </wps:Data> 13 </wps:Output> 14 </wps:Result> Listing 9: Response of a synchronous WPS execute request or a GetResult request (assuming the result is ready). It includes the results of the processing 67
Requirement R03 In order to be able to easily send large quantities of data as input for the WPS execute operation, wps-classificator supports file upload or HTTP POST body. File upload is suitable when the client already have the WPS payload codified as a file on the disk and this file is very large. The HTTP header multipart/form-data will speedup the performance of sending large files over HTTP. It is also possible to include the WPS payload in the body of a HTTP POST request. In this case, the payload is sent and codified as normal string and is embedded in the HTTP request. This method is suitable when the payload is relatively small in size. It is a perfect option for request the operations: GetCapabilities; DescribeProcess; GetStatus; GetResult. 5.3.2.3 Dependencies This section provides a brief description of the wps-classificator dependencies. All the third-party libraries described below are open source. Java Spark 21Spark Java is a microframework for developing web applications using the Java programming language. Spark Java is very simple to learn and provides high performance and scalability. It is not based on the Java EE stack and it fully supports Java 8 features. Redis 22Redis is a in-memory (but persistent) database that is able to achieve high performance when dealing with large quantities of data. This is largely due to the fact that it stores data in a simple key-value pairs. 21http://sparkjava.com/ 22http://redis.io/ 68
5.3.3 Source code Git is used for managing this project. As remote repository, Bitbucket is used. Bitbucket is a web platform for managing Git projects. The source code for this project can be found here: https://bitbucket.org/andreacalia/wps-classification-server. 69
5.4 Web Application: Indoor Location Management Tool This section explains in details the tool that is created during the thesis to be able to manage Indoor Location databases (in specific [35]). This tool is a web application and simplifies the operations of analysis and process of the data. It connects to wpsclassificator to perform expensive analysis tasks. Indoor Location databases are difficult to manage and analyze. The characteristic of this database is that they contains numeric and spatial information. The numeric information is composed by the sensors values, while the spatial information may include coordinates (latitude and longitude for example), space ids, etc. Normally, a table-based visualization and filtering is suitable for databases that does not include spatial information. In the particular scenario of Indoor Location databases, along with classical table-based visualization, it may be more convenient to have a mapbased visualization. In this way, some GIS analysis may be applied on the data and it may be easier to identify meaningful data. Also, the proposed tool as a web application is interesting due to its cross-platform nature. Scientists may use their preferred software stack (OS X, Linux or Windows) and they can continue to work with the tool. Finally, the classification of samples and the data analysis it is shifted to a distributed web service and this can drastically improve the overall performance of the system. 5.4.1 Requirements Table 24 shows the requirements for the Indoor Location Management Tool. Requirement ID Description R01 Support for data visualization using tabular and map view 70
R02 Support for data filtering using for queries and geospatial operations R03 Support for the creation of data clusters for performing periodical analysis R04 Open source compatible license Table 24: Summary of the requirements for the Indoor Location Management Tool 5.4.2 Development and Results This section describes the development of the Indoor Location Management Tool. 5.4.2.1 Technology and design decisions In order to fulfill the requirements presented in Table 24, this section explains in details the design and technology decisions. The first design decision for the tool is the way it loads a indoor location database. It can be done in two ways: via CSV file or via fetching from a web service. This first option involves the load of a CSV file from the user computer. This file should contain a row with the column header and Indoor Location Management Tool is a web application. Therefore, it is developed using HTML/CSS and JavaScript. Although, new versions of modern web browsers feature most of HTML/CSS and JavaScript standards, the implementation may slightly vary. Therefore, a cross-browser third-party library is needed. This kind of libraries are of two types: custom API or polyfill. When providing a custom API, the library forces the developer to learn and use their API to make standard operations. These operations are then performed in different ways depending on the browser in which they are running. In contrast, a polyfill library provides an implementation of a standard feature and it is used when a native implementation is not present. 71
The requirements of the tool make the UI of the system quite elaborated. There is the necessity of visualizing the data using both map and tabular view. The creation of a mixed view layout of this complexity can be challenging. For this reason a UI framework that provides a MV* (ModelView) design pattern is desirable. This framework should provide a basic structure for data models and a representation of them using views. Also, a mechanism for creating complex layouts involving nested views. The tabular view of the data should be presented using well-known tables. Due to the possible length of the database, a pagination control is required. In this way, only a certain amount of data is shown on screen and the other parts are reachable using pages controls. The map view should present a map widget on screen. This widget should include all the controls for zooming, panning and identify the feature on the map. Each element of the database, which includes positioning data, is shown on the map and a preview of its sensors data should be available with a click using a info window. Due to the possibly high size and concentration of database elements, the map should be able to show the database using clustering. Clustering technique scans the data and finds the elements that will be shown so close that are not easily distinguishable. For these elements, a cluster is shown which provides a summary of the information on the included elements. This technique allows a much clearer view of crowded data at all levels of zoom. Both tabular and map view should include filtering controls. These controls are able to select data based on the properties of a database element. For alphanumerical properties, such as sensors values, the tabular view provides a classical form to build a query. This form allows the user to dynamically create a query by comparing properties with specific values. For example, a user may want to select all the elements that have the word "wifi" in the property "title". In contrast, for geospatial properties, the map view should provide filtering options based on geospatial operations. For example, a user may want to select all the elements of the database that are within a certain polygon or that are close to a specific point of interest. 72
The filters create selection of element of the database. The selection can be saved for a later use. Saving a selection will create an experiment. An experiment is a set of element of the database that are grouped together for analysis reasons. For example, a user may want to create an experiment with those elements that have a value greater than 5 for the sensor S5. Along with a set of elements, an experiment have a name and a description. It is important to note that an element of the database can pertain to multiple experiments. The experiments are used to perform classification analysis using a WPS 2.0 server. A experiment may be used as a training or testing data for the classificator. In this way, a user may be able to use a subset of the database elements (an experiment) as simulated users in the system and then test its performance. 5.4.2.2 Requirement fulfillment This section explains how the requirements are implemented in the Software. Requirement R01 The tool provides tabular and map visualization for the elements of the database. The tabular view, Figure 4, is composed by a table and pagination controls. The number element shown on the page can be configured using the configuration page. Based on the number of elements per page and the total number of elements in the database, the tool calculates the necessary pages needed to visualize all the data. The pagination controls allow the navigation between the pages. The map view offers the visualization of the elements on a map, Figure 5. If present, the coordinates of a database element is assumed to be in the WGS84 latitude, longitude coordinate reference system. This allow the correct positioning and aligning of the database elements with a basemap or custom geospatial layers. The maps controls allow the user to zoom, pan and identify the elements. They are clustered if considered too close. The minimum distance threshold can be configured in the configuration page. 73
Leaflet 29This library has the ability to integrate maps into web pages. It has been built using JavaScript and supports mobile-friendly maps view. Also, it has a very small fingerprint in size and it has a simple API. TurfJS 30This library provide an implementation for geospatial analysis functions in JavaScript. It supports browser and NodeJS environments and it aims to be fast in its calculations. It provides many geospatial operations and it uses GeoJSON as geospatial data formal. alaSQL 31This library is a SQL database (SQL-99) for JavaScript. It can run in browsers and NodeJS environment. Its main focus is to be very efficient and fast in executing queries. It can load and store data using a variety of formats including: CSV, JSON, TAB, IndexedDB, LocalStorage and SQLite. 5.4.3 Limitations Indoor Location Management Tool is at a early stage of development. It aims to be a complete suite for managing Indoor Location databases so the application is very complex and challenging. The proposed work includes the basic implementation to be able to interact with the WPS 2.0 server in order to test the effectiveness of the WPS 2.0 standard for machine learning purposes. In the next release, the query builder will be improved. The user will be able to specify for each property of an element the condition that should be satisfied in order to select an element. The user may specify conditions like: "contains"; "greater then"; "equals" and "less then" 29http://leafletjs.com/ 30http://turfjs.org/ 31https://github.com/agershun/alasql 80
5.4.4 Source code Git is used for managing this project. Bitbucket is used as remote repository. The repository that holds the code of this project is currently private, it will be published in the recent future. Copies of the code can be given under request. 81
6 Discussion The proposed hypothesis of the thesis was not easy to validate. Proving performance improvements in modern Software environments is challenging. The resulting performance depends on plenty of factors including the machine on which the Software is running. Even more challenging is the prove of application responsiveness. Therefore, the experiments are focused on the status of the client over time: blocked or idle. In blocked stratus, the client cannot perform any operation since it is waiting for the response of the server. While in idle, the client can perform other actions, such as request resources from the web, respond to user input and update the GUI. The gathered data come from two simulations, one (Large dataset) with 15000 elements and the other (Small dataset) with 3000 elements. The data is sent to the wpsclassificator web service using the async-wps library. The WPS payload that included the samples were sent using a XML file. The results come from the last of 20 executions for each simulation. This is due the optimization the server performs during the execution of repeated operations. Table 25 shows the results of the experiments. The table includes the amount of time the client remains in Blocked and Idle status for each simulation. Also, the total elapsed time is presented. Given this results, the asynchronous execution of the simulations led to significant availability of the client versus the synchronous execution. Now the client is in Idle status for 95.3% of the time for the Large dataset and 95.5% of the time for the Small dataset. Figure 9 shows the client availability over time during the simulation with the Large dataset. Figure 10 shows the same information referred to the simulation using the Small dataset. These graphical representation a presented to better understand the results. The experiments using the WPS 2.0 asynchronous feature led to another consideration. As described in Section 3.3, the polling technique used for getting the status of a scheduled execution is an issue of the WPS standard. In the current version of WPS, the 82
client must get the status of a scheduled process execution periodically (polling). The selected interval between GetStatus requests may influence the performance significantly. Although the WPS server may specify the preferred polling interval, it may not be the best one. During the experiments, this problem came out and a further study is presented in Figure 11. The figure shows how the polling interval affects the completion time of the process execution. Given the presented results, the polling technique is clearly not the best one for getting the status of a WPS process, since a wrong polling interval may halve the performance of the entire system. Large dataset Small dataset Blocked (s) Idle (s) Total (s) Blocked (s) Idle (s) Total (s) Asynchronous 4.04 82.88 86.93 0.37 7.98 8.35 Synchronous 87.08 0 87.08 8.12 0 8.12 Table 25: This table shows the status of the client during an asynchronous and a synchronous request for each simulation. The large dataset involves 15000 elements, while the Small dataset only 3000 elements. During the Blocked status, the client cannot perform any action, since it is waiting for the response of the server. During the Idle status, the client is available for doing other tasks, like updating the GUI or processing other data. The time is expressed in seconds 83
0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 IDLE BLOCKED Time [s] Client status (a) Client status chart for an asynchronous request using the Large dataset 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 IDLE BLOCKED Time [s] Client status (b) Client status chart for a synchronous request using the Large dataset Figure 9: This chart compares the status of a WPS client during asynchronous (a) and synchronous (b) requests for the Large dataset. The simulation is particularly heavy since it involves 15000 elements 84
−1 0 1 2 3 4 5 6 7 8 9 IDLE BLOCKED Time [s] Client status (a) Client status chart for an asynchronous request using the Small dataset −1 0 1 2 3 4 5 6 7 8 9 IDLE BLOCKED Time [s] Client status (b) Client status chart for a synchronous request using the Small dataset Figure 10: This chart compares the status of a WPS client during asynchronous (a) and synchronous (b) requests for the Small dataset. The simulation is particularly heavy since it involves 15000 elements 85
0 0.511.522.533.544.5 5 5.566.577.588.599.5 10 10.5 11 0 10 20 30 40 50 60 70 80 Polling interval [s] Completion time [s] (a) Completion time versus polling interval for the experiment Large dataset. Average: 70.36 seconds. Standard deviation: 1.69 0 0.511.522.533.544.5 5 5.566.577.588.599.5 10 10.5 11 0 1 2 3 4 5 6 7 8 9 10 11 Polling interval [s] Completion time [s] (b) Completion time versus polling interval for the experiment Small dataset. Average: 7.62 seconds. Standard deviation: 1.29 Figure 11: These charts show the evolution of the completing time for the proposed simulations compared with the interval between status polling. (a) shows the results for the Large dataset, while (b) shows the results using the Small dataset. The polling interval (in seconds) is the time the client waits before requesting the status of the execution. The selected polling interval affects significantly the total execution time of the experiments depending on the duration of the experiment (in seconds). Longer experiments (execution time) seems not to be heavily affected 86
7 Conclusion The main contribution of this thesis is the development of a JavaScript library for accessing WPS 2.0 web services in an asynchronous way. Specially in the case of intensive computing tasks, this feature improves the client responsiveness, reduces network resources usage and allows the implementation of high-performance server infrastructures. Version 2.0 of WPS introduced the ability to execute processes in asynchronous mode along with standard synchronous. This feature makes WPS suitable for processing large quantity of data or for using time-consuming algorithms. This is specially useful in a data analysis scenario in which there is a big amount of data that is needed for statistical and big-data analysis. Indoor Location is suitable example of performing expensive machine learning algorithm on large datasets. In such a context, giving a capable web service, it is demonstrated that for expensive calculations involving a large quantity of data, the asynchronous feature of WPS 2.0 and async-wps led to huge availability gain in the client side (around 95% in the performed experiments). Now the client is not blocked anymore for long time waiting for the server response. During the server calculations, the client is now able to perform other tasks and provide early failure detection for the scheduled task. Also, the regular query of the process status improves the friendliness of the user interface and give real time updates to the user. The proposed work consists of three Software programs. The first one is async-wps which is a client library for accessing WPS 2.0 services. According to the accomplished requirements (Table 22), the library features: •Support for WPS 2.0 operations: GetCapabilities, DescribeProcess, Execute, Get- Status and GetResult. •Compatibility with NodeJS and browsers (e.g. Chrome and Firefox). 87
•Support for ComplexData type as input for the WPS server. •Open source license. •Simple JavaScript API that supports asynchronous execution using Promise API and automatic transformation between JavaScript objects and XML documents. The second Software is a WPS 2.0 server for performing kNN classification. According to the requirements specified in Table 23, the web server is able to: •Provide a web API using a simple and unique entry point. •Support for all the operations of WPS 2.0 standard. •Support for kNN classification. The input data can be specified either using HTTP POST body or XML files. This operation can be done asynchronously as well as synchronously. The last Software is a web application called Indoor Location Management Tool. It is still a development phase, yet the requirements for the scope of this thesis are accomplished (Table 24). In short: •Support for tabular and map visualization of the Indoor Location database. In both cases, it is possible to filter the database entries using form controls and geospatial operations. The type of filter depends on the type of the selected property (geospatial or alphanumerical). •Support for the creation of clusters of database entries, called experiments. This option enables the batch execution of statistical analysis and allows a post-execution comparison. •Open source license. 88
In conclusion, WPS 2.0 standard represent a solid communication protocol for processintensive web services. The use case for this thesis implemented a simple kNN classification algorithm, but the same idea can be extended to more complex algorithm and more complex input datasets. A further revision of WPS for improving the GetStatus workflow would improve the performance of the standard. 89