A method and apparatus for combining Internet of Things (IoT) services
By constructing a context constraint model and a service pragmatic model, and combining Markov decision processes and BPMN model transformation, the problem of the impact of context dynamics in IoT service composition is solved, and a highly adaptable and reusable service composition process is achieved.
Patent Information
- Application Number
- CN202210836289.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2042-07-15
AI Technical Summary
Existing IoT service composition methods ignore the impact of contextual dynamism on service availability, resulting in insufficient process reusability and effectiveness, and a lack of systematic composition methods.
By acquiring basic information about IoT services, a context constraint model and a service pragmatic model are constructed. Markov decision processes and deep reinforcement learning techniques are used to determine the combination strategy. Combined with the BPMN model, process information is generated to achieve context-aware service composition.
It improves the adaptability and reusability of IoT service portfolios, enables on-demand service portfolios, and enhances the adaptability and effectiveness of the system.
Smart Images

Figure CN115423241B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Internet of Things (IoT) technology, and in particular to a method and apparatus for combining IoT services. Background Technology
[0002] Service-Oriented Architecture (SOA) has become a mainstream paradigm for application development in heterogeneous distributed environments. It encapsulates different functional units of an application as services, enabling rapid application design, development, and integration using services as fundamental building blocks. Microservices, as a specific service implementation method of SOA, are widely used to develop interoperable and integrated IoT systems, such as smart healthcare, smart homes, and smart city systems, due to their simplicity, lightweight nature, and ease of expansion. IoT systems based on microservice architecture provide functionality externally in the form of IoT services (implemented as microservices), widely using OpenAPI specifications to define service specifications. Since the functionality implemented by a single microservice is limited and difficult to provide complex functions, multiple microservices need to be organized and coordinated in a certain way to achieve more complex and powerful functions; this process is called service composition. Service composition enables rapid software development and improves service reusability.
[0003] In the Internet of Things (IoT) environment, service composition is closely linked to context. This is because IoT systems typically operate in dynamically changing environments, where the system's context state changes dynamically independent of its operation. Contextual states such as user or service location, time, and weather can cause service failures or unmet needs, posing a risk of system unavailability. Existing service composition methods neglect the impact of contextual dynamism on service availability, suffer from insufficient process reusability and effectiveness, and lack a systematic approach to IoT service composition. Therefore, a more effective and systematic IoT service composition method is needed, capable of effectively composing services based on contextual requirements. Summary of the Invention
[0004] The technical problem to be solved by this invention is to provide a method for composing Internet of Things (IoT) services. This method provides a systematic approach for designing IoT service composition processes, learning composition strategies, and deriving process instances to achieve context-aware on-demand composition of IoT services, thereby addressing the problems of insufficient process reusability and service composition effectiveness in existing technologies.
[0005] To address the aforementioned technical problems, in one aspect, the present invention provides a method for combining Internet of Things (IoT) services, the method comprising:
[0006] Obtain basic information for each IoT service, and derive context constraint information based on the basic information;
[0007] Based on the context constraint information, at least two target IoT services are identified from a plurality of IoT services;
[0008] Based on the context constraint information, a combination strategy for the at least two target IoT services is determined;
[0009] Generate process information corresponding to the at least two target IoT services according to the combined strategy;
[0010] The at least two target IoT services are combined based on the process information.
[0011] The step of obtaining basic information for each IoT service and obtaining context constraint information based on the basic information includes:
[0012] Abstract the contextual constraints and service pragmatic concepts of each IoT service, and construct a contextual constraint model and a service pragmatic model for IoT services.
[0013] The context information is obtained based on the context constraint model;
[0014] Based on the formal definition of the service pragmatic model, the service capabilities that each IoT service can provide in an environment determined by specific contextual information are characterized.
[0015] The step of determining the combination strategy of the at least two target IoT services based on the context constraint information includes:
[0016] A Markov decision process is constructed based on the context constraint information, and the combined strategy is determined based on the Markov decision process.
[0017] The step of generating process information corresponding to the at least two target IoT services according to the combination strategy includes:
[0018] BPMN is used to build an abstract business process model for the Internet of Things. By defining transformation rules, the BPMN abstract business process model is transformed into a microservice abstract composite process.
[0019] Based on the combination strategy and the microservice abstract combination process, a business process instance is generated to obtain the process information corresponding to the at least two target IoT services.
[0020] The step of constructing a Markov decision process based on the context constraint information and determining the combined strategy based on the Markov decision process includes:
[0021] The tuples consisting of the sub-task nodes corresponding to the multiple IoT services are represented as state sets;
[0022] An action set is determined based on the aforementioned multiple IoT services;
[0023] Based on the contextual constraint information, the state set, the action set, and the preset instant reward function, a combination strategy for the at least two target IoT services is obtained using deep reinforcement learning techniques.
[0024] The step of using BPMN to construct an IoT abstract business process model, and converting the BPMN abstract business process model into a microservice abstract composite process by defining transformation rules, includes:
[0025] Define the model definition principles for using BPMN elements to build IoT abstract business process models;
[0026] Define a meta-model for IoT abstract business processes based on BPMN;
[0027] Using the BPMN IoT abstract business process model as the source model and the microservice abstract composite process model as the target model, we define the model matching rules from the BPMN abstract business process model to the microservice abstract composite process model.
[0028] Through model-driven technology, an automated microservice abstraction and composition process is generated based on the meta-model matching method.
[0029] The model definition principles for using BPMN elements to construct IoT abstract business process models include:
[0030] The BPMN pool element represents IoT services; the BPMN general task element represents service composition subtasks, each subtask being associated with an IoT service; the BPMN service task element represents the operation of an IoT service, i.e., the basic functional unit for completing service composition subtasks; and the BPMN message flow element represents the interaction relationship between IoT services.
[0031] The model matching rules for defining the BPMN abstract business process model to the microservice abstract composite process model include:
[0032] The process involves converting participants / pools with the name attribute set to "Composer" into microservice applications, where the name attribute is the name of the microservice application; converting participants / pools with the name attribute set to "IoT Service" into microservices invoked by the microservice applications, where the name attribute is the name of the microservice; converting message initiation events into microservice requests; converting message end events into microservice responses; converting tasks from the source model into microservice invocation methods from the target model; converting service tasks from the source model into microservice operations of the corresponding microservice invocation methods; converting the sequential structure of the source model into the sequential structure of the target model; converting the exclusive gateway structure of the source model into the if-else selection structure of the target model; and converting the parallel gateway structure of the source model into the multi-threaded structure of the target model.
[0033] The step of generating business process instances based on the combination strategy and the microservice abstraction combination process to obtain process information corresponding to the at least two target IoT services includes:
[0034] Based on the service composition strategy obtained by deep reinforcement learning technology and corresponding to the context constraint information, a service composition scheme configuration file is generated;
[0035] According to the service composition scheme configuration file, the microservice abstract service composition process is bound to the specific microservice operation to obtain the process information corresponding to the at least two target IoT services.
[0036] The service composition scheme configuration file includes:
[0037] Use XML-formatted configuration files to record service composition strategies. <scheme>The element identifies a service composition scheme configuration; used <task>The element identifies the service composition subtask; the id attribute represents the task number, and the name attribute represents the task name. <service>The element identifies the selected IoT service in the service composition subtask; the `name` attribute represents the name of the IoT service. <operation>The element identifies the operation name of the IoT service.
[0038] On the other hand, embodiments of the present invention provide a device for combining Internet of Things (IoT) services, comprising:
[0039] The acquisition module is used to acquire basic information for each IoT service and obtain context constraint information based on the basic information.
[0040] The determination module is configured to determine at least two target IoT services from multiple IoT services based on the context constraint information; and to determine a combination strategy for the at least two target IoT services based on the context constraint information.
[0041] A generation module is used to generate process information corresponding to the at least two target IoT services according to the combination strategy;
[0042] The combination module is used to combine the at least two target IoT services based on the process information.
[0043] The beneficial effects of the above-described technical solution of the present invention are as follows:
[0044] In the above scheme, basic information of each IoT service is obtained, and context constraint information is derived based on the basic information. At least two target IoT services are identified from multiple IoT services based on the context constraint information. A combination strategy for the at least two target IoT services is determined based on the context constraint information. Process information corresponding to the at least two target IoT services is generated based on the combination strategy. The at least two target IoT services are combined based on the process information. The context constraint relationship and service pragmatic concept of IoT services are abstracted using the above method to construct a context constraint model and a service pragmatic model for IoT services. The context-aware service composition problem is modeled as a Markov decision process, and deep reinforcement learning is used to learn the optimal service composition strategy. A BPMN abstract business process model for IoT is constructed, and automatic conversion from the BPMN abstract business process model to the microservice abstract composition process is achieved by defining transformation rules. Business process instances are derived based on adaptive service composition strategies to achieve context-aware service composition process generation. In this way, by combining deep reinforcement learning technology with model-driven technology, and using context-driven design of IoT service composition processes, learning of composition strategies, and derivation of process instances, the adaptability and reusability of IoT service composition are improved, and context-aware on-demand service composition is achieved. Attached Figure Description
[0045] Figure 1 A schematic flowchart of a method for combining Internet of Things services is provided as an example of the present invention;
[0046] Figure 2 A BPMN-based IoT abstract business process meta-model provided for an example of the present invention;
[0047] Figure 3 A schematic diagram illustrating the principle of a model-driven, context-aware IoT service composition method provided as an example of the present invention;
[0048] Figure 4 A business process diagram for a vehicle reservation case provided as an example of the present invention;
[0049] Figure 5 A BPMN abstract business process model for a vehicle reservation case provided as an example of the present invention;
[0050] Figure 6 This is a schematic diagram of a combined device for providing Internet of Things (IoT) services, as an example of the present invention. Detailed Implementation
[0051] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0052] This invention addresses the shortcomings of existing service composition technologies in terms of process reusability and service composition effectiveness by providing a model-driven, context-aware IoT service composition method and system. It offers a systematic approach to designing IoT service composition processes, learning composition strategies, and deriving process instances for achieving context-aware on-demand composition of IoT services.
[0053] The present invention will be further illustrated below with specific embodiments:
[0054] First Embodiment
[0055] like Figure 1 As shown, this embodiment provides a method for combining Internet of Things (IoT) services. The method includes: step S11, obtaining basic information of each IoT service, and obtaining context constraint information based on the basic information;
[0056] Step S12: Based on the context constraint information, determine at least two target IoT services from multiple IoT services;
[0057] Step S13: Determine the combination strategy of the at least two target IoT services based on the context constraint information;
[0058] Step S14: Generate process information corresponding to the at least two target IoT services according to the combination strategy;
[0059] Step S15: Combine the at least two target IoT services according to the process information.
[0060] The step of obtaining basic information for each IoT service and obtaining context constraint information based on the basic information includes:
[0061] Abstract the contextual constraints and service pragmatic concepts of each IoT service, and construct a contextual constraint model and a service pragmatic model for IoT services.
[0062] The context information is obtained based on the context constraint model;
[0063] Based on the formal definition of the service pragmatic model, the service capabilities that each IoT service can provide in an environment determined by specific contextual information are characterized.
[0064] The step of determining the combination strategy of the at least two target IoT services based on the context constraint information includes:
[0065] A Markov decision process is constructed based on the context constraint information, and the combined strategy is determined based on the Markov decision process.
[0066] The step of generating process information corresponding to the at least two target IoT services according to the combination strategy includes:
[0067] BPMN is used to build an abstract business process model for the Internet of Things. By defining transformation rules, the BPMN abstract business process model is transformed into a microservice abstract composite process.
[0068] Based on the combination strategy and the microservice abstract combination process, a business process instance is generated to obtain the process information corresponding to the at least two target IoT services.
[0069] The step of constructing a Markov decision process based on the context constraint information and determining the combined strategy based on the Markov decision process includes:
[0070] The tuples consisting of the sub-task nodes corresponding to the multiple IoT services are represented as state sets;
[0071] An action set is determined based on the aforementioned multiple IoT services;
[0072] Based on the contextual constraint information, the state set, the action set, and the preset instant reward function, a combination strategy for the at least two target IoT services is obtained using deep reinforcement learning techniques.
[0073] The step of using BPMN to construct an IoT abstract business process model, and converting the BPMN abstract business process model into a microservice abstract composite process by defining transformation rules, includes:
[0074] Define the model definition principles for using BPMN elements to build IoT abstract business process models;
[0075] Define a meta-model for IoT abstract business processes based on BPMN;
[0076] Using the BPMN IoT abstract business process model as the source model and the microservice abstract composite process model as the target model, we define the model matching rules from the BPMN abstract business process model to the microservice abstract composite process model.
[0077] Through model-driven technology, an automated microservice abstraction and composition process is generated based on the meta-model matching method.
[0078] The model definition principles for using BPMN elements to construct IoT abstract business process models include:
[0079] The BPMN pool element represents IoT services; the BPMN general task element represents service composition subtasks, each subtask being associated with an IoT service; the BPMN service task element represents the operation of an IoT service, i.e., the basic functional unit for completing service composition subtasks; and the BPMN message flow element represents the interaction relationship between IoT services.
[0080] The model matching rules for defining the BPMN abstract business process model to the microservice abstract composite process model include:
[0081] Convert participants / pools with the name attribute set to "Composer" into microservice applications, where the name attribute is the name of the microservice application; convert participants / pools with the name attribute set to "IoT Service" into microservices called by the microservice applications, where the name attribute is the name of the microservice; convert message initiation events into microservice requests; convert message end events into microservice responses; convert tasks in the source model into microservice call methods in the target model; convert service tasks in the source model into microservice operations of the corresponding microservice call methods; convert the sequential structure of the source model into the sequential structure of the target model; convert the exclusive gateway structure of the source model into the if-else selection structure of the target model; convert the parallel gateway structure of the source model into the multi-threaded structure of the target model.
[0082] The step of generating business process instances based on the combination strategy and the microservice abstraction combination process to obtain process information corresponding to the at least two target IoT services includes:
[0083] Based on the service composition strategy obtained by deep reinforcement learning technology and corresponding to the context constraint information, a service composition scheme configuration file is generated;
[0084] According to the service composition scheme configuration file, the microservice abstract service composition process is bound to the specific microservice operation to obtain the process information corresponding to the at least two target IoT services.
[0085] The service composition scheme configuration file includes:
[0086] Use XML-formatted configuration files to record service composition strategies. <scheme>The element identifies a service composition scheme configuration; used <task>The element identifies the service composition subtask; the id attribute represents the task number, and the name attribute represents the task name. <service>The element identifies the selected IoT service in the service composition subtask; the `name` attribute represents the name of the IoT service. <operation>The element identifies the operation name of the IoT service.
[0087] The scheme of combining the at least two target IoT services according to the process information is to enable the identified at least two target IoTs to execute the services they can provide in sequence according to the execution order determined by the process information.
[0088] The solution provided in Embodiment 1 of this invention obtains basic information of each IoT service and obtains context constraint information based on the basic information; determines at least two target IoT services from multiple IoT services based on the context constraint information; determines a combination strategy for the multiple at least two target IoT services based on the context constraint information; generates process information corresponding to the multiple at least two target IoT services based on the combination strategy; and combines the multiple at least two target IoT services based on the process information. Based on the above method, the context constraint relationship and service pragmatic concept of IoT services are abstracted to construct a context constraint model and a service pragmatic model for IoT services; the context-aware service composition problem is modeled as a Markov decision process, and deep reinforcement learning technology is used to learn the optimal service composition strategy; a BPMN abstract business process model is constructed, and automatic conversion from the BPMN abstract business process model to the microservice abstract composition process is achieved by defining transformation rules; business process instances are derived based on the adaptive service composition strategy to realize the generation of context-aware service composition processes. This approach combines deep reinforcement learning with model-driven techniques, using context-driven design of IoT service composition processes, learning of composition strategies, and derivation of process instances to improve the adaptability and reusability of IoT service composition, achieving context-aware on-demand service composition. The deep reinforcement learning technique used in this embodiment is a type of reinforcement learning that combines deep neural networks with reinforcement learning. This effectively addresses the problem of excessively large state spaces in the Markov decision-making process of service composition, giving the model-driven context-aware IoT service composition method described in this embodiment stronger generalization capabilities.
[0089] In summary, this invention abstracts the contextual constraints and service pragmatic concepts of IoT services to construct a contextual constraint model and a service pragmatic model for IoT services; it models the context-aware service composition problem as a Markov decision process and uses deep reinforcement learning to learn the optimal service composition strategy; it uses BPMN to construct an abstract business process model for IoT, and by defining transformation rules, it achieves automatic conversion from the BPMN abstract business process model to the microservice abstract composition process; and it derives business process instances based on adaptive service composition strategies to achieve context-aware service composition process generation.
[0090] To better understand the model-driven context-aware IoT service composition method described in the embodiments of the present invention, it will be explained in detail, specifically including the following steps:
[0091] Step 1, Construction of Context Constraint Model and Service Pragmatic Model: Abstracting the context constraint relationships and service pragmatic concepts of IoT services, and constructing the context constraint model and service pragmatic model of IoT services, which may include the following steps:
[0092] A1, Formal definition of the context constraint model for IoT services (i.e., context constraint information includes spatial constraints, temporal constraints, security constraints, resource consumption constraints, response time constraints, and cost constraints).
[0093] In this embodiment, the spatial constraints, temporal constraints, security constraints, resource consumption constraints, response time constraints, and cost constraints of the Internet of Things (IoT) service are defined as follows:
[0094] 1. Spatial Constraint (SPC): The spatial constraint of a service is represented using location coordinates (x, y) and a radius d. The spatial range constraint of a service ms is represented as follows:
[0095] SPC(ms)=(x ms ,y ms ,d)
[0096] If the location context of the requested rq is (x rq ,y rq In this embodiment, Euclidean distance is used to calculate the distance between the request and the service:
[0097]
[0098] If the distance between a request and a service exceeds their respective ranges, the request and service are spatially unrelated; if the distance is within their respective ranges, the ratio of distance to range is used to measure their spatial relevance. The spatial relevance (SPR) of a request and a service is defined as follows:
[0099]
[0100] 2. Temporal Constraint (TMC): Time constraints are defined using time intervals (st, et), where st represents the start time and et represents the end time. Request time constraints and service availability time constraints are represented as follows:
[0101] TMC(rq)=(st rq ,et rq )
[0102] TMC(ms)=(st ms ,et ms )
[0103] If the service request time and service availability time do not overlap, then the request and service are time-independent. If the service request time and service availability time overlap, the time relevance of the request and service is measured by the proportion of the overlapping time to the total request time. The time relevance (TMR) of requests and services is defined as follows:
[0104]
[0105] 3. Security Constraint (SEC): Using sl to represent the security level, the requested security constraint is expressed as SEC(rq)≥sl. rq The security level of a service is represented as SEC(ms) = sl ms If the security level of the service is lower than the minimum security requirement of the request, then the service and the request are not security-related; if the security level of the service is equal to or higher than the security level of the request, then the two are security-related. Let the security level of the service be sl∈[low,high], where low and high are the lower and upper limits of the security level, respectively. Then the security relevancy (SER) between the request and the service is defined as:
[0106]
[0107] The spatial, temporal, and security constraints of a service will have different effects on different service requests. The spatial, temporal, and security correlation between a service and a request changes dynamically depending on the service request. The higher the correlation, the stronger the service provision capability under the current context constraints, and the better it fits the service requirements.
[0108] 4. Energy Consumption Constraint (ECC): Represents the resources consumed by the service.
[0109] 5. Response Time Constraint (RTC): Represents the time from sending a request to receiving a response.
[0110] 6. Cost Constraint (CSC): Represents the cost required to call a service.
[0111] Resource consumption, response time, and cost are cost-based constraints; the smaller the value, the stronger the service provision capability. To unify the impact of different types of constraints on service provision capability, the following utility function is used to normalize resource consumption, execution time, and cost. Taking resource consumption as an example (response time and cost are similarly defined), it is defined as:
[0112]
[0113] Where represents the maximum resource consumption of the service, min{ecc} represents the minimum resource consumption, and ecc{ms} represents the resource consumption of the service in milliseconds.
[0114] A2, a formal definition of the IoT service pragmatic model, describes the service provision capability in a specific context.
[0115] In this embodiment, the pragmatic model of the Internet of Things service is defined as follows:
[0116] Pragmatics of Service (POS): Given a service request rq, and a service ms with context constraints SC(ms) = {SPR, TMR, SER, ECC, RTC, CSC}, the pragmatic value of the service POS(ms|rq, SC) is defined as follows:
[0117]
[0118] If the demand and service are spatially, temporally, and securityally unrelated, the service is unavailable, and its pragmatic value is -1; otherwise, the pragmatic value of the service is calculated by weighted summation of the constraints, where w i Let ∑w represent the relevance weights of the i-th context constraint to the domain. i =1 and 0≤w i ≤1. By assigning different weights, it can be adapted to different application domains. The larger the weight, the higher the relevance to the domain; the larger the pragmatic value, the stronger the service provision capability.
[0119] Step 2, Service Composition Strategy Learning: The context-aware service composition problem is modeled as a Markov decision process, and deep reinforcement learning techniques are used to learn the optimal service composition strategy. This may include the following steps:
[0120] B1 models the context-aware service composition problem as a Markov decision process, uses tuples of all subtask nodes of the service composition as the state set, uses candidate IoT services to represent the action set, and uses the pragmatic value of the service to represent the immediate reward function.
[0121] In this embodiment, the service composition task is decomposed into several sub-tasks, each of which can be completed by at least one candidate IoT service. Candidate services for the same sub-task have the same or similar functions but may have different service contexts.
[0122] B2 learns context-aware service composition strategies by maximizing the service pragmatic capabilities in the current context using deep reinforcement learning techniques.
[0123] Step 3, Abstract Composition Process Generation: A BPMN abstract business process model is constructed. By defining transformation rules, the BPMN abstract business process model is automatically transformed into a microservice abstract composition process. This can include the following steps:
[0124] C1 defines the model definition principles for using BPMN elements to build IoT abstract business process models.
[0125] In this embodiment, the model definition principles for constructing the IoT abstract business process model using BPMN elements are as follows:
[0126] Principle 1: Use BPMN pool elements to represent IoT services.
[0127] Principle 2: Use the generic task elements of BPMN to represent service composition subtasks, with each subtask associated with an IoT service.
[0128] Principle 3: Use BPMN service task elements to represent the operation of IoT services, that is, the basic functional units for completing service composition subtasks.
[0129] Principle 4: Use BPMN message flow elements to represent the interaction relationships between IoT services.
[0130] C2 defines a meta-model for IoT abstract business processes based on BPMN.
[0131] In this embodiment, the IoT abstract business process meta-model based on BPMN is as follows: Figure 2 As shown, the elements and the relationships between them are defined as follows:
[0132] 1. Business Process: The main body described by the metamodel, identifying an IoT abstract business process model, consisting of one or more processes and one collaboration relationship.
[0133] 2. Collaboration: Defines the interaction relationships between participants in a business process. Message exchanges between participants are represented using message flow elements. These elements are uniquely identified by an identifier attribute and consist of one or more participants and zero or more message flows.
[0134] 3. Participant / Pool: Represents the participants in the business process collaboration, i.e., IoT services. To distinguish the different roles of participants, the name attribute is set to either "Composer" or "IoT Service". Participants with the value "Composer" represent composite IoT services (i.e., IoT service combination processes, composite services composed of multiple IoT services), while participants with the value "IoT Service" represent IoT services. Additionally, six optional attributes have been added to the participant element: application, operation, method, path, request, and response. These attributes can be manually configured or automatically bound to existing IoT services via a service registry. This element is associated with one process; the identifier of the associated process is identified through the process object attribute, and the associated process defines the task execution process of this participant.
[0135] 4. Message Streams: Used to enable message interaction between IoT services. The source object attribute identifies the source of the message stream, and the target object attribute identifies the target of the message stream. Message streams are used in pairs to represent message sending and receiving during IoT service invocation.
[0136] 5. Process: Defines the task execution process of the IoT service, using an identifier attribute to uniquely identify the process. It has 0 or 1 message start events, 0 or 1 message end events, 0 or more tasks, 0 or 1 service task, 0 or more gateways, 0 or more sequence flows, and is associated with 0 or more message flows. Tasks and service tasks cannot appear simultaneously in a single process.
[0137] 6. Task: Represents a subtask (atomic task) of the IoT service composition, which is implemented by a specific service task.
[0138] 7. Service Task: Represents the basic functional unit for implementing service composition sub-tasks, i.e., the operation of an IoT service. This IoT service operation needs to be configured according to the generated service composition strategy and is bound to existing IoT service operations through the service registry.
[0139] 8. Sequential Flow: Represents the execution order between nodes within a process. The source object attribute identifies the source of the sequential flow, and the target object attribute identifies the target of the sequential flow.
[0140] 9. Gateway: In control flow, gateways facilitate the divergence and convergence of sequential flows. Depending on the control logic, gateways are classified as parallel gateways and exclusive gateways.
[0141] 10. Message Start Event: Indicates the start of the process. The message start event only outputs a sequential stream.
[0142] 11. End-of-Message Event: Indicates the end of the process. The end-of-message event only occurs with sequential input streams.
[0143] C3 uses the BPMN IoT abstract business process model as the source model and the microservice abstract composite process model as the target model to define the model matching rules from the BPMN abstract business process model to the microservice abstract composite process model.
[0144] In this embodiment, the model matching rules are defined as follows:
[0145] Rule 1: Participants / pools with the name attribute value of "Composer" are converted into microservice applications, and the name attribute is the name of the microservice application; participants / pools with the name attribute value of "IoT Service" are converted into microservices called by the microservice application, and the name attribute is the name of the microservice.
[0146] Rule 2: Message initiation events are converted into microservice requests.
[0147] Rule 3: The message end event is converted into a microservice response.
[0148] Rule 4: The task of the source model is converted into the microservice call method of the target model.
[0149] Rule 5: The service tasks of the source model are converted into microservice operations that call the corresponding microservice methods.
[0150] Rule 6: Convert the sequential structure of the source model to the sequential structure of the target model.
[0151] Rule 7: The exclusive gateway structure of the source model is converted into the if-else selection structure of the target model.
[0152] Rule 8: The parallel gateway structure of the source model is converted into the multi-threaded structure of the target model.
[0153] C4, through model-driven technology, uses a meta-model matching method to automate the generation of microservice composition processes.
[0154] Step 4, Service Solution Configuration and Process Instance Derivation: Based on the adaptive service composition strategy, business process instances are derived to achieve context-aware service composition process generation. This may include the following steps:
[0155] D1 generates a service composition scheme configuration file based on the context-aware service composition strategy obtained from deep reinforcement learning techniques.
[0156] In this embodiment, the service composition scheme configuration file is defined as follows:
[0157] Use XML-formatted configuration files to record service composition strategies. <scheme>The element identifies a service composition scheme configuration; used <task>The element identifies the service composition subtask; the id attribute represents the task number, and the name attribute represents the task name. <service>The element identifies the selected IoT service in the service composition subtask; the `name` attribute represents the name of the IoT service. <operation>The element identifies the operation name of the IoT service.
[0158] D2 binds the abstract service composition process to specific microservice operations based on the service composition scheme configuration file, and derives an executable composition process instance.
[0159] The following is combined Figure 3 , Figure 4 and Figure 5 Taking the demand for vehicle reservations in the context of smart elderly care as an example, this embodiment provides a detailed explanation of the model-driven context-aware IoT service composition method.
[0160] Travel is a basic life need for the elderly, and the continuous improvement of social informatization and intelligence has created conditions for realizing intelligent travel for the elderly. Figure 4 The elderly person's need for transportation (denoted as T) includes 5 sub-tasks: one-click ride-hailing service (t1), vehicle reservation service (t2), weather service (t3), smart umbrella service (t4), and vehicle transportation service (t5), i.e., T =<t1,t2,t3,t4,t5> Given a specific user request rq, the location coordinates of the request are (116.30, 39.95), the request time is 11:00-11:30 AM, the service security level requirement is 3, and the resource overhead, execution time, and cost should be as low as possible.
[0161] Assume each subtask has three candidate services. First, construct a service pragmatic model for each service based on its context. Taking vehicle delivery task t5 as an example, its candidate services... There is a service operation " / car / passengerTransport" that provides passenger transport functionality. The service's location coordinates are (116.30, 39.92), and its service range is 5km. The time constraints are 9:00-12:00, the security level is 4 ([0,5]), the resource overhead is 25 ([0,50]), the response time is 106 ([0,300]), and the cost is 30 ([0,200]). The context-dependent constraints of this service are as follows:
[0162] (1) Spatial correlation:
[0163] (2) Time correlation:
[0164] (3) Safety relevance:
[0165] (4) Resource overhead constraints:
[0166] (5) Response time constraint:
[0167] (6) Cost constraints:
[0168] Based on service context constraints Taking a weight of <0.3, 0.3, 0.1, 0.1, 0.1, 0.1> as an example, calculate the service pragmatics under this user's demand:
[0169]
[0170] Similarly, the pragmatics of all candidate services can be obtained, as shown in Table 1.
[0171] Subtask Candidate Service 1 Candidate Service 2 Candidate Service 3 <![CDATA[t1]]> -1 0.80 0.35 <![CDATA[t2]]> 0.57 0.64 0.75 <![CDATA[t3]]> 0.86 -1 0.23 <![CDATA[t4]]> 0.45 0.66 0.90 <![CDATA[t5]]> 0.65 -1 -1
[0172] Table 1
[0173] Then, the service composition task is modeled as a context-aware Markov decision process, and deep reinforcement learning is used to solve for the optimal service composition scheme, i.e., the service composition scheme that maximizes service pragmatics. The optimal service composition scheme is:
[0174] Next, based on the model definition principles of IoT abstract business processes, BPMN is used to model the combined needs of elderly people's outing transportation services, with each subtask represented by a service task element. The BPMN-based IoT abstract business process model is as follows: Figure 5 As shown. Based on the model matching rules, the BPMN-based IoT abstract business process model is converted into a microservice abstract composition process model. This model is not yet bound to a specific IoT service. The results are as follows:
[0175] @GetMapping(" / elderly-care / carReservation / {userID}")
[0176] public String carReservation(@PathVariable String userID,@RequestParam String cfID){
[0177] vxRestTemplate.exchange(t1,HttpMethod.${method},${requestEntity}, ${responseType},${parameters},cfID);
[0178] vxRestTemplate.exchange(t2,HttpMethod.${method},${requestEntity}, ${responseType},${parameters},cfID);
[0179] vxRestTemplate.exchange(t3,HttpMethod.${method},${requestEntity}, ${responseType},${parameters},cfID);
[0180] vxRestTemplate.exchange(t4,HttpMethod.${method},${requestEntity}, ${responseType},${parameters},cfID);
[0181] vxRestTemplate.exchange(t5,HttpMethod.${method},${requestEntity}, ${responseType},${parameters},cfID);
[0182] return result;
[0183] }
[0184] This process only contains the main business logic framework code; the process designer needs to further supplement the business details, namely:
[0185] @GetMapping(" / elderly-care / carReservation / {userID}")
[0186] public String carReservation(@PathVariable String userID,@RequestParam String cfID){
[0187] VxRestTemplate vxRestTemplate=new VxRestTemplate();
[0188] Map<String,String> map=vxRestTemplate.exchange(t1, HttpMethod.${method},null,HashMap.class,userID,cfID);
[0189] String carID=vxRestTemplate.exchange(t2,HttpMethod.${method},null,map,cfID);
[0190] String weather=vxRestTemplate.exchange(t3,HttpMethod.${method},null,String.class,null,cfID);
[0191] String umbrellaServiceResult=vxRestTemplate.exchange(t4, HttpMethod.${method},null,String.class,weather,cfID);
[0192] String carTransportResult=vxRestTemplate.exchange(t5, HttpMethod.${method},null,String.class,carID,cfID);
[0193] return carTransportResult;
[0194] }
[0195] Finally, based on the learned optimal service composition scheme, a service composition scheme configuration is generated, as shown in the configuration file below:
[0196]
[0197]
[0198] Based on the service composition scheme configuration file, the system retrieves the OpenAPI specification of the corresponding IoT service from the registry center. Then, based on the service's operation name, it obtains the corresponding address, request method, parameters, and other detailed information. By binding these specific parameters of microservices to the microservice abstract composition process, an executable service composition process instance can be derived.
[0199] Second Embodiment
[0200] This invention also provides a specific implementation of a model-driven context-aware IoT service composition system. Since the model-driven context-aware IoT service composition system provided by this invention corresponds to the specific implementation of the aforementioned model-driven context-aware IoT service composition method, the model-driven context-aware IoT service composition system can achieve the purpose of this invention by executing the process steps in the above-mentioned method specific implementation. Therefore, the explanations in the above-mentioned specific implementation of the model-driven context-aware IoT service composition method are also applicable to the specific implementation of the model-driven context-aware IoT service composition system provided by this invention, and will not be repeated in the following specific implementations of this invention.
[0201] like Figure 6 As shown, embodiments of the present invention also provide a device for combining Internet of Things (IoT) services, comprising:
[0202] The acquisition module 61 is used to acquire basic information of each IoT service and obtain context constraint information based on the basic information;
[0203] The determining module 62 is configured to determine at least two target IoT services from multiple IoT services based on the context constraint information; and to determine a combination strategy for the at least two target IoT services based on the context constraint information.
[0204] Generation module 63 is used to generate process information corresponding to the at least two target IoT services according to the combination strategy;
[0205] The combination module 64 is used to combine the at least two target IoT services according to the process information.
[0206] The acquisition module 61 is specifically used to abstract the context constraint relationship and service pragmatic concept of each IoT service, construct the context constraint model and service pragmatic model of the IoT service; obtain the context information according to the context constraint model; and characterize the service capabilities that each IoT service can provide in the environment determined by the specific context information according to the formal definition of the service pragmatic model.
[0207] The determination module 62 is specifically used to construct a Markov decision process based on the context constraint information, and determine the combined strategy based on the Markov decision process.
[0208] The step of constructing a Markov decision process based on the context constraint information and determining the combined strategy based on the Markov decision process includes:
[0209] The tuples consisting of the sub-task nodes corresponding to the multiple IoT services are represented as state sets;
[0210] An action set is determined based on the aforementioned multiple IoT services;
[0211] Based on the contextual constraint information, the state set, the action set, and the preset instant reward function, a combination strategy for the at least two target IoT services is obtained using deep reinforcement learning techniques.
[0212] The generation module 63 is specifically used to construct an IoT abstract business process model using BPMN, and to convert the BPMN abstract business process model into a microservice abstract composite process by defining transformation rules; and to generate business process instances according to the combination strategy and the microservice abstract composite process to obtain the process information corresponding to the at least two target IoT services.
[0213] The step of using BPMN to construct an IoT abstract business process model, and converting the BPMN abstract business process model into a microservice abstract composite process by defining transformation rules, includes:
[0214] Define the model definition principles for using BPMN elements to build IoT abstract business process models;
[0215] Define a meta-model for IoT abstract business processes based on BPMN;
[0216] Using the BPMN IoT abstract business process model as the source model and the microservice abstract composite process model as the target model, we define the model matching rules from the BPMN abstract business process model to the microservice abstract composite process model.
[0217] Through model-driven technology, an automated microservice abstraction and composition process is generated based on the meta-model matching method.
[0218] The model definition principles for using BPMN elements to construct IoT abstract business process models include:
[0219] The BPMN pool element represents IoT services; the BPMN general task element represents service composition subtasks, each subtask being associated with an IoT service; the BPMN service task element represents the operation of an IoT service, i.e., the basic functional unit for completing service composition subtasks; and the BPMN message flow element represents the interaction relationship between IoT services.
[0220] The model matching rules for defining the BPMN abstract business process model to the microservice abstract composite process model include:
[0221] Convert participants / pools with the name attribute set to "Composer" into microservice applications, where the name attribute is the name of the microservice application; convert participants / pools with the name attribute set to "IoT Service" into microservices called by the microservice applications, where the name attribute is the name of the microservice; convert message initiation events into microservice requests; convert message end events into microservice responses; convert tasks in the source model into microservice call methods in the target model; convert service tasks in the source model into microservice operations of the corresponding microservice call methods; convert the sequential structure of the source model into the sequential structure of the target model; convert the exclusive gateway structure of the source model into the if-else selection structure of the target model; convert the parallel gateway structure of the source model into the multi-threaded structure of the target model.
[0222] The step of generating business process instances based on the combination strategy and the microservice abstraction combination process to obtain process information corresponding to the at least two target IoT services includes:
[0223] Based on the service composition strategy obtained by deep reinforcement learning technology and corresponding to the context constraint information, a service composition scheme configuration file is generated;
[0224] According to the service composition scheme configuration file, the microservice abstract service composition process is bound to the specific microservice operation to obtain the process information corresponding to the at least two target IoT services.
[0225] The service composition scheme configuration file includes:
[0226] Use XML-formatted configuration files to record service composition strategies. <scheme>The element identifies a service composition scheme configuration; used <task>The element identifies the service composition subtask; the id attribute represents the task number, and the name attribute represents the task name. <service>The element identifies the selected IoT service in the service composition subtask; the `name` attribute represents the name of the IoT service. <operation>The element identifies the operation name of the IoT service.
[0227] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0228] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.< / operation> < / service> < / task> < / scheme> < / operation> < / service> < / task> < / scheme> < / operation> < / service> < / task> < / scheme> < / operation> < / service> < / task> < / scheme>
Claims
1. A combination method of Internet of Things services, characterized in that, The method comprises the following steps: obtaining basic information of each Internet of Things service, and obtaining context constraint information according to the basic information, comprising: abstracting the context constraint relationship and service pragmatic concept of each Internet of Things service, constructing a context constraint model and a service pragmatic model of the Internet of Things service; obtaining the context constraint information according to the context constraint model; and describing the service capability provided by each Internet of Things service under a specific context constraint information determined environment according to the formal definition of the service pragmatic model; determining at least two target Internet of Things services from a plurality of Internet of Things services according to the context constraint information; determining a combination strategy of the at least two target Internet of Things services according to the context constraint information, comprising: constructing a Markov decision process according to the context constraint information, and determining the combination strategy based on the Markov decision process; representing a tuple formed by subtask nodes corresponding to the plurality of Internet of Things services as a state set; determining an action set based on the plurality of Internet of Things services; and obtaining the combination strategy of the at least two target Internet of Things services by using a deep reinforcement learning technology according to the context constraint information, the state set, the action set, and a preset immediate reward function; generating flow information corresponding to the at least two target Internet of Things services according to the combination strategy, comprising: constructing an Internet of Things abstract business process model using BPMN, and converting the BPMN abstract business process model into a micro-service abstract combination process by defining a conversion rule; wherein, the model definition principle of constructing the Internet of Things abstract business process model using the BPMN element is defined; the BPMN-based Internet of Things abstract business process metamodel is defined; the model matching rule of the BPMN abstract business process model to the micro-service abstract combination process model is defined, taking the BPMN Internet of Things abstract business process model as the source model and the micro-service abstract combination process model as the target model; and the automatic generation of the micro-service abstract combination process is realized based on the metamodel matching method through the model-driven technology; generating a business process instance according to the combination strategy and the micro-service abstract combination process to obtain the flow information corresponding to the at least two target Internet of Things services; combining the at least two target Internet of Things services according to the flow information.
2. The method of claim 1, wherein, The model definition principle of constructing the Internet of Things abstract business process model using the BPMN element comprises: using the pool element of the BPMN to represent the Internet of Things service; using the general task element of the BPMN to represent the service combination subtask, each subtask being associated with an Internet of Things service; using the service task element of the BPMN to represent the operation of the Internet of Things service, i.e. the basic functional unit for completing the service combination subtask; and using the message flow element of the BPMN to represent the interaction relationship between the Internet of Things services.
3. The method of claim 1, wherein, The model matching rule of the BPMN abstract business process model to the micro-service abstract combination process model comprises: The participant / pool with the name attribute taking the value of "Composer" is converted into a microservice application, the name attribute is the name of the microservice application; the participant / pool with the name attribute taking the value of "IoT Service" is converted into a microservice called by the microservice application, the name attribute is the name of the microservice; the message start event is converted into a request of the microservice; the message end event is converted into a response of the microservice; the task of the source model is converted into a microservice calling method of the target model; the service task of the source model is converted into a microservice operation of the corresponding microservice calling method; the sequential structure of the source model is converted into the sequential structure of the target model; the exclusive gateway structure of the source model is converted into the if-else selection structure of the target model; and the parallel gateway structure of the source model is converted into the multi-threaded structure of the target model.
4. The method of claim 1, wherein, The business process instance is generated according to the combination strategy and the microservice abstract combination process, and flow information corresponding to the at least two target Internet of Things services is obtained. According to the service combination strategy corresponding to the context constraint information obtained by the deep reinforcement learning technology, a service combination scheme configuration file is generated. According to the service combination scheme configuration file, a microservice abstract service combination process is bound with specific microservice operations, and flow information corresponding to the at least two target Internet of Things services is obtained.
5. A combination apparatus of an Internet of Things service for implementing the method of any one of claims 1-4, characterized by The method comprises the following steps: An acquisition module is configured to acquire basic information of each Internet of Things service, and obtain context constraint information according to the basic information; A determination module is configured to determine at least two target Internet of Things services from a plurality of Internet of Things services according to the context constraint information; According to the context constraint information, a combination strategy of the at least two target Internet of Things services is determined; A generation module is configured to generate flow information corresponding to the at least two target Internet of Things services according to the combination strategy; A combination module is configured to combine the at least two target Internet of Things services according to the flow information.
Citation Information
Patent Citations
Context-constraint-based target identification method
CN103049763A
Internet-of-things service combination system
CN105516260A