Multi-Layer Semantic Middleware for Cross-Domain Internet of Things

Heterogeneous access is an issue caused by different standards of devices and systems in the Internet of Things(IoT), which makes cross-domain devices difficult to connect and communicate with each other. In this paper, to solve the interoperability problem for cross-domain IoT, a multi-layer semantic middleware framework using a WoT-based knowledge graph is proposed. Firstly, the knowledge graphs of sub-domains are built respectively, and then integrate them through a middleware framework based on WoT. We evaluated the effectiveness of this proposed approach through a cross-domain Smart Building project. We find that our approach can effectively enable cross-domain IoT interoperability.


Introduction
Internet of Things (IoT), is a large network combining all kinds of things in the Internet. It collects all kinds of data needed in the network in real-time to realize the interconnection between Things and Things, and between people and Things. Traditional smart city infrastructure uses a closed-loop IoT system to manage, analyze and control data. In the future, new smart cities tend to be highly efficient collaborative sharing, which urgently requires the maximum open sharing of data. It involves the evolution of the Internet of Things framework, Internet of Things data sharing, etc. Therefore, breaking the data island, and understanding the semantic information of data generated by different devices have become urgent problems to be solved in the field of the Internet of Things. To solve this question, IoT middleware has been proposed in previous studies to eliminate the differences between heterogeneous IoT devices, systems, and platforms. Figure  1 presents an application scenario of the heterogeneous systems. In the smart building system, the functional use of the smart home does not include the electricity use of each home appliance, while the smart grid system monitors the electricity use of each home appliance. We demand that the management and control system needs can control the use of smart home appliances to achieve the purpose of optimizing the use of electricity. Internet of Things is expanding in terms of both the number of devices and the amount of data produced. To capture the knowledge that describes open and shared knowledge representations are needed. The knowledge graph is a knowledge base or knowledge collection represented by a graph model, which effectively expresses the relations among entities, concepts, and attributes. The expression is more intuitive and vivid, and easy to learn and access. Besides, WoT framework based on World Wide Web protocols can also help eliminate the heterogeneity of standards. To solve the problem, we propose a multi-layer semantic middleware framework using a WoT-based knowledge graph for the management of resources in the Internet of Things, as shown in figure 2. this approach has some contributions as this:   We used an IoT project to test the performance of the multi-layer semantic middleware framework proposed in this paper. We found that this method can effectively solve the problem of cross-domain heterogeneous access.
In the rest of the paper, we will introduce the related work in Section II, introduce the knowledge graph model composed of pattern layer and data layer in Section III, test the performance of this model with a simulation project in Section IV, and discuss the conclusions in Section V.

Knowledge graph
To facilitate data analysis, sensors should be able to represent the data they acquire in a common format [4], which is supported by the Semantic Web [5] and ontology theory [6]. Currently, varieties of data formats, vocabularies, and ontology [7] have been used to represent restricted knowledge domains. Semantic Sensor Network (SSN [8]) and Sensors, Observations, Samples, and Actuators (SOSA [9]) ontology form a knowledge representation for sensor applications. Vocabularies such as LOV [10] and LOV4IOT [11] collect all kinds of ontology directories for user selection, contributor submission, and improvement.

Semantic interoperability
with the development of IoT, the realization of full semantic interoperability is also extremely important in recent years.OneM2M provides a common M2M service layer platform access interface and its standards [12]. Besides, oneM2M [12] technology researchers focus on demand,system framework, protocol, safety,management,abstract,ontology, cases,semantic,test, etc.
The challenge of interoperability of information systems has been raised since the last century. However, current research focuses on heterogeneous data integration methods from various platforms. Actually, heterogeneous data from different sources have a significant impact on IoT services. Representing these heterogeneous data in a common format contributes to the cross-platform interoperability for the Internet of Things. From current research, there are over 380 ontology-based IoT projects, and the key challenge is to ensure semantic interoperability between existing IoT applications, systems, and platforms.

Knowledge Graph Models Based on WoT
In order to realize the control and communication of cross-domain platforms, we should first describe the sub-domains, and then integrate them through a middleware framework based on WoT.

