Standardized WOT service interface generation system and method for Internet of Things equipment
By attaching interface description information to IoT devices and semantic annotation, a standardized WOT service interface is automatically generated, which solves the complexity of device access control and management, and realizes efficient matching and comprehensive control of devices.
Patent Information
- Application Number
- CN202411567768.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-25
AI Technical Summary
With the complexity of the types and application scenarios of IoT devices, it is difficult for the prior art to effectively describe the usage methods and operation information of the device, resulting in difficulties in access control and unified query and control of the device.
By attaching device interface description information and semantic annotation for the device description, the WOT service interface of the device is automatically generated, and standardized interface description and access control methods are provided to realize device matching and comprehensive control.
It realizes the generation of standardized WOT service interfaces of the device, simplifies the access control and management of the device, and improves the interoperability and intelligent management capabilities of the device.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of Internet of Things, and in particular relates to a standardized WOT service interface generation system and method for Internet of Things devices. Background Art
[0002] The Internet of Things publishes WOT (Web of Things) devices as available resources to the network, making them directly accessible through the network, greatly facilitating access control and management of IoT devices. With the World Wide Web Consortium (W3C) proposing the Thing Description specification, WOT devices have implemented a unified interface description in the form of Web services, promoting the interoperability and intelligent management of WOT (Web of Things) devices. However, with the increasing number of IoT devices, the application scenarios are becoming more and more complex, and the usage of various devices is also very different. If the interface service description of the IoT device cannot accurately describe the device's usage and operation information in a standardized form, access control of the device will also be very difficult, and devices with similar functions may also have different descriptions, resulting in problems with unified query and control of multiple devices. Summary of the invention
[0003] The purpose of the present invention is to overcome the shortcomings of the background technology and provide a standardized WOT service interface generation system and method for IoT devices. By attaching device interface description information to the device description and performing semantic annotation, the WOT service interface of the device can be automatically generated when the device is registered. The user can obtain the description information and access control method of the device, and can integrate different devices to achieve complex operations, which is convenient for users to match and comprehensively control the devices.
[0004] The technical problem of the present invention is solved by the following technical solutions:
[0005] A standardized WOT service interface generation system for IoT devices, the structure of which includes: WOT IoT devices, WOT IoT device semantic attachment platform and WOT IoT device comprehensive management platform;
[0006] The WOT IoT device includes a function realization module, a status module, a communication serial port and a data transfer unit DTU (Data Transfer Unit); the function realization module is used to complete the specific functions of the IoT device; the status module is used to obtain the status information of the current device corresponding to the function; the communication serial port is used to connect the data transfer unit; the data transfer unit DTU is used for data transmission between the device and the network;
[0007] The WOT IoT device semantic attachment platform is a web service program for implementing the registration of device description information and the semantic annotation agent, including three functional modules, which are processed in parallel by corresponding three threads respectively: Module 1 is used to process the registration of device description information, which is a front-end interface for enabling device providers to fill in the basic information of the device or directly submit a description file written in accordance with the set device interface description information specification; Module 2 is used to semantically annotate the submitted device interface description information based on the ontology, corresponding to two front-end interfaces for administrators, one is the ontology management and maintenance interface, where the administrator can add and modify the adopted domain ontology and the concepts and relationships in the ontology, and the other interface is the interface for semantic attachment of device description, which is a semi-automatic annotation process, which associates the concepts in the description with the concepts in the ontology based on semantic similarity calculation, and then the administrator checks the matching results, re-annotates the inaccurate concepts, manually matches the descriptions that are not matched to the concepts, and submits the semantically annotated description results to the background application, and the device information is labeled according to the semantic similarity calculation. The corresponding data format is stored in the database; Module 3 is used to complete the registration of the device, the generation process of the device service interface and error feedback, corresponding to a front-end interface for the registration of the device provider and the feedback of the generation result of the device service interface. The program is based on the EMQX server address and port number provided in the device interface description information, the topics of publishing and subscription, and the data content and format required for interacting with the device. Based on the MQTT client integrated in the platform, the program makes an access request to the device, sends the request to the DTU through the EMQX server, and inputs it through the serial port of the device. The status module is called to detect the device status and return the result. The results are divided into three types: the device is online (active / idle in operation), the device is offline or an error Error (may be an access address error or method error). The device provider can understand the registration status of the device through the front-end page, and can re-register in time when an error occurs; if the registration is successful, the program will automatically generate the interface service of the device based on the script and the content in the device interface description, and return the interface document to the front end for the device provider to view;
[0008] Further, the device interface description information specification and the specification content when the device provider fills in the device information include: ① Function description of the device: function name, optional function content, environmental attributes affected by the function, impact method, EMQX server address and port number, publishing and subscribing topics, access methods and parameters, and return result data format and unit. The user, that is, the user of the device, only needs to input the environmental attributes and the desired way to change the environmental attributes through the front-end interface to achieve rapid search and positioning of the device, and regulate the device based on the EMQX server address and port number, publishing and subscribing topics and access methods; ② Device status description: status name, optional status content, function name corresponding to the status, EMQX server address and port number, publishing and subscribing topics, access methods and parameters, and return result data format and unit, where any state corresponds to the function in ① one by one. Before calling the device to execute function F1 in ① (device status before execution: S0 / status after execution: S1), the user should first obtain the current device status S corresponding to function F1 in ②. c , if S c If S is the same as S1, no need to execute. c If it is the same as S0, this function will be executed; ③Description of device online status: status result (online, offline and error), EMQX server address and port number, publish and subscribe topics, access methods and parameters, and return result data format. In the process of completing device registration and error feedback in module three of the above program, the program establishes a connection with the device by publishing and subscribing to the device online status topic in ③. At the same time, the program will continue to subscribe to and listen to the topic. When the device goes offline, the program will receive a notification immediately and modify the device status immediately. The user can view the online status of the device through the front-end interface; ④Device semantic annotation namespace: ontology name and ontology access address, including the name and access address of the ontology to which the concept used for semantic annotation in the description belongs;
[0009] Furthermore, the contents in ① and ② all contain a semantic field to annotate the described vocabulary, and the content of the semantic field is the concept of the ontology with similar semantics. That is, in the process of semantically annotating the submitted device description information based on the ontology in the above module 2, if the device provider registers the device information in the form of filling in the front-end interface, the optional vocabulary concepts in the filling process all originate from the concepts in the ontology stored in the program; if the device provider directly submits the device description file, the program first parses the file, and performs semantic matching in the ontology concepts for the contents corresponding to ① and ②, finds the most similar ontology concept and annotates it, and if the program determines that there is no similar concept, the administrator manually annotates or maintains and adds the concepts in the ontology;
[0010] Furthermore, the specific process of automatically generating the device interface service based on the script and the device interface description is as follows: first, the device interface description is parsed to obtain device-related information, and an MQTT client is generated based on the EMQX server address and port number and the topic configuration of publishing and subscribing; secondly, the script generates different URLs for binding according to different functions in the device interface description, and the generated URL adopts the form of "http: / / WOT IoT device semantic attachment platform ip address: port number / device id / publish and subscribe topic", and at the same time, based on the content of different parts of the device interface description information, different http access methods are bound to it, and for the part that does not require input parameters, it is bound to the GET method; for the part containing input information, it is bound to the POST method, and the required input content is accessed as the request body; at the same time, a configuration and deletion interface is automatically generated in the script, which are used to configure and modify the device interface service and delete the device, and the two are bound to PUT and DELETE methods respectively;
[0011] The WOT IoT device integrated management platform is a service program, which is used as a service agent for device matching query and access call. It has three functional interfaces: Functional interface one is used for matching query and status detection of devices, corresponding to a front-end interface for users and a front-end interface for administrators. Users and administrators can view device information and status, search for devices by entering device ID or device related information in the front-end search box, and can also search and match devices by only entering environmental attributes. Furthermore, environmental attributes and the desired change method of environmental attributes can be entered in the front-end search box to match devices and specific functions of devices. In addition, compared with users, administrators have the authority to modify and configure the specific information of devices, while users can only access and call devices within their authority. Functional interface two is used to access and call IoT devices, including two methods: one is to point to There are two types of calls: a fixed call, which is to specify the regulation of device information, and a matching call, which is to specify the regulation of device information. It corresponds to a front-end interface. The user or administrator enters the device ID, the name of the function to be called, the content of the function to be called, and the target state through the front-end interface. After submission, the program will find the access URL information of the corresponding function of the device according to the input content for access, and return the access call result to the front-end display; or, the user or administrator chooses a matching call, and only needs to enter the environmental attributes to be changed, location information, and the expected change method. After submission, the program will match the input content with the content of the device information registered in the WOT IoT device semantic attachment platform, obtain the device that best meets the needs of the user or administrator, call the corresponding function of the device to execute, and return the result to the front-end; Function interface three is used for viewing and maintaining the device information knowledge graph, and function interfaces one and two call the device information knowledge graph, including query and matching based on the knowledge graph;
[0012] Furthermore, the device matching process in the matching call is completed based on the device knowledge graph. After the registered device and interface service generation are completed in the WOT IoT device semantic attachment platform, the program stores the device structured interface service description information in the database on the one hand, and on the other hand, transmits the device information to the WOT IoT device comprehensive management platform to generate the device information knowledge graph of the above three functional interfaces; the newly added devices are divided into two different types: sensors and actuators. For sensors, after registration, the basic information stored in the device and the device name, device ID and environmental attributes that the device can obtain in the user matching management information are added to the device information knowledge graph, and a sensor node is created in the graph to and environmental attribute nodes. If the environmental attribute node already exists in the graph, there is no need to create it, and the environmental attribute node can be directly connected to the newly created sensor node. For the actuator, after registration, the basic information stored in the device and the device name, device ID, device function name, device function content, affected environmental attributes and the way the impact is in the user matching management information are added to the device information knowledge graph, and the actuator node, actuator function node, environmental attribute node and the relationship between the actuator function node and the environmental attribute node (the way the above-mentioned actuator function affects the environmental attributes) are created in the graph. If the environmental attribute node already exists in the graph, there is no need to create it, and the environmental attribute node can be directly connected to the newly created actuator node.
[0013] A method for generating a standardized WOT service interface for IoT devices includes the following steps:
[0014] In the first step, the device provider fills in or submits the device description information according to the provided device interface description information specification through the front-end interface, and performs semantic annotation processing on the device interface description information;
[0015] In the second step, after the device description information is submitted, the WOT IoT device semantic attachment platform establishes a connection with the DTU module in the device based on the MQTT protocol according to the device online status description in the device description information, and then establishes a connection with the device;
[0016] In the third step, after the connection is established, the device sends the basic device description information stored in it to the WOT IoT device semantic attachment platform through the DTU, and the DTU indicator lights up, indicating that the information is in the process of transmission;
[0017] Step 4: After the transmission is completed, the DTU indicator light goes out, and the WOT IoT device semantic attachment platform obtains all the information of the device, and based on the information, generates the device interface service and device interface document through scripts and binding processes;
[0018] The fifth step is to input the generated device interface document and device interface description information into the WOT IoT device integrated management platform and store them in the database. A device interface service access module is generated in the platform front end, and a device information knowledge graph is generated.
[0019] Step 6. In the WOT IoT device integrated management platform, users or administrators can directly search for devices by inputting device-related information through the front-end interface, or perform matching searches based on the device information knowledge graph; or input instructions or requirements through the front-end interface, and access and call devices by querying or matching device information;
[0020] If the device online status of the IoT device returns the result of Online, it means that the IoT device is online and has successfully established a connection with the Rest API. At this time, after waiting for the device to pass the basic information to the WOT IoT device semantic attachment platform, the device interface service and the corresponding device interface document are automatically generated based on all the information and the script program in the platform; at the same time, the interface document and all the device information are passed to the WOT IoT device integrated management platform, and the user can query and access the device through the functional interfaces 1 and 2 of the WOT IoT device integrated management platform;
[0021] If the online status of the IoT device returns Offline, it means that the IoT device is not online yet and cannot be registered. You can monitor the URL in the device's online description information and wait for the device to come online before executing the registration process.
[0022] If the device online status of the IoT device returns an Error, it indicates that an error occurred in connecting to the IoT device. The program will automatically retry every 5 seconds. After connecting 3 times, if the device is still connected, it will return to the device registration front-end interface of the WOT IoT device semantic attachment platform, and the device provider will re-register the IoT device.
[0023] Furthermore, the registration of the IoT device description information in the first step needs to be performed in accordance with the set device interface description specification. The specific steps of IoT device registration are:
[0024] 1) In the WOT IoT device semantic attachment platform module 1, the device provider submits the device description information in the form of information filling or file submission in the front-end interface according to the user matching management information description specification;
[0025] 2) The device administrator logs in to the semantic attachment platform, and the semantic attachment platform module 2 semi-automatically semantically annotates the submitted device description information based on the concepts in the ontology pre-stored in the platform;
[0026] 3) The administrator corrects and supplements the parts that have not been successfully annotated or are annotated inaccurately. If there is no accurately described vocabulary concept in the ontology, the administrator expands the concepts in the ontology in the ontology management and maintenance interface in module 2.
[0027] Furthermore, in the third step, the basic device description information includes the original device ID, device name and location, which together with the device interface description information in the first step constitute the complete device information. The specific steps for obtaining the basic device information are:
[0028] 1) After the user matching management information of the device is registered, the WOT IoT device semantic attachment platform sends instructions to the EMQX server of the device to publish and subscribe to the topic based on the content of the device online status description;
[0029] 2) After receiving the instruction, EMQX sends it to DTU. The sending process is based on the MQTT client integrated in the platform and is sent to DTU in the form of publish and subscribe using the MQTT protocol;
[0030] 3) DTU inputs the subscribed instructions into the device through the serial port module of the device;
[0031] 4) After receiving the command, the device returns the basic information stored in the device to the EMQX server through the DTU, and then returns to the WOT IoT device semantic attachment platform. During this process, the DTU indicator lights up, indicating that it is in the data transmission process;
[0032] 5) After the transmission is completed, the DTU indicator light goes out, the transmission is completed, and the WOT IoT device semantic attachment platform successfully receives the basic information of the registered device.
[0033] Furthermore, the specific steps of generating the interface service of the device in the fourth step are as follows:
[0034] 1) Input all the acquired device information into the WOT IoT device semantic attachment platform module 3 for analysis;
[0035] 2) Fill in the required parts of the program script according to the parsed content;
[0036] 3) The program script generates URLs corresponding to different functions of the device in the form of "http: / / WOT IoT device semantic attachment platform ip address: port number / device id / publish and subscribe topic" according to the input information;
[0037] 4) The program script automatically binds the access method of the URL according to the device function and input and output; at the same time, the device configuration and deletion interface are added, and the PUT and DELETE methods are bound respectively;
[0038] 5) Generate the WOT service interface and interface documentation of the device.
[0039] Furthermore, in the fifth step, the generated device interface document and device interface description information are input into the WOT IoT device integrated management platform, and stored in the database for storage, a device interface service access module is generated in the platform front end, and a device information knowledge graph is generated at the same time. The specific steps are:
[0040] 1) After receiving all the information of the registered device and the interface document of the device, the WOT IoT device integrated management platform stores the two in the device information database for storage;
[0041] 2) The WOT IoT device integrated management platform adds the device information to the device information knowledge graph through functional interface 3;
[0042] 3) If the added device is a sensor, the content added to the device information knowledge graph is: device name, device ID, and environmental attributes that the device can obtain, which correspond to the sensor node and environmental attribute node in the device information knowledge graph respectively;
[0043] 4) If the added device is an actuator, the content added to the device information knowledge graph is: device name, device ID, device function name, device function content, affected environmental attributes and the way of impact, which correspond to the actuator node, actuator function node, environmental attribute node and the relationship between the actuator function node and the environmental attribute node in the device information knowledge graph respectively;
[0044] 5) In the device information knowledge graph described in step 3) and step 4), for the device added in step 3) and step 4), if an environment attribute node already exists, there is no need to create the environment attribute node again, and only the sensor node or actuator node needs to be connected to the environment attribute node;
[0045] 6) The administrator logs in to the WOT IoT device integrated management platform, manages and maintains the device information knowledge graph through the platform's functional interface 3, and solves problems that arise during the device information addition process;
[0046] 7) In the WOT IoT device integrated management platform, users or administrators can directly search for devices by inputting device-related information through the front-end interface, or perform matching searches based on the device information knowledge graph; or input instructions or requirements through the front-end interface, and access and call devices by querying or matching device information.
[0047] Furthermore, in the sixth step, the user or administrator directly searches for the device by inputting device-related information through the front-end interface. The specific steps are:
[0048] 1) A user or administrator logs in to the WOT IoT device integrated management platform, and the platform performs login authentication. If the administrator logs in, all functions of the functional interface 1 are presented to the administrator; if the user logs in, only some functions of the functional interface 1, that is, all information of devices to which the user has access rights and some information of other devices are presented to the front-end interface;
[0049] 2) The user or administrator enters relevant device information through the device search box in the front-end interface and submits it to the functional interface of the WOT IoT device integrated management platform to query the device information; the information entered in the device search box may be: device ID or device related information or environmental attributes and the desired way to change the environmental attributes;
[0050] 3) After receiving the input device information, the functional interface 1 of the WOT IoT device integrated management platform calls the functional interface 3 to match and retrieve the device in the device information knowledge graph, and forms a matching subgraph with the device ID or device-related information or environmental attributes and the expected way to change the environmental attributes, and matches it in the device information knowledge graph, and obtains the information in all nodes of the device stored in the graph;
[0051] 4) The acquired device information is returned to the front-end interface for display to the user or administrator.
[0052] Furthermore, in the sixth step, the user or administrator accesses and calls the device by querying or matching the device information, and the specific steps are:
[0053] 1) A user or administrator logs in to the WOT IoT device integrated management platform, and the platform performs login authentication. If the user logs in, all functions of the functional interface 2 are presented to the administrator; if the user logs in, only some functions of the functional interface 2, that is, all information of devices to which the user has access rights and some information of other devices are presented to the front-end interface;
[0054] 2) The user or administrator enters the relevant device information through the device search box in the front-end interface and submits it to the functional interface 2 of the WOT IoT device integrated management platform to access and call the device information; the information entered in the device search box includes two types, one is a specified call (regulation of specified device information) and the other is a matching call (regulation without specified device information). The content of the specified call input is: device ID, name of the function to be called, content of the function to be called and target state; the content of the matching call input is: environmental attributes to be changed, location information and the expected change method;
[0055] 3) After receiving the input device information, the function interface 2 of the WOT IoT device integrated management platform calls the function interface 3 to match and retrieve the device in the device information knowledge graph. If it is a specified call, it directly searches the database of the storage device according to the input content; if it is a matching call, the input environmental attributes to be changed, location information and the expected change method form a matching subgraph, match it in the device information knowledge graph, and obtain the information in all nodes of the device stored in the graph;
[0056] 4) After returning the acquired device information to the second functional interface, the second functional interface accesses the device's Rest API based on the device information, and then calls the device itself through the DTU;
[0057] 5) The result of the device calling the execution function is returned to the front-end interface for display to the user or administrator.
[0058] Beneficial effects:
[0059] The present invention realizes the generation of standardized WOT service interfaces for IoT devices for standardized calling of WOT devices. Through the specification and semantic annotation of device interface description, the generation of device interface and the mapping binding with device functions, the standardized WOT service interface of the device can be generated after the device is registered. Meanwhile, the standardized interface description enables the user to match and access the device only according to the user's own requirements on environmental attributes without understanding the usage of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 It is a block diagram of the overall structure of the system of the present invention.
[0061] Figure 2 This is a flow chart for generating the WOT service interface of the Internet of Things device of the present invention.
[0062] Figure 3 This is an example structural diagram of the device information knowledge graph of the present invention. DETAILED DESCRIPTION
[0063] The following will be combined with specific implementation methods and drawings to clearly and completely describe the concept, specific structure and technical effects of the present invention, so as to fully understand the purpose, scheme and effect of the present invention. It should be understood that the specific implementation methods described herein are only used to explain the present invention patent, and are not used to limit the present invention patent.
[0064] Example 1 Overall structure of a semantic attachment system for IoT device matching management
[0065] The overall structure diagram of the semantic attachment system for IoT device matching management of the present invention is as follows: Figure 1 As shown in the figure, the whole system consists of three parts: WOT IoT device, WOT IoT device semantic attachment platform and WOT IoT device comprehensive management platform. IoT device connects to DTU through serial port module and communicates data with the network through DTU in publish-subscribe mode; WOT IoT device semantic attachment platform realizes the registration of IoT device in the platform and the generation of device WOT service interface by semantically annotating device interface information described based on device interface description specification; WOT IoT device semantic attachment platform and WOT IoT device comprehensive management platform communicate data through network access, and WOT IoT device comprehensive management platform uses registered device information and generated device WOT service interface to enable users to retrieve and access the called device, and provides users with use at the front end of the platform.
[0066] Example 2 Composition of WOT IoT Device
[0067] The IoT device is composed of a function realization module, a status module, a configuration module, a serial port module and a data transfer unit DTU (Data Transfer Unit); the function realization module is used to specifically complete the specific functions of the IoT device; the status module is used to obtain the status information of the current device corresponding to the specific function and whether the device is online, etc.; the communication serial port is used to connect the data transfer unit; the data transfer unit DTU is used for data transmission between the device and the network in a publish-subscribe mode based on the MQTT protocol;
[0068] Example 3 Composition and semantic annotation of user matching management information of IoT devices
[0069] The user matching management information is composed of the following parts: ① The function description of the device: function name name, optional function content alterContent, environmental attribute property affected by the function, the impact mode (divided into increase, decrease and keep), EMQX server address and port number, publishing and subscription topics, access method method and parameter param, and return result data format scheme and unit. The user, that is, the user of the device, only needs to input the environmental attributes and the desired way to change the environmental attributes through the front-end interface to realize the rapid search and positioning of the device, and regulate the device based on the EMQX server address and port number, publishing and subscription topics and access methods, etc.; ② The state description of the device: state name, optional state content, function name corresponding to the state, EMQX server address and port number, The topics, access methods and parameters of the published and subscribed content, as well as the data format and unit of the returned results. Any state should correspond to the function in ① one by one. ③ Description of the online status of the device: status results (online, offline and error), EMQX server address and port number, topics, access methods and parameters of the published and subscribed content, and the data format of the returned results. After semantic annotation, a semantic attribute is extended for the content in each of the above parts to map the vocabulary in the description with the concepts in the ontology. At the same time, the namespace is extended in the description of the user matching management information to describe the access method and name of the ontology used. For example, if there is a description of temp for the environmental attribute property, the semantic annotation is semantic:temperature#WOT, which means that temp is mapped to the temperature concept in the WOT ontology.
[0070] Example 4 Composition of the WOT IoT Device Semantic Attachment Platform
[0071] The WOT IoT device semantic attachment platform is essentially a web service program with three main functional modules, which are processed in parallel by three corresponding threads:
[0072] Module 1 is used to process the registration and semantic annotation of the device description information. It is a front-end interface that enables the device provider to fill in the basic information of the device or directly submit a description file written in accordance with the set user matching management information specifications. After the device provider logs in to the platform, he selects the device registration method in the front-end interface. He can choose to fill in the device information form in the front-end interface. The filling process can only use the descriptive words provided in the form. These words are all concepts in the ontology stored in the platform; you can also choose to write it yourself according to the specifications and data format for the user matching management information description in the front-end interface and upload it in the file upload part of the front-end. The data format of the specified file should be written in json format. If the format does not match, an error will occur during the parsing process and it needs to be uploaded again;
[0073] Module 2 is used to semantically annotate the submitted device description information based on the ontology. It corresponds to two front-end interfaces for administrators. One is the ontology management and maintenance interface. After the administrator logs in and authenticates, he can view the concepts and relationships in the ontology on the front end, and can modify and save the concepts and relationships therein to achieve maintenance and management of the ontology. After logging in, the user can only view the concepts and relationships in the ontology. The other interface is the interface for semantic attachment of device descriptions. The platform will automatically match and annotate the user matching management information of the uploaded device based on the concepts in the ontology. After the administrator logs in to the platform, he can view and modify the automatically annotated device information, and submit it for storage after the administrator's review. If the match is inaccurate or the appropriate vocabulary is not matched, the administrator will modify or add the corresponding concept to the ontology.
[0074] Module three is used to complete the device registration, device service interface generation process and error feedback. It corresponds to a front-end interface for device providers to feedback on registration results and device service interface generation results. The program is based on the EMQX server address and port number provided in the device interface description information, the topics for publishing and subscribing, and the data content and format required for interacting with the device. It makes access requests to the device based on the MQTT client integrated in the platform, sends the request to the DTU through the EMQX server, and inputs it through the serial port of the device. The status module is called to detect the device status and return the result. After submitting the interface description information of the device, the device provider waits for the program to complete the subsequent operations automatically and returns the result to the front end. If the registration is successful, no operation is required. If there is a problem in the registration, the device provider needs to adjust or modify the device immediately and resubmit the correct device interface description information.
[0075] Example 5: Generation process of device service interface
[0076] The generation process of the device service interface is as follows: Figure 2 As shown, first, through the interface description file of the IoT device, all the information of the device is obtained, including device functions, input and output parameters, EMQX server address and port number, publish and subscribe topics, data format, etc. This information is input into the module three of the WOT IoT device semantic attachment platform for parsing. The program script in this module will parse the information according to the predefined device semantic model and extract the device functions, parameters and their corresponding semantic meanings. After parsing, the program will automatically fill in the script for generating interface services according to the parsed device functions and supplementary information. According to the parsed device functions and required input parameters, the program script will dynamically generate the URL corresponding to each function. These URLs follow the standard format of "http: / / WOT IoT device semantic attachment platform ip address: port number / device id / publish and subscribe topics", which facilitates the device to have HTTP call and access functions. According to the different functions of the device, the program script will automatically generate the corresponding HTTP method, such as `GET`, `POST`, `PUT` and `DELETE`, and bind it to the URL. Each HTTP method corresponds to different operations of the device. The specific binding rules are as follows: "GET method": usually used to read the status or data information of the device, such as querying the device status and obtaining sensor data. "POST method": used to perform device operations, such as turning on the device. "PUT method": used to update device configuration or parameter settings. "DELETE method": used to delete or unregister certain configuration information of the device. At the same time, the program will automatically generate an interface document describing the purpose of each URL, request parameters, response user format, etc., so that developers and users can understand how to use these interfaces.
[0077] Example 6 Composition of the WOT IoT Device Integrated Management Platform
[0078] The WOT IoT device integrated management platform is essentially a service program with three functional interfaces:
[0079] Functional interface 1 is used to match and query devices and detect their status. It corresponds to a front-end interface for users and a front-end interface for administrators. After logging in to the platform, users and administrators can view device information and status in the front-end interface, search for devices by entering device IDs or device-related information in the front-end search box, or enter environmental attributes and the desired way to change environmental attributes to match devices and specific functions of devices, thereby returning appropriate device information;
[0080] Functional interface 2 is used to access and call IoT devices, including two methods: one is designated call (regulation of designated device information), and the other is matching call (regulation without designated device information). It corresponds to a front-end interface. After the user or administrator logs in to the platform, he or she can select the access method in the form of the front-end interface. If designated call is selected, the device ID, the name of the function to be called, the content of the function to be called, and the target state form need to be filled in; if matching call is selected, the environmental attributes to be changed, location information, and the desired change method form need to be filled in; after the form is submitted, the device information that meets the requirements after query or matching will be displayed on the front-end interface and presented to the user or administrator;
[0081] Functional interface 3 is used for viewing and maintaining the device information knowledge graph and for calling the device information knowledge graph through functional interfaces 1 and 2, including query and matching based on the knowledge graph. Only administrators have access rights to this function. After logging in, administrators can operate the device information knowledge graph.
[0082] Example 7 IoT device information knowledge graph construction process
[0083] Device information knowledge graph Figure 3 As shown, it is divided into sensor nodes, actuator nodes and environmental attribute nodes, and the three are connected in the device information knowledge graph in the form of "sensor-environmental attribute-actuator"; when adding a new device, if it is a sensor device, you only need to add the device name node, device id node, device location node, and environmental attribute node (if it does not exist in the graph); if it is an actuator, you need to add the device name node, device id node, device location node, device function name node, device function content node. The device status node and environmental attribute node (if it does not exist in the graph); after adding successfully, the content of the added device information knowledge graph is presented in neo4j, and users and administrators can also access the information knowledge graph on the front end;
[0084] The above specific implementation methods are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A standardized WOT service interface generation system for IoT devices, the structure of which includes: WOT IoT devices, WOT IoT device semantic attachment platform and WOT IoT device comprehensive management platform; The WOT IoT device includes a function realization module, a status module, a communication serial port and a data transfer unit DTU (Data Transfer Unit); the function realization module is used to complete the specific functions of the IoT device; the status module is used to obtain the status information of the current device corresponding to the function; the communication serial port is used to connect the data transfer unit; the data transfer unit DTU is used for data transmission between the device and the network; The WOT IoT device semantic attachment platform is a web service program for implementing the registration of device description information and the semantic annotation agent, including three functional modules, which are processed in parallel by corresponding three threads respectively: Module 1 is used to process the registration of device description information, which is a front-end interface for enabling device providers to fill in the basic information of the device or directly submit a description file written in accordance with the set device interface description information specification; Module 2 is used to semantically annotate the submitted device interface description information based on the ontology, corresponding to two front-end interfaces for administrators, one is the ontology management and maintenance interface, where the administrator can add and modify the adopted domain ontology and the concepts and relationships in the ontology, and the other interface is the interface for semantic attachment of device description, which is a semi-automatic annotation process, which associates the concepts in the description with the concepts in the ontology based on semantic similarity calculation, and then the administrator checks the matching results, re-annotates the inaccurate concepts, manually matches the descriptions that are not matched to the concepts, and submits the semantically annotated description results to the background application, and the device information is labeled according to the semantic similarity calculation. The corresponding data format is stored in the database; Module 3 is used to complete the registration of the device, the generation process of the device service interface and error feedback, corresponding to a front-end interface for the registration of the device provider and the feedback of the generation result of the device service interface. The program is based on the EMQX server address and port number provided in the device interface description information, the topics of publishing and subscription, and the data content and format required for interacting with the device. Based on the MQTT client integrated in the platform, the program makes an access request to the device, sends the request to the DTU through the EMQX server, and inputs it through the serial port of the device. The status module is called to detect the device status and return the result. The results are divided into three types: the device is online (active / idle in operation), the device is offline or an error Error (may be an access address error or method error). The device provider can understand the registration status of the device through the front-end page, and can re-register in time when an error occurs; if the registration is successful, the program will automatically generate the interface service of the device based on the script and the content in the device interface description, and return the interface document to the front end for the device provider to view; The WOT IoT device integrated management platform is a service program, which is used as a service agent for device matching query and access call. It has three functional interfaces: Functional interface one is used for matching query and status detection of devices, corresponding to a front-end interface for users and a front-end interface for administrators. Users and administrators can view device information and status, search for devices by entering device ID or device related information in the front-end search box, and can also search and match devices by only entering environmental attributes. Furthermore, environmental attributes and the desired change method of environmental attributes can be entered in the front-end search box to match devices and specific functions of devices. In addition, compared with users, administrators have the authority to modify and configure the specific information of devices, while users can only access and call devices within their authority. Functional interface two is used to access and call IoT devices, including two methods: one is to point to There are two types of calls: a fixed call, which is the regulation of specified device information, and a matching call, which is the regulation of unspecified device information. It corresponds to a front-end interface. The user or administrator enters the device ID, the name of the function to be called, the content of the function to be called, and the target state through the front-end interface. After submission, the program will search for the access URL information of the corresponding function of the device according to the input content, and return the access call result to the front-end display; or, the user or administrator chooses a matching call, and only needs to enter the environmental attributes to be changed, location information, and the expected change method. After submission, the program will match the input content with the content of the device information registered in the WOT IoT device semantic attachment platform, obtain the device that best meets the needs of the user or administrator, call the corresponding function of the device to execute, and return the result to the front-end; Function interface three is used for viewing and maintaining the device information knowledge graph and function interfaces one and two call the device information knowledge graph, including query and matching based on the knowledge graph.
2. A standardized WOT service interface generation system for IoT devices according to claim 1, characterized in that: The device interface description information specification and the specification content when the device provider fills in the device information include: ① Function description of the device: function name, optional function content, environmental attributes affected by the function, impact method, EMQX server address and port number, publishing and subscribing topics, access methods and parameters, and return result data format and unit. The user, that is, the user of the device, only needs to input the environmental attributes and the desired way to change the environmental attributes through the front-end interface to achieve rapid search and positioning of the device, and regulate the device based on the EMQX server address and port number, publishing and subscribing topics and access methods; ② Device status description: status name, optional status content, function name corresponding to the status, EMQX server address and port number, publishing and subscribing topics, access methods and parameters, and return result data format and unit, where any state corresponds to the function in ① one by one. Before calling the device to execute function F1 in ①, the user should first obtain the current device status S corresponding to function F1 in ②. c , if S c If S is the same as S1, no need to execute. c If it is the same as S0, this function will be executed; ③Description of device online status: status result, EMQX server address and port number, publish and subscribe topics, access methods and parameters, and return result data format. In the process of completing device registration and error feedback in module three of the above program, the program establishes a connection with the device by publishing and subscribing to the device online status topic in ③. At the same time, the program will continue to subscribe to and listen to the topic. When the device goes offline, the program will receive a notification immediately and modify the device status immediately. The user can view the online status of the device through the front-end interface; ④Device semantic annotation namespace: ontology name and ontology access address, including the name and access address of the ontology to which the concept used for semantic annotation in the description belongs; The contents in ① and ② all contain a semantic field to annotate the descriptive vocabulary. The content of the semantic field is the concept of the ontology with similar semantics. That is, in the process of semantically annotating the submitted device description information based on the ontology in the above module 2, if the device provider registers the device information in the form of filling in the front-end interface, the optional vocabulary concepts in the filling process all originate from the concepts in the ontology stored in the program; if the device provider directly submits the device description file, the program first parses the file, and performs semantic matching in the ontology concepts for the contents corresponding to ① and ②, finds the most similar ontology concept and annotates it. If the program determines that there is no similar concept, the administrator manually annotates it or maintains and adds the concepts in the ontology.
3. A standardized WOT service interface generation system for IoT devices according to claim 1, characterized in that: The specific process of automatically generating the device interface service based on the script and the device interface description is as follows: first, the device interface description is parsed to obtain device-related information, and an MQTT client is generated based on the EMQX server address and port number and the topic configuration of publishing and subscribing; secondly, for different functions in the device interface description, the script generates different URLs for binding, and the generated URL adopts the form of "http: / / WOT IoT device semantic attachment platform ip address: port number / device id / publish and subscribe topic", and at the same time, based on the content of different parts of the device interface description information, different http access methods are bound to it. For the part that does not require input parameters, it is bound to the GET method; for the part containing input information, it is bound to the POST method, and the required input content is accessed as the request body; at the same time, a configuration and deletion interface is automatically generated in the script, which are used to configure and modify the device's interface service and delete the device, respectively, and the two are bound to PUT and DELETE methods respectively.
4. A standardized WOT service interface generation system for IoT devices according to claim 1, characterized in that: The device matching process in the matching call is completed based on the device knowledge graph. After the registered device and interface service generation are completed in the WOT IoT device semantic attachment platform, the program stores the device structured interface service description information in the database on the one hand, and on the other hand, transmits the device information to the WOT IoT device comprehensive management platform to generate the device information knowledge graph of the above three functional interfaces; the newly added devices are divided into two different types: sensors and actuators. For sensors, after registration, the basic information stored in the device and the device name, device ID and environmental attributes that the device can obtain in the user matching management information are added to the device information knowledge graph, and a sensor node and an environmental attribute node are created in the graph. If the environmental attribute node already exists in the graph, it does not need to be created, and the environmental attribute node is directly connected to the newly created sensor node; For the actuator, after registration, the basic information stored in the device and the device name, device ID, device function name, device function content, affected environmental attributes and the way of impact in the user matching management information are added to the device information knowledge graph, and the actuator node, actuator function node, environmental attribute node and the relationship between the actuator function node and the environmental attribute node are created in the graph. If the environmental attribute node already exists in the graph, there is no need to create it, and directly connect the environmental attribute node and the newly created actuator node.
5. A method for generating a standardized WOT service interface for IoT devices, comprising the following steps: In the first step, the device provider fills in or submits the device description information according to the provided device interface description information specification through the front-end interface, and performs semantic annotation processing on the device interface description information; In the second step, after the device description information is submitted, the WOT IoT device semantic attachment platform establishes a connection with the DTU module in the device based on the MQTT protocol according to the device online status description in the device description information, and then establishes a connection with the device; In the third step, after the connection is established, the device sends the basic device description information stored in it to the WOT IoT device semantic attachment platform through the DTU, and the DTU indicator lights up, indicating that the information is in the process of transmission; Step 4: After the transmission is completed, the DTU indicator light goes out, and the WOT IoT device semantic attachment platform obtains all the information of the device, and based on the information, generates the device interface service and device interface document through scripts and binding processes; The fifth step is to input the generated device interface document and device interface description information into the WOT IoT device integrated management platform and store them in the database. A device interface service access module is generated in the platform front end, and a device information knowledge graph is generated. Step 6. In the WOT IoT device integrated management platform, users or administrators can directly search for devices by inputting device-related information through the front-end interface, or perform matching searches based on the device information knowledge graph; or input instructions or requirements through the front-end interface, and access and call devices by querying or matching device information; If the device online status of the IoT device returns the result of Online, it means that the IoT device is online and has successfully established a connection with the Rest API. At this time, after waiting for the device to pass the basic information to the WOT IoT device semantic attachment platform, the device interface service and the corresponding device interface document are automatically generated based on all the information and the script program in the platform; at the same time, the interface document and all the device information are passed to the WOT IoT device integrated management platform, and the user can query and access the device through the functional interfaces 1 and 2 of the WOT IoT device integrated management platform; If the online status of the IoT device returns Offline, it means that the IoT device is not online yet and cannot be registered. You can monitor the URL in the device's online description information and wait for the device to come online before executing the registration process. If the device online status of the IoT device returns an Error, it indicates that an error occurred in connecting to the IoT device. The program will automatically retry every 5 seconds. After connecting 3 times, if the device is still connected, it will return to the device registration front-end interface of the WOT IoT device semantic attachment platform, and the device provider will re-register the IoT device.
6. A method for generating a standardized WOT service interface for IoT devices according to claim 5, characterized in that: In the first step, the registration of IoT device description information must be performed in accordance with the set device interface description specification. The specific steps for IoT device registration are: 1) In the WOT IoT device semantic attachment platform module 1, the device provider submits the device description information in the form of information filling or file submission in the front-end interface according to the user matching management information description specification; 2) The device administrator logs in to the semantic attachment platform, and the semantic attachment platform module 2 semi-automatically semantically annotates the submitted device description information based on the concepts in the ontology pre-stored in the platform; 3) The administrator corrects and supplements the parts that have not been successfully annotated or are annotated inaccurately. If there is no accurately described vocabulary concept in the ontology, the administrator expands the concepts in the ontology in the ontology management and maintenance interface in module 2.
7. A method for generating a standardized WOT service interface for IoT devices according to claim 5, characterized in that: In the third step, the basic device description information includes the original device ID, device name and location, which together with the device interface description information in the first step constitute the complete device information. The specific steps for obtaining the basic device information are: 1) After the user matching management information of the device is registered, the WOT IoT device semantic attachment platform sends instructions to the EMQX server of the device to publish and subscribe to the topic based on the content of the device online status description; 2) After receiving the instruction, EMQX sends it to DTU. The sending process is based on the MQTT client integrated in the platform and is sent to DTU in the form of publish and subscribe using the MQTT protocol; 3) DTU inputs the subscribed instructions into the device through the serial port module of the device; 4) After receiving the command, the device returns the basic information stored in the device to the EMQX server through the DTU, and then returns to the WOT IoT device semantic attachment platform. During this process, the DTU indicator lights up, indicating that it is in the data transmission process; 5) After the transmission is completed, the DTU indicator light goes out, the transmission is completed, and the WOT IoT device semantic attachment platform successfully receives the basic information of the registered device.
8. A method for generating a standardized WOT service interface for IoT devices according to claim 5, characterized in that: The specific steps of generating the interface service of the device in the fourth step are as follows: 1) Input all the acquired device information into the WOT IoT device semantic attachment platform module 3 for analysis; 2) Fill in the required parts of the program script according to the parsed content; 3) The program script generates URLs corresponding to different functions of the device in the form of "http: / / WOT IoT device semantic attachment platform ip address: port number / device id / publish and subscribe topic" according to the input information; 4) The program script automatically binds the access method of the URL according to the device function and input and output; At the same time, add device configuration and deletion interfaces, and bind PUT and DELETE methods respectively; 5) Generate the WOT service interface and interface documentation of the device.
9. A method for generating a standardized WOT service interface for IoT devices according to claim 5, characterized in that: The fifth step is to input the generated device interface document and device interface description information into the WOT IoT device integrated management platform and store them in the database, generate a device interface service access module in the platform front end, and generate a device information knowledge graph. The specific steps are: 1) After receiving all the information of the registered device and the interface document of the device, the WOT IoT device integrated management platform stores the two in the device information database for storage; 2) The WOT IoT device integrated management platform adds the device information to the device information knowledge graph through functional interface 3; 3) If the added device is a sensor, the content added to the device information knowledge graph is: device name, device ID, and environmental attributes that the device can obtain, which correspond to the sensor node and environmental attribute node in the device information knowledge graph respectively; 4) If the added device is an actuator, the content added to the device information knowledge graph is: device name, device ID, device function name, device function content, affected environmental attributes and the way of impact, which correspond to the actuator node, actuator function node, environmental attribute node and the relationship between the actuator function node and the environmental attribute node in the device information knowledge graph respectively; 5) In the device information knowledge graph described in step 3) and step 4), for the device added in step 3) and step 4), if an environment attribute node already exists, there is no need to create the environment attribute node again, and only the sensor node or actuator node needs to be connected to the environment attribute node; 6) The administrator logs in to the WOT IoT device integrated management platform, manages and maintains the device information knowledge graph through the platform's functional interface 3, and solves problems that arise during the device information addition process; 7) In the WOT IoT device integrated management platform, users or administrators can directly search for devices by inputting device-related information through the front-end interface, or perform matching searches based on the device information knowledge graph; or input instructions or requirements through the front-end interface, and access and call devices by querying or matching device information.
10. A method for generating a standardized WOT service interface for IoT devices according to claim 5, characterized in that: In the sixth step, the user or administrator directly searches for the device by inputting device related information through the front-end interface. The specific steps are as follows: 1) A user or administrator logs in to the WOT IoT device integrated management platform, and the platform performs login authentication. If the administrator logs in, all functions of the functional interface 1 are presented to the administrator; if the user logs in, only some functions of the functional interface 1, that is, all information of devices to which the user has access rights and some information of other devices are presented to the front-end interface; 2) The user or administrator enters relevant device information through the device search box in the front-end interface and submits it to the functional interface of the WOT IoT device integrated management platform to query the device information; the information entered in the device search box may be: device ID or device related information or environmental attributes and the desired way to change the environmental attributes; 3) After receiving the input device information, the functional interface 1 of the WOT IoT device integrated management platform calls the functional interface 3 to match and retrieve the device in the device information knowledge graph, and forms a matching subgraph with the device ID or device-related information or environmental attributes and the expected way to change the environmental attributes, and matches it in the device information knowledge graph, and obtains the information in all nodes of the device stored in the graph; 4) Return the acquired device information to the front-end interface and display it to the user or administrator; In the sixth step, the user or administrator accesses and calls the device by querying or matching the device information. The specific steps are: 1) A user or administrator logs in to the WOT IoT device integrated management platform, and the platform performs login authentication. If the user logs in, all functions of the functional interface 2 are presented to the administrator; if the user logs in, only some functions of the functional interface 2, that is, all information of devices to which the user has access rights and some information of other devices are presented to the front-end interface; 2) The user or administrator enters the relevant device information through the device search box in the front-end interface and submits it to the functional interface 2 of the WOT IoT device integrated management platform to access and call the device information; the information entered in the device search box includes two types, one is a specified call and the other is a matching call. The content of the specified call input is: device ID, the name of the function to be called, the content of the function to be called and the target state; the content of the matching call input is: the environmental attributes to be changed, the location information and the expected change method; 3) After receiving the input device information, the function interface 2 of the WOT IoT device integrated management platform calls the function interface 3 to match and retrieve the device in the device information knowledge graph. If it is a specified call, it directly searches the database of the storage device according to the input content; if it is a matching call, the input environmental attributes to be changed, location information and the expected change method form a matching subgraph, match it in the device information knowledge graph, and obtain the information in all nodes of the device stored in the graph; 4) After returning the acquired device information to the second functional interface, the second functional interface accesses the device's Rest API based on the device information, and then calls the device itself through the DTU; 5) The result of the device calling the execution function is returned to the front-end interface for display to the user or administrator.