In the current world we have smart objects providing data (such as parking detectors telling which parking spots are currently available), and smart-objects/applications willing to find this data (such as an intelligent car or mobile applications looking for available parking). However, how can these components automatically discover and communicate among themselves? This is, in fact, the main problem we are addressing at the BIG IoT project.
Since 2016, the inLab Mobility Team is working in the BIG IoT European project (http://big-iot.eu/). This project is aimed at building a virtual marketplace where the smart objects might publish their data, so that applications can discover them. Moreover, the BIG IoT project is also building a library API that abstracts the differences between the different smart objects, and permits communicating with them with a unique interface. That is, smart objects publish data-offerings (a class from the library API), and smart objects willing to consume them only invokes data-offering operations (provided by the API). Thus, consuming data applications do not need to write a particular code for every particular smart object it wants to take data from (as it is happening right now), but only to invoke the BIG IoT library API offered methods.
In today’s blog article, we show how we have used, in the inLab Mobility Team, the BIG IoT marketplace and library API to discover and invoke some parking detectors deployed in the Les Corts neighborhood (thanks to the Worldsensing parking detectors). In summary, the BIG IoT library and marketplace is used in the three steps shown below:
Data offering publication: this step consists in publishing the data offering to the BIG IoT marketplace. This step is performed by the smart object against the marketplace.
Data offering discovery: this step consists in querying the BIG IoT marketplace in order to find the desired data offering. This step is performed by the consuming application against the marketplace.
Data offering invocation: once the desired data-offering has been discovered, the consuming application invokes it. This step is performed by the application against the smart-object.
In the following, we review each one of these steps separately.
Data offering publication
The data offering publication step consists in making some data available through the BIG IoT marketplace. The BIG IoT marketplace only stores the endpoint (i.e., the URL where the data invocation should be done) rather than the data itself. This means that the data is always stored by the smart-object.
The publication of the data offering is paired with a semantic description of it. This semantic description is composed of a Category, which describes the data-offering at a high-level, and a semantic annotation for each input/output parameter. This semantic description is the key for the discovery of the data-offering. Indeed, the discovery step is based on matching a description of a data offering query, with the description of the published offerings.
In the following, we show a shortened version of the semantic description of the data offering (called LesCortsParkingService) regarding available parking in Les Corts (Figure 1). In particular, we see the annotation of the category of the service (ParkingSpaceCategory, which means that the service retrieves locations where there are available/unavailable parkings), and the annotation of the output parameters (the first attributes are a latitude and a longitude, which identify a geoposition for the parking, and the last one is a parkingSpaceStatus which tells if the parking space is available/unavailable). This description also tells that the data from the service is obtained from the city of Barcelona, and can be accessed through the given URL. These semantic annotations are taken from the Schema.org and its extension Schema.big-iot.org ontologies, which serves as a common vocabulary for the BIG IoT annotations.
RegistrableOfferingDescriptionChain offeringDescription = provider.createOfferingDescription() .withName("LesCortsParkingService") .withCategory(urn:big-iot:ParkingSpaceCategory) .addOutputData("lat", new RDFType("schema:latitude"), ValueType.NUMBER) .addOutputData("long", new RDFType("schema:longitude"), ValueType.NUMBER) .addOutputData("stat", new RDFType("urn:big-iot:parkingSpaceStatus"), ValueType.TEXT) .inCity("Barcelona, Spain") .withRoute(url-service) provider.register(offeringDescription);
When executing the previous code, the data-offering regarding Les Corts parking is ready for being discovered.
Data offering query
The data offering query step is aimed at discovering a data offering published in the marketplace. The way of looking for data-offering mirrors the way of publishing this data. I.e., the query itself describes the data-offerings we would like to find.
When a data-offering satisfying the query is found, we can register to it in order to be able to access its data. It is important to note that, up to here, we have not invoked, in any sense, the code from the smart object. On the contrary, we have only been communicating with the central marketplace. Thus, all the integration effort, up to this step, is to integrate the application looking for data with the central Marketplace. This one-to-one integration with the central Marketplace is what permits a component accessing the many different data-offerings published in the Marketplace without constantly changing the code for each different smart-object.
In the following, we show a shortened version of the code to discover the previous data-offering from Les Corts (Figure 2). Roughly speaking, the query matches the data-offering description given previously (i.e., same Category and same output annotations).
OfferingQuery query = OfferingQuery.create("BasicParkingPlaceQuery") .withName("Basic Parking Query") .withCategory("urn:big-iot:ParkingSpaceCategory") .inCity("Barcelona, Spain") .addOutputData(new RDFType("schema:latitude"), ValueType.NUMBER) .addOutputData(new RDFType("schema:longitude"), ValueType.NUMBER) .addOutputData(new RDFType("urn:big-iot:parkingSpaceStatus"), ValueType.TEXT); OfferingDescription offeringD = consumer.discover(query).get().get(0); Offering offering = offeringD.subscribe().get();
At this point, after running the previous code, we have discovered and we are able to invoke LesCortsParkingService.
Data offering invocation
In this last step, the application finally invokes the registered data-offering. It is worth to mention that this invocation does not go through the BIG IoT marketplace, but goes directly to the smart-object given URL.
In the following, we show the code to invoke LesCortsParkingService (Figure 3).
AccessParameters inputParams = AccessParameters.create(); offering.accessOneTime().get(inputParams);
At this point, we have invoked LesCortsParkingService and can consume its data. Moreover, if a new data offering with the very same description as LesCortsParkingService is added into the marketplace (that is, a new data offering regarding the parking in Campus Nord), we are able to automatically discover, register and invoke it reusing the same code. Thus, the integration through the BIG IoT marketplace and library permits integrating not with one, but with many smart-objects (provided that their semantic descriptions coincide).
Using the BIG IoT marketplace and library we can obtain data from different smart-objects minimizing the code effort of tightening to a particular interface for each different smart-object. Moreover, we are able to automatically discover and invoke our desired data by means of data-offering queries to the marketplace.
In fact, the inLab Mobility Team has used the BIG IoT technologies to build a dashboard (Figure 4) for the city of BCN to discover and show data coming from several smart-objects deployed in BCN (parking spot detectors, bicing available bikes, traffic status and electric car charging stations).
Want to know more? Check the webpage of the project https://inlab.fib.upc.edu/en/h2020-big-iot or the publication Enabling IoT Ecosystems through Platform Interoperability.