Knowledge graph of the sub-domains
A knowledge graph is a semantic network representing the relationships between entities, which describes concepts, entities, and the relationships between them in the Internet of Things in a structured way. The schema layer of the knowledge graph can be considered as an ontology. Ontology is a key reference model for semantic level interoperability. Each piece of knowledge in the model is represented as an SPO triplet. In the knowledge graph, the triplet relationship is formally represented by RDF, and the form of the triplet is <subject, predicate, object>. Ontology and its instantiations are modeled as triples that follow the RDF pattern. Since the object of one triplet can be the subjects of other triples, the overall structure becomes a graph. Turtle is one of the most common serialization formats for RDF, which we use in this work. Due to the relatively fixed characteristics of devices in the Internet of Things system, the top-down construction method can be adopted. The construction process of the knowledge graph includes selection and development of the ontology, ontology instantiation, and semantic annotation. This construction method needs to utilize some existing structured knowledge base as the basic knowledge base. We use the standardized oneM2M base ontology as our base ontology, select the appropriate subset according to the requirements and modify or extend the content and structure. The schema layer of the knowledge graph for the Smart Building scenario is defined based on oneM2M, as shown in figure 3: Device, Platform, System is the subclasses of Thing, Property represents an attribute of an object, Property instance is an entity representing data, Unit contains data of an attribute of an object, Command represents executable operations, and Service is the representation of functions in the network. The ontology describes not only the properties of the object but also the metadata of those properties. The data layer of the knowledge graph can be constructed through ontology instantiation and semantic annotation. Instantiations are modeled as triples that follow the RDF pattern. Through semantic annotation, the resource information generated by devices in the Internet of Things is linked to the ontology established in the previous step, and the IoT knowledge graph is finally created from scratch. A URI is a string used to uniquely identify a resource for RDF. Various resources such as videos, images, documents existing in the Internet of Things can be identified by URIs.URIs usually consist of three parts: 1) the naming mechanism of the resource;2) The hostname of the resource;3) The name of the resource itself. To integrate the various systems in the Internet of Things and achieve interoperability between the systems, we need to integrate the established systems. If none of the semantic-supporting systems exist, we can build these systems together and select the appropriate generic subset of ontology for the public domain of these systems, as described above. If one system already supports semantic functionality but the other does not, then design the other system's semantic functionality with the relevant ontology or define a vocabulary directly to achieve the mapping between systems. If both systems already support semantic functionality, the only way to map between systems is to define a vocabulary.

System design
Through the above process of ontology development, instantiation, and knowledge fusion, resources, and attributes in the Internet of Things can be mapped to an IoT knowledge graph. Apache Jena is a classical semantic web framework based on Java about it. It provides a large number of APIs that support RDFS and OWL and realizes the access and output of dynamic data. Thus, it is also considered as a WoT(Web of Things) project. In this work, the system design is shown in figure 4. TDB is a database for storing RDF and provides very high storage performance. Fuseki is Jena's SPARQL server, or SPARQL Endpoint, which provides SPARQL updates, queries, modifications, and other services over HTTP. Fuseki is highly integrated with TDB, not only integrating Jena text queries and Jena spatial queries but also providing a robust business persistence storage layer.ARQ is a query engine of Jena supporting SPARQL's RDF query language. Besides, Jena provides RDFS, OWL, and Generic Rules Reasoner.

Use cases
We chose Smart Building as one of the use cases. Assume that a house has two rooms, a hall, a kitchen and a bathroom, a total of five spaces. Each space has a heating system, a heating system may correspond to several heaters, such as air conditioning, stove, etc. Typically, the Nation Grid provides a tiered tariff, in which the price of electricity increases in a step-by-step way as for electricity consumption increases, to improve energy efficiency. Smart Buildings users want to optimize the energy consumption of the house, need to know the power consumption of each appliance in the house, and be able to adjust the state of each appliance on time.
To achieve this use case, the following different systems need to be integrated: 1) heating systems for each space;2) Energy monitoring system for each electrical appliance. To achieve interoperability between the different devices of the heating system and the energy monitoring system, agreement on interface and information modeling is necessary. Therefore, we will show how to model relevant information at the semantic level for semantic interoperability. shown in figure 5. For the sake of illustration, we have omitted the unnecessary parts. The information to be modeled includes:1) Equipment (unit, command, mode, service, energy consumption profile, etc). 2) Space (state, command, mode, service, surrounding temperature, etc).

Evaluation
We designed the system based on the WoT framework, and as a result, the system was highly dependent on Web services, so we evaluated the management system using metrics such as response time and scalability that evaluated the Web system. The response time reflects whether the service can be provided to the users quickly and effectively. Set up virtual users to simulate concurrency, select a typical service query process, and record the response time. The shorter the response time, the faster the service is provided. Set up the three use case descriptions as shown in table 1, and test the system response time, i.e., Round-Trip Time(RTT), in the case of a single user. The results showed that the Average RTT was within the range of 50ms. scalability is the ability of a system to expand and grow. Latency is an important indicator to evaluate scalability. The lower latency indicates the better scalability of the system. The goal of scalability is to achieve maximum throughput with acceptable latency. Besides, test the response time of the system as the number of users increases. The virtual users are the number of threads, and the duration corresponding to the number of threads is set as the 60s. The number of users changes over time and the result of system response time in figure 6. The results show that as the number of users increases, so does the system response time.  Figure 6. Response time of the cross-domain management system over user numbers.

Conclusion
In this paper, a multi-layer semantic middleware framework using the WoT-based knowledge graph is proposed to reduce the heterogeneity among IoT devices. The feasibility of the proposed solution was verified by a virtual IoT project. Besides, the proposed solution can also be applied to other IoT projects with cross-domain interaction requirements.