A rule processing method and device, and electronic equipment
By creating a second rule input in an IoT system to obtain and use all input parameters of the same atomic set, the problem of inconsistency in rule input between devices is solved, and the accuracy and consistency of rules are improved.
Patent Information
- Application Number
- CN202080088876.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-20
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2040-03-20
AI Technical Summary
In the Internet of Things system, it is not guaranteed that the input of rules from each device can be consistently perceived by the device where the rules are located, affecting the accurate triggering of the rules.
By creating a second rule input on a first device or cloud platform, it is ensured that the values of all input parameters belonging to the same atomic set in the second rule input are obtained and used to determine the result of the rule expression and determine whether to execute the rule based on the result. Behavior.
It solves the problem of inconsistent rule input, reduces the rate of rule error triggering, and improves the accuracy and consistency of rule execution.
Smart Images

Figure CN114846415B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a rule processing method and device, and an electronic device. Background Art
[0002] In the IoT system architecture, there is a scenario of device linkage, such as turning on the air conditioner when the indoor temperature reaches 30 degrees. Here, "indoor temperature (temp)" is a rule input, and "temp>=30" is a rule expression. When the temperature changes, the rule engine will determine whether "temp>=30" is true. If the judgment result is true, it will execute "turn on the air conditioner". The above is a brief introduction to the use of rules in the IoT system.
[0003] In the current IoT technology architecture, there is a problem that it is impossible to ensure that the rule inputs from various devices can be consistently perceived by the devices where the rules are located, thus affecting the accurate triggering of the rules. Summary of the invention
[0004] The embodiments of the present application provide a rule processing method and apparatus, and an electronic device, so as to at least solve the problem in the related art that it is impossible to ensure that the rule inputs from various devices can be consistently perceived by the device where the rule is located.
[0005] On the one hand, an embodiment of the present application provides a rule processing method, the method comprising:
[0006] The first device creates a first rule, the first rule comprising a first rule input, a rule expression, and a rule behavior; wherein the first rule input is used by the first device or the cloud platform to create a second rule input;
[0007] The first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, determines the result of the rule expression based on the values of all input parameters, and determines whether to execute the rule behavior based on the result of the expression.
[0008] On the other hand, an embodiment of the present application provides a rule processing method, the method comprising:
[0009] The cloud platform receives a creation request message sent by the first device, and creates a second rule input based on the creation request message, wherein the second rule input includes all input parameters of the first rule input, wherein the first rule input belongs to a first rule created by the first device, and the first rule further includes a rule expression and a rule behavior;
[0010] The cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, and sends the values of all input parameters belonging to the same atomic set in the second rule input to the first device;
[0011] The values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression, and determine whether to execute the rule behavior based on the result of the expression.
[0012] On the other hand, an embodiment of the present application provides a rule processing device, applied to a first device, the device comprising:
[0013] A first creation unit, configured to create a first rule, wherein the first rule includes a first rule input, a rule expression, and a rule behavior; wherein the first rule input is used by the device or the cloud platform to create a second rule input;
[0014] An acquisition unit, used for acquiring values of all input parameters belonging to the same atom set in the second rule input;
[0015] A determination unit is used to determine a result of the rule expression based on the values of all the input parameters, and determine whether to execute the rule behavior based on the result of the expression.
[0016] On the other hand, an embodiment of the present application provides a rule processing device, which is applied to a cloud platform, and the device includes:
[0017] a creating unit, configured to receive a creating request message sent by the first device, and create a second rule input based on the creating request message, wherein the second rule input includes all input parameters of the first rule input, wherein the first rule input belongs to a first rule created by the first device, and the first rule further includes a rule expression and a rule behavior;
[0018] An acquisition unit, used for acquiring values of all input parameters belonging to the same atom set in the second rule input;
[0019] a sending unit, configured to send values of all input parameters belonging to the same atomic set in the second rule input to the first device;
[0020] The values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression, and determine whether to execute the rule behavior based on the result of the expression.
[0021] In another aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the above rule processing method.
[0022] On the other hand, an embodiment of the present application provides a chip for implementing the above rule processing method.
[0023] Specifically, the chip includes: a processor, which is used to call and run a computer program from a memory, so that a device equipped with the chip executes the above rule processing method.
[0024] On the other hand, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, which enables a computer to execute the above-mentioned rule processing method.
[0025] On the other hand, an embodiment of the present application provides a computer program product, including computer program instructions, which enable a computer to execute the above-mentioned rule processing method.
[0026] On the other hand, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above rule processing method.
[0027] In the technical solution of the embodiment of the present application, a second rule input is created based on the first rule input, and the value of the input parameter used to determine the result of the rule expression comes from the values of all input parameters belonging to the same atomic set in the acquired second rule input. For the same atomic set in the second rule input, each read or write operation must include the values of all corresponding input parameters. Therefore, the problem in the related art that it is impossible to ensure that the rule inputs from each device can be consistently perceived by the device where the rule is located can be solved, thereby achieving the effect of reducing the false triggering rate of the rule and improving the accuracy of rule execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0029] Figure 1 This is an optional communication architecture diagram provided in an embodiment of the present application;
[0030] Figure 2 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0031] Figure 3 It is a flowchart of the rule processing method provided in the embodiment of the present application;
[0032] Figure 4 is a schematic diagram of the architecture of the first rule provided in an embodiment of the present application;
[0033] Figure 5 This is a flowchart of Example 1 provided in an embodiment of the present application;
[0034] Figure 6 This is a flowchart of Example 2 provided in an embodiment of the present application;
[0035] Figure 7 This is a schematic diagram of the structure of the rule processing device provided in the embodiment of the present application. Figure 1 ;
[0036] Figure 8 This is a schematic diagram of the structure of the rule processing device provided in the embodiment of the present application. Figure 2 ;
[0037] Fig. 9 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0038] Fig.10 It is a schematic structural diagram of the chip of an embodiment of the present application. DETAILED DESCRIPTION
[0039] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0041] To facilitate understanding of the technical solutions of the embodiments of the present application, the relevant technologies involved in the embodiments of the present application are described below.
[0042] Communication architecture
[0043] The Open Connectivity Foundation (OCF) defines clients and servers. Servers refer to devices that provide resources, and clients refer to devices that access resources.
[0044] OCF adopts the Representational State Transfer (RESTful) architecture, which uses resources to represent IoT physical devices, as well as the functional services provided by the devices and the status of the devices. The device that provides resources is the server, and the device that accesses resources is the client. The client and server defined in OCF are logical functional entities. A device can be a client, a server, or both a client and a server.
[0045] The business interaction between the client and the server is achieved by performing RESTful operations on resources. RESTful operations can be Create-Retrieve-Update-Delete-Notify (CRUDN) operations. Obviously, CRUDN operations can be any one or more of the following operations: Create, Retrieve, Update, Delete, Notify. The client is the initiator of the RESTful operation, and the server is the responder of the RESTful operation. The client sends a resource operation request to the server, requesting to operate the resources on the server. The server performs the resource operation and returns a response to the client, which carries the content and description information of the resource.
[0046] Figure 1 This is an optional communication architecture diagram provided by the embodiment of the present application. The description of resources is the resource model layer. Each resource corresponds to a specific Uniform Resource Identifier (URI). The resource can be accessed by accessing the URI of the resource. In addition, each resource has a corresponding interface that supports RESTful operations. The transmission protocol layer transmits resource content and description information. By mapping resource operations to specific transmission protocols, the RESTful operations of each resource are converted into physical messages transmitted between devices, providing a means for interconnection between devices.
[0047] OCF's transport protocol uses the Constrained Application Protocol (CoAP) to carry resource operations. Each CRUDN operation is mapped to a CoAP request message or response message. The client can operate the server's resources through the three methods of GET, POST, and DELETE in CoAP, thereby realizing the conversion of resource status.
[0048] resource
[0049] ◆Uniform Resource Identifier (URI) of the resource
[0050] Resources are identified and addressed through URIs. The URIs of resources specified by OCF are expressed as follows: ocf: / / <deviceid> / <path> ? <query>, where the meanings of the various parts of the URI are as follows:
[0051] ocf: The organization (schema) of the resource URI is "ocf". If a URI omits the part before the double slash " / / ", the default schema is "ocf".
[0052] deviceID: The device ID of the server. The device ID is the globally unique identifier of the device.
[0053] path: A path string for accessing a resource. Path is globally unique within the scope of the server to which the resource belongs, and can uniquely correspond to a resource on the server.
[0054] query: query string, the query string contains " <name> = <value>" segment, that is, a list of "name-value pairs", each of which is separated by an "&". In OCF, the query string will be mapped to CoAP, using the syntax description corresponding to CoAP.
[0055] The URI of a resource can be an absolute URI or a relative URI. The absolute URI is the complete URI form mentioned above. The relative URI does not include the schema and deviceID parts. The relative URI is relative to the device to which it belongs and uniquely identifies the resource within the scope of the device. The relative URI combined with the deviceID can form an absolute URI.
[0056] Resource Model
[0057] The resource model is the core of realizing interoperability between devices. The transport layer provides interoperability of the transport protocol. The resource model is independent of the transport protocol. By mapping the resource model to the transport protocol, it provides technical support for complete interoperability between devices.
[0058] The characteristics of resources mainly include URI, attributes, resource references and interfaces, which are described below:
[0059] -URI: Each resource is identified and addressed by a URI.
[0060] -Property: Each resource contains properties, which are used to describe the state information of the resource. Properties are represented by " <key> = <value>" appears in the form of a key-value pair. The resource representation is a snapshot of the attributes. Interaction with resources is achieved by exchanging requests and responses containing resource representations. For example, a read request to a resource can obtain the resource representation through the response, and an update request to a resource can update the resource representation.
[0061] parameter meaning anchor The upper and lower URIs, indicating the URI of the resource that contains the Link. href Target URI, that is, the URI of the target resource referenced by the Link rel The relationship between the referenced resource URI and the context URI rt Resource type identifier of the target resource eps Message endpoints that can access the target resource
[0062] Table 1
[0063] -Interface: Interface is a mechanism for representing and acquiring resources. Different interfaces correspond to different representations of resources and corresponding operation mechanisms.
[0064] Resources reside in the device. A resource must have a URI, which can be specified by the resource creator when creating the resource. In addition, a resource must have one or more resource types, and the resource type corresponding to the resource must be specified in the request to create the resource.
[0065] Figure 2 is a schematic diagram of an application scenario provided by an embodiment of the present application, such as Figure 2 As shown, the server includes the following three resources:
[0066] Input resources: Input resources are resources referenced by rule resources through links.
[0067] Rule resources: Rule resources can also be called rule engines. When input resources change, the rule engine determines whether the rule expression is valid based on the set rule logic. If the judgment result is true, it will issue instructions to the corresponding action resources to instruct the action resources to perform the corresponding actions.
[0068] Action resources: Action resources are resources that need to perform actions based on rule resources.
[0069] like Figure 2 As shown in FIG. 1 , the client can directly initiate a CRUDN operation on the server containing the rule resources to create, update, and other operations on the input resources, rule resources, or action resources. The client can also initiate a CRUDN operation on the server through the cloud platform. The cloud platform can also be called the cloud end. In an optional example, the cloud platform can be an Internet of Things (IoT) cloud platform, such as Figure 2 As shown, the cloud platform includes the following three entities:
[0070] Cloud interface: The cloud interface is the anchor point on the cloud platform, responsible for server access management and message routing for remote communication between the client and the server.
[0071] Authorization Server: The authorization server is responsible for the registration of the server and the client, as well as the authentication of the client and the server.
[0072] Resource directory: The resource directory stores the resource index of the server. The client can obtain the server's resources by searching the resource directory.
[0073] At present, rule resources can only include locally stored resources, not remote resources. The reason is that the current technical architecture cannot guarantee that remote input resources can be perceived by electronic devices in a timely, accurate, and consistent manner, nor can actions on different devices be executed in a timely and consistent manner. To this end, the following technical solutions of the embodiments of the present application are proposed.
[0074] Figure 3 A schematic diagram of a rule processing method provided in an embodiment of the present application, wherein the method comprises the following steps:
[0075] Step 301: The first device creates a first rule, wherein the first rule includes a first rule input, a rule expression, and a rule behavior; wherein the first rule input is used by the first device or the cloud platform to create a second rule input.
[0076] In the embodiment of the present application, the first device is an electronic device (Rule Device), where the electronic device can be a home appliance, industrial equipment, vehicle-mounted terminal, etc. In the context of the Internet of Things, the first rule is represented by a first rule resource, the first rule input is represented by a first rule input set resource, the rule expression is represented by a rule expression resource, and the rule behavior is represented by a rule behavior set resource.
[0077] Figure 4 The schematic diagram of the architecture of the first rule is shown. The first rule resource (i.e., oic.r.rule) is a collection resource, which includes the following three resources: the first rule input collection resource (i.e., oic.r.ruleinput), the rule expression resource (i.e., oic.r.ruleexpression), and the rule action collection resource (i.e., oic.r.ruleaction). It should be noted here that a collection resource refers to a resource that references other resources through links.
[0078] Specifically, the first rule input set resource references the rule input resources on each input device through links. The rule input resources are used to determine the input parameters of the rule judgment conditions. That is to say, for a specific rule, all its rule input resources are saved in the first rule input set resource through links. The rule expression resource includes expressions formed according to each rule input resource. When any rule input resource is updated to the rule expression and the rule enable (Rule Enable) judgment result is true (true), the Boolean rule result (Boolean Rule Result) judgment continues. When the Boolean rule result changes from false (false) to true, and the action enable (Action Enable) is also true, the last event (lastScene) in the event collection resource is configured as the event value (scene value) in the rule action collection resource through the links that reference the event collection resource in the rule action collection resource.
[0079] For example, an expression of one of the rule inputs (or input parameters) in the first rule input set resource is as follows:
[0080]
[0081] In the embodiment of the present application, the rule input resource can be a local resource (i.e., the rule input resource is located in the first device, referred to as a local rule input resource), or a remote resource (i.e., the rule input resource is located in a second device other than the first device, referred to as a remote rule input resource). In the first rule input set resource, for the local rule input resource, a relative path can be used for reference; for the remote rule input resource, an absolute path needs to be used for reference.
[0082] In an embodiment of the present application, the first rule input includes at least one input parameter, where the input parameter is an input element referenced by a rule expression in a rule resource. The rule input resource corresponding to the input parameter can be stored on an electronic device or on each input device. A device can store one or more rule input resources corresponding to one or more input parameters. The input parameters in the first rule input set resource reference the rule input resource located on the first device or the second device through a reference address (such as links). Among them, the distribution of each reference address of at least one input parameter in the first rule input set resource may include the following situations:
[0083] 1) The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer;
[0084] 2) reference addresses of all input parameters of the at least one input parameter are located in the first device;
[0085] 3) The reference addresses of the first part of the input parameters in the at least one input parameter are located in N second devices, and the reference addresses of the second part of the input parameters are located in the first device, where N is a positive integer.
[0086] It should be noted that the second device is an input device, and here, the second device may be a temperature sensor, an alarm, an infrared detector, etc. It should be understood that any second device is not the same device as the first device that creates the rule resource.
[0087] It should be noted that the "reference address" in the embodiments of the present application includes but is not limited to a URL.
[0088] For example: the first rule input includes 4 input parameters in total, where the reference address of the first input parameter is located in the electronic device, the reference addresses of the second and third input parameters are located in the first input device, and the reference address of the fourth input parameter is located in the second input device. This example corresponds to the above-mentioned case 3).
[0089] In the embodiment of the present application, the first rule input is used by the first device or cloud platform to create the second rule input, which can be implemented in any of the following ways:
[0090] Mode 1: The first rule input is used by the first device to create a second rule input;
[0091] Method 2: The first rule input is used to create the second rule input on the cloud platform.
[0092] In the first approach, the rule processing method provided in the embodiment of the present application further includes step 302a (not shown in the figure):
[0093] Step 302a: The first device creates the second rule input based on the first rule input, where the second rule input includes all input parameters of the first rule input.
[0094] In step 302a, the first device creates a second rule input resource based on the links of the first rule input set resource to all input resources in the first rule resource, where the second rule input resource is a representation of the second rule input in the context of the Internet of Things. The second rule input resource contains all input parameters corresponding to all rule input resources referenced by the first rule input set resource.
[0095] It should be noted that, in the first approach, in different implementations, the second rule input resource may belong to a collection resource type or a non-collection resource type.
[0096] In some possible implementations, the second rule input resource is of a collection resource type. It should be understood that, in this case, in addition to storing all input parameters of the first rule input collection resource, the second rule input resource also stores reference addresses (i.e., links) of all input parameters, which are copies of the links stored in the first rule input collection resource.
[0097] In some preferred implementations, the second rule input resource is a non-set resource type, in which case the second rule input resource does not store the reference addresses (i.e., links) of all input parameters referenced by the rule resource. It should be noted that when the electronic device needs to send a subscription message to the second device in the subsequent step of determining the input parameter change, the links used are the links stored in the first rule set resource.
[0098] In the second approach, the rule processing method provided in the embodiment of the present application further includes step 302b (not shown in the figure):
[0099] Step 302b: The first device sends a creation request message to the cloud platform, wherein the creation request message is used to request the cloud platform to create the second rule input, wherein the second rule input includes all input parameters of the first rule input. Accordingly, the cloud platform receives the creation request message sent by the first device, and creates the second rule input based on the creation request message.
[0100] In step 302b, the first device sends a request to the cloud platform to create a second rule input resource, and the second rule input resource includes all input parameters corresponding to all input resources referenced by the first rule input set resource. Accordingly, the cloud platform receives the request to create the second rule input resource sent by the first device, and creates the second rule input based on the request.
[0101] Optionally, the first device receives a response message sent by the cloud platform, where the response message is used to indicate that the second rule input is created successfully.
[0102] It should be noted that, in the second approach, in different implementations, the second rule input resource may belong to a collection resource type or a non-collection resource type.
[0103] In some possible implementations, the second rule input resource belongs to a collection resource type. It should be understood that in this case, in addition to storing all input parameters of the first rule input collection resource, the second rule input resource also stores the reference addresses of all input parameters. Specifically, the cloud platform can be requested to create a second rule input resource containing referenced input resource links in any of the following ways:
[0104] A) When the first device sends a request message to the cloud platform to create a second rule input resource, the request message carries reference address information of all input parameters;
[0105] B) After the first device sends a request message to the cloud platform to create a second rule input resource, it actively sends a second message containing a reference address of all input parameters to the cloud platform;
[0106] C) When the first device sends a request message to the cloud platform to create a second rule input resource, the request message carries a first indication message, where the first indication message is used to instruct the cloud platform to send a request message to the first device to obtain a reference address of all input parameters;
[0107] D) After receiving the request message for creating the second rule input resource sent by the first device, the cloud platform actively requests the first device to obtain the reference addresses of all input parameters.
[0108] In some other possible implementations, the second rule input resource is characterized as a non-collective resource. In this case, the second rule input resource does not store the reference addresses (links) of all input parameters referenced by the rule resource. It should be noted that when the cloud platform needs to send a subscription message to the second device and / or the first device in the subsequent step of determining the input parameter change, the links used can be the electronic device actively sending the links stored in the first rule input collection resource to the cloud platform, or the cloud platform actively obtaining the links stored in the first rule input collection resource in the electronic device, or it can be implemented in other ways, which is not limited in the embodiments of the present application.
[0109] Step 303: The first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, determines the result of the rule expression based on the values of all input parameters, and determines whether to execute the rule behavior based on the result of the expression.
[0110] In step 303, the first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, assigns the obtained values of all input parameters of the same atomic set to the rule expression, and the rule expression obtains a judgment result. If the judgment result is true, the first device correspondingly modifies the attribute value of at least one rule behavior resource in the event set resource to execute the rule behavior; if the judgment result is false, the first device does not perform any operation on the rule behavior resource.
[0111] It should be noted that the electronic device may first try to obtain the values of all input parameters in the second rule input, and then determine whether the values of all the obtained input parameters belong to at least the same atomic set in the second rule input.
[0112] It should also be noted that the method of assigning the values of all input parameters of the same atomic set to the regular expression can be implemented through internal subscription or other implementation means, and this application does not make specific limitations.
[0113] First, the definition of an atomic set is explained. An atomic set means that each read or write operation in the set must include all the contents of the set. It is meaningful only if all the attribute values in the set are assigned. A single element (attribute value) in the set is meaningless. Because of the atomic characteristics, for all input parameters belonging to the same atomic set in the second rule input, it is necessary to obtain the values of all the corresponding input parameters before assigning them to the same atomic set in the second rule input. In other words, if the device corresponding to any input parameter in all the input parameters in the same atomic set is offline, the rule cannot be triggered for judgment if the values of all the input parameters cannot be obtained, which can effectively reduce the false triggering rate of the rule.
[0114] It should be noted that the same atom set in the second rule input is the minimum resource set that can correctly trigger the rule expression in the rule resource. This includes two situations:
[0115] 1) All input parameters in the second rule input belong to the same atomic set.
[0116] 2) All input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
[0117] In case 1), the resource type of the second rule input belongs to atomic resources.
[0118] In case 2), the resource type of the second rule input is not an atomic resource, and further, the second rule input contains at least two atomic sets.
[0119] It should be noted that in step 303, for case 2), the electronic device obtains the values of all input parameters belonging to the same atomic set in the second rule input, which may be the values of all input parameters of one atomic set in the second rule input, or the values of all input parameters of multiple atomic sets in the second rule input. Here, the specific atomic set or sets in the second rule input that the electronic device should obtain the values of all input parameters of may be preset by the electronic device or configured by the user, and this application does not limit this.
[0120] Optionally, a division method of different atom sets in the second rule input is:
[0121] If the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
[0122] For example: when creating the second rule input, add a list identifier for each input parameter; according to the judgment of the rule expression, determine the relationship and category of each input parameter, and assign different values to the list identifier. The specific method is as follows: the input conditions on both sides of the first-level "or" logical operator are respectively used as different atomic sets; for example, A and B or C, A and B are the same category "1", and C is another category "2"; A and (B or C) and D, here or is the second-level logical operator, so the categories of A, B, C, and D are the same. This method can optimize the optional options for the second rule input when obtaining resources. For example, in A and B or C, as long as A can be obtained, B or C can complete the operation expression, and will not affect the operation result of the rule expression, reducing the difficulty of obtaining input parameters in the rule resources.
[0123] It should be noted that in the above example, the following situation may exist: in the second rule input, only the input condition (i.e., input parameter) C changes, and other input parameters do not change (i.e., input parameters A and B do not change). In other words, although the input parameter value changes in the second rule input, it does not affect the result of the rule expression. After the electronic device determines that the second rule input has undergone such a change, it can choose not to obtain the values of all input parameters belonging to the same atomic set in the second rule input. Of course, it can also choose to continue to obtain the values of all input parameters belonging to the same atomic set in the second rule input, determine the result of the rule expression based on the values of all input parameters, and determine whether to execute the rule behavior based on the result of the expression.
[0124] Corresponding to the aforementioned step 302a, in step 303, the first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, including the following three cases:
[0125] I) When the first rule input includes at least one input parameter, and the reference addresses of all input parameters in the at least one input parameter are located in N second devices, the first device obtains the values of all input parameters in the second rule input that belong to the same atomic set, including the following steps:
[0126] Step 3031-I: The first device sends a first subscription message to each of the N second devices respectively, where the first subscription message is used to subscribe to input parameters in the second device.
[0127] In step 3031-I, the electronic device sends a subscription message to all input devices based on the reference address of the input parameters called in the rule resource to subscribe to the input parameters in the input devices. When any of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
[0128] Optionally, after receiving the subscription message sent by the electronic device, the input device sends a subscription success notification message to the electronic device.
[0129] It should be noted that, in some possible implementations, the electronic device may also indirectly send the first subscription message to one or more second devices among the N devices respectively through the cloud platform.
[0130] Step 3032-I: The first device receives a first notification message sent by one or more second devices among the N second devices, where the first notification message is used to notify the first device that a subscribed input parameter has changed.
[0131] In step 3032-I, the electronic device receives an input parameter change notification message sent by one or more input devices. It should be noted that the situation where multiple input devices send notification messages refers to the situation where the input parameters of multiple input devices have changed within a preset time range. Here, the preset time range starts from the time when the first parameter change occurs and lasts for a set duration. The preset duration can be preset by the electronic device or actively set by the user. There is no limitation on the value of the preset duration. For example, it can be 0 or 1ms.
[0132] Step 3033-I: The first device obtains the values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
[0133] In step 3033-I, the electronic device obtains the values of all input parameters belonging to the same atomic set in the second rule input from all input devices. In OCF, the notification message sent by the input device to the electronic device will carry the updated value of the corresponding input parameter. Therefore, optionally, the electronic device may not need to obtain the value of the input parameter again from the input device that has sent the notification message. For other input devices that have not sent notification messages to the electronic device, here, the value of the corresponding input parameter can be obtained through the read operation in the CRUDN operation.
[0134] II) When the first rule input includes at least one input parameter, and the reference addresses of all input parameters in the at least one input parameter are located in the first device, the first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, including the following steps:
[0135] Step 3032-II: The first device receives a parameter value change notification message of one or more input parameters on the device.
[0136] In step 3032-II, the electronic device receives one or more input parameter change notification messages on the device. It should be noted that because all input parameters referenced by the rule resources are on the electronic device, that is, they are all local resources, the electronic device can, but is not limited to, receive parameter value change messages from the local resources in an active manner or a request manner.
[0137] It should also be noted that the multiple notification messages referred to here correspond to the situation where multiple input parameters have changed within the preset time range. Here, the preset time range starts from the time when the first parameter change occurs and lasts for a preset time. The preset time can be preset by the electronic device or actively set by the user. There is no limitation on the value of the preset time here. For example, it can be 0 or 1ms.
[0138] Step 3033-II: The first device obtains the values of all input parameters belonging to the same atomic set in the second rule input from the first device.
[0139] In step 3033-II, the electronic device obtains the values of all input parameters belonging to the same atomic set in the second rule input from the device. Optionally, when the input parameter change notification message carries the updated value of the corresponding input parameter, the electronic device does not need to obtain the value of the input parameter of the sent notification message again. For other input devices that have not sent notification messages, the value of the corresponding input parameter can be obtained through the read operation in the CRUDN operation.
[0140] III) When the first rule input includes at least one input parameter, the reference address of the first part of the input parameters in the at least one input parameter is located in N second devices, and the reference address of the second part of the input parameters is located in the first device, the first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, including the following steps:
[0141] Step 3031-III: The first device sends a first subscription message to each of the N second devices respectively, where the first subscription message is used to subscribe to input parameters in the second device.
[0142] In step 3031-III, the electronic device sends a subscription message to all input devices pointed to by the reference address of the input parameter called in the rule resource to subscribe to the input parameters in the input device. When any of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
[0143] Optionally, after receiving the subscription message sent by the electronic device, the input device sends a subscription success notification message to the electronic device.
[0144] Step 3032-III: The first device receives a notification message sent by one or more second devices among the N second devices and / or the first device, where the notification message is used to notify the first device that an input parameter called has changed.
[0145] In step 3032-III, the electronic device receives an input parameter change notification message sent by one or more input devices and / or the electronic device itself. It should be noted that the situation of receiving multiple notification messages referred to here corresponds to the situation where the input parameters in any multiple devices have changed within the preset time range. Here, the preset time range starts from the time when the first parameter change occurs and lasts for a preset duration. The preset duration can be preset by the electronic device or actively set by the user. There is no limitation on the value of the preset duration. For example, it can be 0 or 1ms.
[0146] Step 3033-III: The first device obtains values of all input parameters belonging to the same atomic set in the second rule input from the N second devices and the first device.
[0147] In step 3033-III, the electronic device obtains the values of all input parameters belonging to the same atomic set in the second rule input from all input devices and the electronic device itself. The corresponding acquisition method has been described above and will not be repeated here.
[0148] Preferably, the electronic device executes step 3033-III after receiving the first notification message among the input parameter change notification messages sent by one or more input devices and / or the electronic device itself.
[0149] Corresponding to the aforementioned step 302b, in step 303, the first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, including steps 3031b and 3032b:
[0150] Step 3031b: The first device sends a second subscription message to the cloud platform, where the second subscription message is used to subscribe to the second rule input in the cloud platform. Correspondingly, the cloud platform receives the second subscription message sent by the first device.
[0151] Specifically, the electronic device sends a subscription message to the cloud platform, where the subscription message is used to subscribe to the second rule input in the cloud platform. Correspondingly, the cloud platform receives the subscription message sent by the electronic device.
[0152] Optionally, after receiving the subscription message sent by the electronic device, the cloud platform sends a subscription success notification message to the electronic device, and the electronic device receives the subscription success notification message.
[0153] It should be noted that after step 302b, the cloud platform sends subscription messages to all corresponding input devices and / or electronic devices based on the links pointing to all input parameters in the second rule input, and the subscription messages are used to subscribe to all input parameters in the second rule input.
[0154] Optionally, when the electronic device sends a request message to the cloud platform to create the second rule input, it instructs the cloud platform to actively subscribe to all input parameters in the second rule input. The instruction operation can be implemented by adding a switch resource to the second rule input to determine whether to execute the subscription, and setting the resource to "subscribe" when creating the second rule input. The cloud platform executes the subscription request based on this.
[0155] Optionally, the cloud platform will actively subscribe to all input parameters of any resource of the second rule input type.
[0156] Optionally, the cloud platform indirectly subscribes to the input parameters in the corresponding second rule input to the device where the input parameters in the second rule input are located through other cloud platforms.
[0157] Optionally, the cloud platform receives a subscription success notification message sent by the input device and / or the electronic device.
[0158] Furthermore, when the cloud platform receives the earliest parameter value change notification message sent by at least one of the subscribed devices, the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input from all input devices and / or electronic devices. It should be noted that the cloud platform may first try to obtain the values of all input parameters in the second rule input, and then determine whether the values of all the input parameters obtained belong to at least the same atomic set in the second rule input.
[0159] How the cloud platform determines whether the values of all input parameters in the acquired second rule input belong to at least the same atomic set in the second rule input can be achieved in the following ways:
[0160] The request to create the second rule input sent by the electronic device to the cloud platform carries an indication message, which is used to indicate the resource type of the second rule input. In some possible implementations, the resource type of the second rule input is an atomic resource. In other possible implementations, the resource type of the second rule input is not an atomic resource. Further, the second rule input includes at least two atomic sets. The division method of different atomic sets has been described in detail above and will not be repeated here.
[0161] It should be noted that the electronic device can send an indication message to the cloud platform at any time to change the resource type of the second rule input, or adjust the atomic set to which any input parameter in the second rule input belongs. It should also be noted that, for the case where the second rule input contains at least two atomic sets, preferably, when the cloud platform cannot obtain the values of all input parameters in the second rule input, but can obtain the values of all input parameters in at least one atomic set, the cloud platform sends the values of all input parameters in the second rule input belonging to the same atomic set to the electronic device.
[0162] Specifically, the values of the various input parameters in the second rule input in the cloud platform can be obtained in the following manner:
[0163] When the reference addresses of all input parameters in the at least one input parameter are located in N second devices, obtaining the values of each input parameter in the second rule input from the N second devices; or,
[0164] When the reference addresses of all input parameters in the at least one input parameter are located in the first device, obtaining the values of each input parameter in the second rule input from the first device; or
[0165] When the reference address of the first part of the input parameters in the at least one input parameter is located in N second devices and the reference address of the second part of the input parameters is located in the first device, the values of each input parameter in the second rule input are obtained from the N second devices and the first device.
[0166] Specifically, in one example, the reference addresses of all input parameters in at least one input parameter are located in N second devices, and the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, which may include the following steps:
[0167] Step 401a: the cloud platform sends a third subscription message to each of the N second devices, where the third subscription message is used to subscribe to input parameters in the second device;
[0168] In step 401a, the cloud platform sends a subscription message to all input devices pointed to by the reference address of the input parameter called in the rule resource to subscribe to the input parameters in the input device. When any of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the cloud platform.
[0169] Optionally, after receiving the subscription message sent by the cloud platform, the input device sends a subscription success notification message to the cloud platform.
[0170] Step 402a: the cloud platform receives a third notification message sent by one or more second devices among the N second devices, where the third notification message is used to notify the cloud platform that a subscribed input parameter has changed;
[0171] In step 402a, the cloud platform receives an input parameter change notification message sent by one or more input devices. It should be noted that the situation where multiple input devices send notification messages refers to the situation where the input parameters of multiple input devices have changed within a preset time range. Here, the preset time range starts from the time when the first parameter change occurs and lasts for a preset duration. The preset duration can be preset by the electronic device or actively set by the user. There is no limitation on the value of the preset duration. For example, it can be 0 or 1ms.
[0172] Step 403a: The cloud platform obtains values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
[0173] In step 403a, the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input from all input devices. In OCF, the notification message sent by the subscribed device to the subscribing device will carry the updated value of the corresponding input parameter. Therefore, optionally, the cloud platform does not need to obtain the value of the input parameter again from the input device that has sent the notification message. For other input devices that have not sent notification messages to the cloud platform, the corresponding input parameter value can be obtained through the read operation in the CRUDN operation.
[0174] In another example, the reference addresses of all input parameters in at least one input parameter are located in the first device, and the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, which may include the following steps:
[0175] Step 401b: the cloud platform sends a fourth subscription message to the first device, where the fourth subscription message is used to subscribe to input parameters in the first device;
[0176] Step 402b: the cloud platform receives a fourth notification message sent by the first device, where the fourth notification message is used to notify the cloud platform that a subscribed input parameter has changed;
[0177] Step 403b: The cloud platform obtains values of all input parameters belonging to the same atomic set in the second rule input from the first device.
[0178] Steps 401b to 403b are performed similarly to the above steps 401a to 403a, and are not described again here.
[0179] In another example, the reference address of the first part of the input parameters in at least one input parameter is located in N second devices, the reference address of the second part of the input parameters is located in the first device, and the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, which may include the following steps:
[0180] Step 401c: the cloud platform sends a fifth subscription message to each second device in the N second devices and the first device respectively, where the fifth subscription message is used to subscribe to input parameters in the second device and the first device;
[0181] Step 402c: the cloud platform receives a fifth notification message sent by at least one second device among the N second devices and / or the first device, where the fifth notification message is used to notify the cloud platform that a subscribed input parameter has changed;
[0182] Step 403c: The cloud platform obtains values of all input parameters belonging to the same atomic set in the second rule input from the N second devices and the first device.
[0183] Steps 401c to 403c are performed similarly to the above steps 401a to 403a, and are not described again here.
[0184] Step 3032b: The first device receives a second notification message sent by the cloud platform, wherein the second notification message is used to notify the first device that a second rule input subscribed to by the first device has changed; wherein the second notification message carries the values of all input parameters belonging to the same atomic set in the second rule input. Accordingly, the cloud platform sends a second notification message to the first device.
[0185] Specifically, the electronic device receives a notification message sent by the cloud platform, and the notification message is used to notify the electronic device that the second rule input subscribed by the electronic device has changed. Correspondingly, the cloud platform sends the notification message to the electronic device.
[0186] It should be understood that, for the case where the second rule input contains at least two atomic sets, if the electronic device indicates a specific subscription rule in the second subscription message, the cloud platform will send the corresponding atomic set in the second rule input according to the instruction of the electronic device. For example: the electronic device carries the priority of the atomic set in the second rule input in the subscription message sent to the cloud platform to subscribe to the second rule input. Then, when the cloud platform obtains the values of the input parameters of multiple atomic sets in the second rule input at the same time, it will give priority to sending the atomic set with a high priority to the electronic device.
[0187] Optionally, the notification message is used to notify the electronic device that the values of all input parameters belonging to the same atomic set in the second rule input subscribed to have been obtained.
[0188] It should be noted that in the monitoring operation (observe) of OCF, the second notification message sent by the cloud platform to the electronic device will carry the updated values of all input parameters belonging to the same atomic set in the second rule input. Therefore, optionally, after the electronic device receives the second notification message sent by the cloud platform carrying the values of all input parameters belonging to the same atomic set in the second rule input, it can directly obtain the values of all input parameters belonging to the same atomic set from the second notification message.
[0189] In another optional embodiment, the second notification message does not carry the values of all input parameters belonging to the same atomic set in the second rule input. In this case, the first device needs to further obtain the values of all input parameters belonging to the same atomic set in the second rule input from the cloud platform through an acquisition message.
[0190] In the embodiment of the present application, optionally, after step 303, the rule processing method may further include step 305:
[0191] Step 305: The first device clears the values of all input parameters in the second rule input.
[0192] Specifically, after the rule resource completes the calculation, the electronic device clears the values of all input parameters in the second rule input, and waits for the next assignment of the second rule input.
[0193] In the present application, a second rule input is created based on a first rule input, and the value of the input parameter used to determine the result of the rule expression comes from the values of all input parameters belonging to the same atomic set in the acquired second rule input. For the same atomic set in the second rule input, each read or write operation must include the values of all corresponding input parameters. Therefore, the problem in the related art that it is impossible to ensure that the rule inputs from each device can be consistently perceived by the device where the rule is located can be solved, and at the same time, the problem that the existing technical architecture cannot include remote input resources can be solved, so as to expand the source of input resources, reduce the false triggering rate of rules, and improve the accuracy of rule execution.
[0194] The following combination Figure 5 and Figure 6 The technology of Example 1 of the present application is illustrated by way of example. It should be noted that the following application example is only an optional solution of the present application and does not limit the protection scope of the embodiment of the present application. Figure 5 The solution in the example is described by taking the method of creating the second rule input by the first device as an example. Figure 6 The solution in the example is to use the method of creating the second rule input on the cloud platform as an example.
[0195] Example 1:
[0196] The first rule input includes at least one input parameter, and the reference addresses of all input parameters in the at least one input parameter are located in N input devices. The electronic device subscribes to the input parameters on each input device, and after receiving the parameter change notification message, it first updates to the second rule input, and then brings in the rule expression. If the judgment result is true, the action device is notified to perform the corresponding action. It should be noted that the electronic device corresponds to the first device in the embodiment of the present application, and the input device corresponds to the second device in the embodiment of the present application. The resources representing the second rule input are atomic resources. Figure 5 As shown, the specific process includes the following steps:
[0197] Step 501: The electronic device creates a rule resource.
[0198] Specifically, the electronic device creates a rule resource, and the rule resource includes a first rule input set resource, a rule expression resource, and a rule behavior set resource.
[0199] Step 502: The electronic device creates a second rule input atomic resource based on the first rule input set resource.
[0200] Specifically, the electronic device creates a second rule input atomic resource based on the links of the first rule input set resource to all input resources. The second rule input atomic resource includes all input parameters referenced by the first rule input set resource, but does not include links pointing to all input resources.
[0201] It should be noted that step 502 may also be executed after step 505 .
[0202] Step 503: The electronic device sends a first subscription message to each of all input devices respectively, where the first subscription message is used to subscribe to input parameters in the input device.
[0203] Specifically, the electronic device sends a subscription message to all input devices based on the reference address of the input parameter called in the rule resource to subscribe to the input parameters in the input device. When any of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
[0204] Optionally, step 503 may also include: the input device sends a subscription success response message to the electronic device.
[0205] Step 504: One of all input devices sends a first notification message to the electronic device, where the first notification message is used to notify the electronic device that a subscribed input parameter has changed.
[0206] Specifically, when a subscribed input parameter changes, the input device needs to send a notification message to the electronic device. Here, one of all input devices sends the first notification message to the electronic device, which refers to the input device corresponding to the first input parameter that has changed among all subscribed input parameters. It should be noted that, for this example, the first input parameter that has changed may refer to the first input parameter that has changed after the input parameter is successfully subscribed to all input devices.
[0207] Step 505: After receiving the first notification message, the electronic device actively obtains values of other input parameters when the second rule input atomic resource includes multiple input parameters.
[0208] Specifically, after receiving a first notification message, if the second rule input atomic resource contains multiple input parameters, a read request will be sent to the input devices corresponding to the other input parameters except the input parameters contained in the first notification message, requesting to obtain the value of each input parameter. Of course, it is also possible that the same input device may have multiple input parameters.
[0209] It should be noted that in OCF, the notification message sent by the input device to the electronic device will carry the updated value of the corresponding input parameter. Therefore, optionally, the electronic device may not need to obtain the value of the input parameter again from the input device that has sent the notification message.
[0210] Step 506: The electronic device stores the acquired values of all input parameters into the second rule input atomic resource, and determines the result of the rule expression based on the values of all input parameters in the second rule input atomic resource.
[0211] Specifically, the electronic device obtains the values of all input parameters in the second rule input atomic resource, and assigns the obtained values of all input parameters to the rule expression for calculation. The assignment operation can be implemented through internal subscription or other implementation means, and the rule expression obtains the judgment result.
[0212] Step 507: The electronic device clears the values of all input parameters in the second rule input atomic resource.
[0213] Specifically, after the calculation of the rule expression is completed, the values of all input parameters of the second rule input atomic resource are cleared.
[0214] It should be noted that step 507 may also be executed after step 508.
[0215] Step 508: Based on the calculation result of the rule expression, the electronic device determines whether to execute the rule action.
[0216] Specifically, when any rule input resource is updated to the rule expression, and the rule enable (Rule Enable) determination result is true (true), the electronic device continues to perform Boolean rule result (Boolean Rule Result) determination.
[0217] Step 509: If the rule result is true, execute the rule action.
[0218] Specifically, when the result of the Boolean rule changes from false to true and the action enable is also true, the electronic device configures the last event (last Scene) in the event collection resource as the event value (scene value) in the rule behavior collection resource through the links that reference the event collection resource in the rule behavior collection resource.
[0219] In the present application, a second rule input is created based on a first rule input, and the value of the input parameter used to determine the result of the rule expression comes from the values of all input parameters belonging to the same atomic set in the acquired second rule input. For the same atomic set in the second rule input, each read or write operation must include the values of all corresponding input parameters. Therefore, the problem in the related art that it is impossible to ensure that the rule inputs from each device can be consistently perceived by the device where the rule is located can be solved, and at the same time, the problem that the existing technical architecture cannot include remote input resources can be solved, so as to expand the source of input resources, reduce the false triggering rate of rules, and improve the accuracy of rule execution.
[0220] Example 2:
[0221] The first rule input includes at least one input parameter, and the reference addresses of all input parameters of the at least one input parameter are located in N input devices. The cloud platform creates a second rule input based on the request of the electronic device. The cloud platform subscribes to the input parameters on each input device. After receiving the parameter change notification message, it first updates to the second rule input, and then notifies the electronic device. The electronic device brings the second rule input into the rule expression. If the judgment result is true, it notifies the action device to perform the corresponding action. It should be noted that the electronic device corresponds to the first device in the embodiment of the present application, and the input device corresponds to the second device in the embodiment of the present application. The input device can be a local device or a remote device, and the second rule input is an atomic resource. As Figure 6 As shown, the specific process includes the following steps:
[0222] Step 601: The electronic device creates a rule resource.
[0223] Specifically, the electronic device creates a new rule resource, which includes a first rule input set resource, a rule expression resource, and a rule behavior set resource.
[0224] Optionally, after step 601, the method further includes: the electronic device determines whether the first rule input set resources include a resource link that is not of the device.
[0225] Step 602: The electronic device sends a request message to the cloud platform to create a second rule input atomic resource.
[0226] Specifically, the electronic device sends a request to create a second rule input atomic resource to the cloud platform. The second rule input atomic resource contains all input parameters corresponding to all input resources referenced by the first rule input set resource. It should be understood that all input parameters referred to here do not include input parameters in the input resource that are unrelated to the rule resource. The second rule input atomic resource is characterized as a non-set resource, and the second rule input atomic resource does not store the reference address (links) of all input parameters referenced by the rule resource. It should be noted that when the cloud platform needs to send a subscription message to the input device in the subsequent step of determining the change of input parameters, the links used can be the electronic device actively sending the links stored in the first rule input set resource to the cloud platform, or the cloud platform actively obtaining the links stored in the first rule input set resource in the electronic device, or it can be implemented by other implementation methods, which is not limited in this application. Optionally, the request message for creating the second rule input atomic resource sent by the electronic device to the cloud platform carries a link resource pointing to all input parameters called by the rule resource.
[0227] Step 603: The cloud platform creates a second rule input atomic resource.
[0228] Optionally, after step 603, the method further includes: the cloud platform sends a response message to the electronic device, where the response message is used to indicate that creation of the second rule input atomic resource is completed.
[0229] Step 604: The electronic device subscribes to the second rule input atomic resource from the cloud platform.
[0230] Optionally, after step 604, the method further includes: the cloud platform sends a response message to the electronic device, where the response message is used to indicate that the subscription to the second rule input atomic resource is completed.
[0231] Step 605: Send a first subscription message to each input device in all input devices respectively, where the first subscription message is used to subscribe to all input parameters in the second rule input atomic resource.
[0232] Specifically, the cloud platform sends a subscription message to all input devices based on the reference address of the input parameters called in the acquired rule resources to subscribe to the input parameters in the input devices. When any of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
[0233] Optionally, after step 605, the process further includes: all subscribed input devices sending a subscription success response message to the cloud platform.
[0234] Step 606: One or more input devices among all input devices send a first notification message to the electronic device, where the first notification message is used to notify the electronic device that a subscribed input parameter has changed.
[0235] Specifically, when the subscribed input parameters change, the input device needs to send a notification message to the electronic device. Here, one of all the input devices sends the first notification message to the electronic device, which refers to the input device corresponding to the first input parameter that has changed among all the subscribed input parameters. It should be noted that, for this example, the first input parameter that has changed may refer to the first input parameter that has changed after the input parameters are successfully subscribed to all input devices. The situation where multiple input devices send notification messages to the cloud platform corresponds to the fact that the input parameters in multiple input devices have changed within a preset time range. Here, the preset time range starts from the time when the first parameter change occurs and lasts for a preset duration. The preset duration can be preset by the electronic device or actively set by the user. There is no limitation on the value of the preset duration here. For example, it can be 0 or 1ms.
[0236] Step 607: The cloud platform obtains the values of all input parameters in the second rule input atomic resource.
[0237] Specifically, the cloud platform obtains the values of all input parameters in the second rule input from all input devices. In OCF, the notification message sent by the input device to the cloud platform will carry the updated value of the corresponding input parameter. Therefore, optionally, the cloud platform does not need to obtain the value of the input parameter again from the input device that has sent the notification message. For other input devices that have not sent notification messages to the cloud platform, the corresponding input parameter value can be obtained through the read operation in the CRUDN operation.
[0238] Step 608: The cloud platform sends a notification message to the electronic device, where the notification message is used to notify the electronic device that a change has occurred in the second rule input atomic resource subscribed to by the electronic device.
[0239] Specifically, in the monitoring operation (observe) of OCF, the notification message sent by the cloud platform to the electronic device will carry the updated value of the second rule input atomic resource.
[0240] Step 609: The electronic device substitutes the values of all input parameters in the acquired second rule input atomic resource into the rule expression to determine the result of the rule expression.
[0241] Specifically, the electronic device assigns the values of all input parameters in the acquired second rule input atomic resource to the rule expression for calculation. The assignment operation can be implemented through internal subscription or other implementation means. The rule expression obtains a determination result.
[0242] Step 610: The electronic device clears the values of all input parameters in the second rule input atomic resource.
[0243] Specifically, after the calculation of the rule expression is completed, the values of all input parameters of the second rule input atomic resource are cleared.
[0244] It should be noted that step 610 may also be executed after step 611 .
[0245] Step 611: Based on the calculation result of the rule expression, the electronic device determines whether to execute the rule action.
[0246] Specifically, when any rule input resource is updated to the rule expression, and the rule enable (Rule Enable) determination result is true (true), the electronic device continues to perform Boolean rule result (Boolean Rule Result) determination.
[0247] Step 612: If the rule result is true, execute the rule action.
[0248] Specifically, when the result of the Boolean rule changes from false to true and the action enable is also true, the electronic device configures the last event (last Scene) in the event collection resource as the event value (scene value) in the rule behavior collection resource through the links that reference the event collection resource in the rule behavior collection resource.
[0249] In the present application, a second rule input is created based on a first rule input, and the value of the input parameter used to determine the result of the rule expression comes from the values of all input parameters belonging to the same atomic set in the acquired second rule input. For the same atomic set in the second rule input, each read or write operation must include the values of all corresponding input parameters. Therefore, the problem in the related art that it is impossible to ensure that the rule inputs from each device can be consistently perceived by the device where the rule is located can be solved, and at the same time, the problem that the existing technical architecture cannot include remote input resources can be solved, so as to expand the source of input resources, reduce the false triggering rate of rules, and improve the accuracy of rule execution.
[0250] Figure 7 Schematic diagram of the structure of the rule processing device provided in the embodiment of the present application Figure 1 , applied to the first device, such as Figure 7 As shown, the rule processing device includes:
[0251] A first creation unit 701 is used to create a first rule, wherein the first rule includes a first rule input, a rule expression, and a rule behavior; wherein the first rule input is used by the device or cloud platform to create a second rule input;
[0252] An acquisition unit 702 is used to acquire values of all input parameters belonging to the same atom set in the second rule input;
[0253] The determination unit 703 is used to determine the result of the rule expression based on the values of all the input parameters, and determine whether to execute the rule behavior based on the result of the expression.
[0254] In one embodiment, the first rule input includes at least one input parameter; wherein,
[0255] The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer; or,
[0256] The reference addresses of all input parameters of the at least one input parameter are located in the device; or,
[0257] The reference addresses of the first part of the at least one input parameter are located in N second devices, and the reference addresses of the second part of the input parameters are located in the device, where N is a positive integer.
[0258] In one embodiment, the rule processing device further includes:
[0259] The second creating unit 704 is configured to create the second rule input based on the first rule input, where the second rule input includes all input parameters of the first rule input.
[0260] In one embodiment, the acquisition unit is used to: when the reference addresses of all input parameters in the at least one input parameter are located in N second devices, send a first subscription message to each of the N second devices respectively, and the first subscription message is used to subscribe to the input parameters in the second device; receive a first notification message sent by one or more second devices among the N second devices, and the first notification message is used to notify the device that the subscribed input parameters have changed; and obtain the values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
[0261] In one embodiment, the rule processing device further includes:
[0262] The request unit 705 is used to send a creation request message to the cloud platform, where the creation request message is used to request the cloud platform to create the second rule input, where the second rule input includes all input parameters of the first rule input.
[0263] In one embodiment, the acquisition unit is used to: send a second subscription message to the cloud platform, the second subscription message is used to subscribe to the second rule input in the cloud platform; receive a second notification message sent by the cloud platform, the second notification message is used to notify the device that the second rule input subscribed to has changed; wherein the second notification message carries the values of all input parameters belonging to the same atomic set in the second rule input.
[0264] In one implementation, the values of the various input parameters in the second rule input in the cloud platform are obtained in the following manner:
[0265] When the reference addresses of all input parameters in the at least one input parameter are located in N second devices, obtaining the values of each input parameter in the second rule input from the N second devices; or,
[0266] When the reference addresses of all input parameters in the at least one input parameter are located in the device, obtaining the values of each input parameter in the second rule input from the device; or
[0267] When the reference address of the first part of the at least one input parameter is located in N second devices and the reference address of the second part of the input parameter is located in the device, the values of each input parameter in the second rule input are obtained from the N second devices and the device.
[0268] In one embodiment, all input parameters in the second rule input belong to the same atom set.
[0269] In one embodiment, all input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
[0270] In one embodiment, if the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
[0271] In one implementation, the first rule input belongs to a collection resource type, and the second rule input belongs to a non-collection resource type; or, both the first rule input and the second rule input belong to a collection resource type.
[0272] In one embodiment, the rule processing device further includes:
[0273] The clearing unit 706 is used to clear the values of all input parameters in the second rule input.
[0274] Those skilled in the art should understand that Figure 7 The implementation functions of each unit in the rule processing device shown can be understood by referring to the relevant description of the rule processing method. Figure 7 The functions of the modules in the rule processing device shown can be implemented by a program running on a processor, or by a specific logic circuit.
[0275] Figure 8 Schematic diagram of the structure of the rule processing device provided in the embodiment of the present application Figure 2 , applied to cloud platforms, such as Figure 8 As shown, the rule processing device includes:
[0276] A creation unit 801 is configured to receive a creation request message sent by a first device, and create a second rule input based on the creation request message, wherein the second rule input includes all input parameters of the first rule input, wherein the first rule input belongs to a first rule created by the first device, and the first rule further includes a rule expression and a rule behavior;
[0277] An acquisition unit 802 is used to acquire values of all input parameters belonging to the same atom set in the second rule input;
[0278] A sending unit 803 is used to send the values of all input parameters belonging to the same atomic set in the second rule input to the first device;
[0279] The values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression, and determine whether to execute the rule behavior based on the result of the expression.
[0280] In one embodiment, the first rule input includes at least one input parameter; wherein,
[0281] The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer; or,
[0282] The reference addresses of all input parameters of the at least one input parameter are located in the first device; or,
[0283] The reference addresses of the first part of the input parameters in the at least one input parameter are located in N second devices, and the reference addresses of the second part of the input parameters are located in the first device, where N is a positive integer.
[0284] In one embodiment, the acquisition unit is used to: when the reference addresses of all input parameters in the at least one input parameter are located in N second devices, send a third subscription message to each of the N second devices respectively, and the third subscription message is used to subscribe to the input parameters in the second device; receive a third notification message sent by one or more second devices among the N second devices, and the third notification message is used to notify the cloud platform that the subscribed input parameters have changed; and obtain the values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
[0285] In one embodiment, the acquisition unit is used to: send a fourth subscription message to the first device when the reference addresses of all input parameters in the at least one input parameter are located in the first device, and the fourth subscription message is used to subscribe to the input parameters in the first device; receive a fourth notification message sent by the first device, and the fourth notification message is used to notify the cloud platform that the subscribed input parameters have changed; and obtain the values of all input parameters belonging to the same atomic set in the second rule input from the first device.
[0286] In one embodiment, the acquisition unit is used to: when the reference address of the first part of the input parameters in the at least one input parameter is located in N second devices and the reference address of the second part of the input parameters is located in the first device, send a fifth subscription message to each second device among the N second devices and the first device respectively, and the fifth subscription message is used to subscribe to the input parameters in the second device and the first device; receive a fifth notification message sent by at least one second device among the N second devices and / or the first device, and the fifth notification message is used to notify the cloud platform that the subscribed input parameters have changed; obtain the values of all input parameters belonging to the same atomic set in the second rule input from the N second devices and the first device.
[0287] In one embodiment, the sending unit is used to: receive a second subscription message sent by the first device, the second subscription message is used to subscribe to the second rule input in the cloud platform; send a second notification message to the first device, the second notification message is used to notify the first device that the second rule input subscribed to has changed; wherein the second notification message carries the values of all input parameters belonging to the same atomic set in the second rule input.
[0288] In one embodiment, all input parameters in the second rule input belong to the same atom set.
[0289] In one embodiment, all input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
[0290] In one embodiment, if the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
[0291] In one implementation, the first rule input belongs to a collection resource type, and the second rule input belongs to a non-collection resource type; or, both the first rule input and the second rule input belong to a collection resource type.
[0292] Those skilled in the art should understand that Figure 8 The implementation functions of each unit in the rule processing device shown can be understood by referring to the relevant description of the rule processing method. Figure 8 The functions of the modules in the rule processing device shown can be implemented by a program running on a processor, or by a specific logic circuit.
[0293] Fig. 9 It is a schematic structural diagram of an electronic device 900 provided in an embodiment of the present application. Fig. 9 The electronic device 900 shown includes a processor 910, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0294] Alternatively, if Fig. 9 As shown, the electronic device 900 may further include a memory 920. The processor 910 may call and run a computer program from the memory 920 to implement the method in the embodiment of the present application.
[0295] The memory 920 may be a separate device independent of the processor 910 , or may be integrated into the processor 910 .
[0296] Alternatively, if Fig. 9 As shown, the electronic device 900 may further include a transceiver 930, and the processor 910 may control the transceiver 930 to communicate with other devices, specifically, may send information or data to other devices, or receive information or data sent by other devices.
[0297] The transceiver 930 may include a transmitter and a receiver. The transceiver 930 may further include an antenna, and the number of antennas may be one or more.
[0298] Optionally, the electronic device 900 includes a rule processing device according to an embodiment of the present application, and the electronic device 900 can implement the corresponding processes implemented by the rule processing device in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity.
[0299] Optionally, the electronic device 900 may be the first device (ie, a rule device) in each method of the embodiments of the present application.
[0300] Optionally, the electronic device 900 may be any second device (ie, input device) in each method of the embodiments of the present application.
[0301] Optionally, the electronic device 900 may be a cloud platform in each method of the embodiments of the present application.
[0302] Fig.10 It is a schematic structural diagram of the chip of an embodiment of the present application. Fig.10 The chip 1000 shown includes a processor 1010, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0303] Alternatively, if Fig.10 As shown, the chip 1000 may further include a memory 1020. The processor 1010 may call and run a computer program from the memory 1020 to implement the method in the embodiment of the present application.
[0304] The memory 1020 may be a separate device independent of the processor 1010 , or may be integrated into the processor 1010 .
[0305] Optionally, the chip 1000 may further include an input interface 1030. The processor 1010 may control the input interface 1030 to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.
[0306] Optionally, the chip 1000 may further include an output interface 1040. The processor 1010 may control the output interface 1040 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.
[0307] Optionally, the chip can be applied to the electronic device in the embodiments of the present application, and the chip can implement the corresponding processes implemented by the electronic device in each method of the embodiments of the present application, which will not be described in detail here for the sake of brevity.
[0308] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0309] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.
[0310] Optionally, the computer-readable storage medium can be applied to the electronic device in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the electronic device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0311] An embodiment of the present application also provides a computer program product, including computer program instructions.
[0312] Optionally, the computer program product can be applied to the electronic device in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes implemented by the electronic device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0313] The embodiment of the present application also provides a computer program.
[0314] Optionally, the computer program can be applied to the electronic device in the embodiments of the present application. When the computer program runs on a computer, the computer executes the corresponding processes implemented by the electronic device in the various methods of the embodiments of the present application. For the sake of brevity, they are not described here.
[0315] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this document can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0316] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0317] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0318] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0319] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0320] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0321] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.< / value> < / key> < / value> < / name> < / query> < / path> < / deviceid>
Claims
1. A rule processing method, the method comprising: The first device creates a first rule, the first rule comprising a first rule input, a rule expression, and a rule behavior; wherein the first rule input is used by the first device or the cloud platform to create a second rule input; The first device obtains values of all input parameters belonging to the same atomic set in the second rule input, determines a result of the rule expression based on the values of all input parameters, and determines whether to execute the rule behavior based on the result of the expression; Wherein, the first rule input includes at least one input parameter; wherein, The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer; or, The reference addresses of all input parameters of the at least one input parameter are located in the first device; or, The reference addresses of the first part of the input parameters in the at least one input parameter are located in N second devices, and the reference addresses of the second part of the input parameters are located in the first device, where N is a positive integer; The first device and the second device are different devices; The first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, determines the result of the rule expression based on the values of all input parameters, and determines whether to execute the rule behavior based on the result of the expression, and then the method further includes: The first device clears the values of all input parameters in the second rule input.
2. The method according to claim 1, wherein: The method further comprises: The first device creates the second rule input based on the first rule input, and the second rule input includes all input parameters of the first rule input.
3. The method according to claim 2, wherein: In a case where the reference addresses of all input parameters in the at least one input parameter are located in N second devices, wherein the first device obtains the values of all input parameters belonging to the same atomic set in the second rule input, including: The first device sends a first subscription message to each of the N second devices respectively, where the first subscription message is used to subscribe to an input parameter in the second device; The first device receives a first notification message sent by one or more second devices among the N second devices, where the first notification message is used to notify the first device that a subscribed input parameter has changed; The first device obtains values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
4. The method according to claim 1, wherein: The method further comprises: The first device sends a creation request message to the cloud platform, where the creation request message is used to request the cloud platform to create the second rule input, where the second rule input includes all input parameters of the first rule input.
5. The method according to claim 4, wherein: The first device obtains values of all input parameters belonging to the same atomic set in the second rule input, including: The first device sends a second subscription message to the cloud platform, where the second subscription message is used to subscribe to the second rule input in the cloud platform; The first device receives a second notification message sent by the cloud platform, and the second notification message is used to notify the first device that a second rule input subscribed to has changed; wherein the second notification message carries the values of all input parameters belonging to the same atomic set in the second rule input.
6. The method according to claim 5, wherein: The values of the various input parameters in the second rule input in the cloud platform are obtained in the following manner: When the reference addresses of all input parameters in the at least one input parameter are located in N second devices, obtaining the values of each input parameter in the second rule input from the N second devices; or, When the reference addresses of all input parameters in the at least one input parameter are located in the first device, obtaining the values of each input parameter in the second rule input from the first device; or When the reference address of the first part of the input parameters in the at least one input parameter is located in N second devices and the reference address of the second part of the input parameters is located in the first device, the values of each input parameter in the second rule input are obtained from the N second devices and the first device.
7. The method according to any one of claims 1 to 6, wherein: All input parameters in the second rule input belong to the same atom set.
8. The method according to any one of claims 1 to 6, wherein: All input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
9. The method according to claim 8, wherein: If the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
10. The method according to any one of claims 1 to 6, wherein: The resource used to represent the first rule input belongs to a collection resource type, and the resource used to represent the second rule input belongs to a non-collection resource type; or, The resource used to represent the first rule input and the resource used to represent the second rule input both belong to a collection resource type.
11. A rule processing method, the method comprising: The cloud platform receives a creation request message sent by the first device, and creates a second rule input based on the creation request message, wherein the second rule input includes all input parameters of the first rule input, wherein the first rule input belongs to a first rule created by the first device, and the first rule further includes a rule expression and a rule behavior; The cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, and sends the values of all input parameters belonging to the same atomic set in the second rule input to the first device; wherein the values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression, and determine whether to execute the rule behavior based on the result of the expression; After the values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression and determine whether to execute the rule behavior based on the result of the expression, the values of all input parameters in the second rule input are cleared by the first device; Wherein, the first rule input includes at least one input parameter; wherein, The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer; or, The reference addresses of all input parameters of the at least one input parameter are located in the first device; or, The reference addresses of the first part of the input parameters in the at least one input parameter are located in N second devices, and the reference addresses of the second part of the input parameters are located in the first device, where N is a positive integer; The first device and the second device are different devices.
12. The method according to claim 11, wherein: In a case where the reference addresses of all input parameters in the at least one input parameter are located in N second devices, wherein the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, including: The cloud platform sends a third subscription message to each of the N second devices respectively, where the third subscription message is used to subscribe to an input parameter in the second device; The cloud platform receives a third notification message sent by one or more second devices among the N second devices, where the third notification message is used to notify the cloud platform that a subscribed input parameter has changed; The cloud platform obtains values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
13. The method according to claim 11, wherein: In a case where the reference addresses of all input parameters in the at least one input parameter are located in the first device, wherein the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, including: The cloud platform sends a fourth subscription message to the first device, where the fourth subscription message is used to subscribe to input parameters in the first device; The cloud platform receives a fourth notification message sent by the first device, where the fourth notification message is used to notify the cloud platform that a subscribed input parameter has changed; The cloud platform obtains values of all input parameters belonging to the same atomic set in the second rule input from the first device.
14. The method according to claim 11, wherein: In the case where the reference addresses of the first part of the input parameters in the at least one input parameter are located in the N second devices and the reference addresses of the second part of the input parameters are located in the first device, wherein the cloud platform obtains the values of all input parameters belonging to the same atomic set in the second rule input, including: The cloud platform sends a fifth subscription message to each second device in the N second devices and the first device respectively, where the fifth subscription message is used to subscribe to input parameters in the second device and the first device; The cloud platform receives a fifth notification message sent by at least one second device among the N second devices and / or the first device, where the fifth notification message is used to notify the cloud platform that a subscribed input parameter has changed; The cloud platform obtains values of all input parameters belonging to the same atomic set in the second rule input from the N second devices and the first device.
15. The method according to any one of claims 11 to 14, wherein: The sending to the first device the values of all input parameters belonging to the same atomic set in the second rule input includes: The cloud platform receives a second subscription message sent by the first device, where the second subscription message is used to subscribe to the second rule input in the cloud platform; The cloud platform sends a second notification message to the first device, where the second notification message is used to notify the first device that a second rule input subscribed to has changed; wherein the second notification message carries the values of all input parameters in the second rule input that belong to the same atomic set.
16. The method according to any one of claims 11 to 14, wherein: All input parameters in the second rule input belong to the same atom set.
17. The method according to any one of claims 11 to 14, wherein: All input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
18. The method according to claim 17, wherein: If the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
19. The method according to any one of claims 11 to 14, wherein: The resource used to represent the first rule input belongs to a collection resource type, and the resource used to represent the second rule input belongs to a non-collection resource type; or, The resource used to represent the first rule input and the resource used to represent the second rule input both belong to a collection resource type.
20. A rule processing device, applied to a first device, the device comprising: A first creation unit, configured to create a first rule, wherein the first rule includes a first rule input, a rule expression, and a rule behavior; wherein the first rule input is used by the device or the cloud platform to create a second rule input; An acquisition unit, used for acquiring values of all input parameters belonging to the same atom set in the second rule input; a determination unit, configured to determine a result of the rule expression based on the values of all the input parameters, and determine whether to execute the rule behavior based on the result of the expression; Wherein, the first rule input includes at least one input parameter; wherein, The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer; or, The reference addresses of all input parameters of the at least one input parameter are located in the device; or, The reference address of the first part of the input parameters in the at least one input parameter is located in N second devices, and the reference address of the second part of the input parameters is located in the device, where N is a positive integer; The first device and the second device are different devices; The device also includes: A clearing unit is used to clear the values of all input parameters in the second rule input.
21. The apparatus according to claim 20, further comprising: The second creating unit is configured to create the second rule input based on the first rule input, wherein the second rule input includes all input parameters of the first rule input.
22. The device according to claim 21, wherein The acquisition unit is used to: When the reference addresses of all input parameters in the at least one input parameter are located in N second devices, sending a first subscription message to each of the N second devices respectively, where the first subscription message is used to subscribe to the input parameters in the second device; receiving a first notification message sent by one or more second devices among the N second devices, where the first notification message is used to notify the apparatus that a subscribed input parameter has changed; The values of all input parameters belonging to the same atomic set in the second rule input are obtained from the N second devices.
23. The device according to claim 20, wherein: The device also includes: The request unit is used to send a creation request message to the cloud platform, wherein the creation request message is used to request the cloud platform to create the second rule input, and the second rule input includes all input parameters of the first rule input.
24. The device according to claim 23, wherein: The acquisition unit is used to: Sending a second subscription message to the cloud platform, where the second subscription message is used to subscribe to the second rule input in the cloud platform; Receive a second notification message sent by the cloud platform, wherein the second notification message is used to notify the device that a second rule input subscribed to has changed; wherein the second notification message carries the values of all input parameters belonging to the same atomic set in the second rule input.
25. The device according to claim 24, wherein: The values of the various input parameters in the second rule input in the cloud platform are obtained in the following manner: When the reference addresses of all input parameters in the at least one input parameter are located in N second devices, obtaining the values of each input parameter in the second rule input from the N second devices; or, When the reference addresses of all input parameters in the at least one input parameter are located in the device, obtaining the values of each input parameter in the second rule input from the device; or When the reference address of the first part of the at least one input parameter is located in N second devices and the reference address of the second part of the input parameter is located in the device, the values of each input parameter in the second rule input are obtained from the N second devices and the device.
26. The device according to any one of claims 20 to 25, wherein: All input parameters in the second rule input belong to the same atom set.
27. The device according to any one of claims 20 to 25, wherein: All input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
28. The device according to claim 27, wherein If the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
29. The device according to any one of claims 20 to 25, wherein: The first rule input belongs to a collection resource type, and the second rule input belongs to a non-collection resource type; or, The first rule input and the second rule input both belong to a collection resource type.
30. A rule processing device, applied to a cloud platform, comprising: a creating unit, configured to receive a creating request message sent by the first device, and create a second rule input based on the creating request message, wherein the second rule input includes all input parameters of the first rule input, wherein the first rule input belongs to a first rule created by the first device, and the first rule further includes a rule expression and a rule behavior; An acquisition unit, used for acquiring values of all input parameters belonging to the same atom set in the second rule input; a sending unit, configured to send values of all input parameters belonging to the same atomic set in the second rule input to the first device; wherein the values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression, and determine whether to execute the rule behavior based on the result of the expression; after the values of all input parameters belonging to the same atomic set in the second rule input are used by the first device to determine the result of the rule expression, and determine whether to execute the rule behavior based on the result of the expression, the values of all input parameters in the second rule input are cleared by the first device; Wherein, the first rule input includes at least one input parameter; wherein, The reference addresses of all input parameters in the at least one input parameter are located in N second devices, where N is a positive integer; or, The reference addresses of all input parameters of the at least one input parameter are located in the first device; or, The reference addresses of the first part of the input parameters in the at least one input parameter are located in N second devices, and the reference addresses of the second part of the input parameters are located in the first device, where N is a positive integer; The first device and the second device are different devices.
31. The device according to claim 30, wherein The acquisition unit is used to: When the reference addresses of all input parameters in the at least one input parameter are located in N second devices, sending a third subscription message to each of the N second devices respectively, where the third subscription message is used to subscribe to the input parameters in the second device; Receiving a third notification message sent by one or more second devices among the N second devices, where the third notification message is used to notify the cloud platform that a subscribed input parameter has changed; The values of all input parameters belonging to the same atomic set in the second rule input are obtained from the N second devices.
32. The device according to claim 30, wherein: The acquisition unit is used to: When the reference addresses of all input parameters in the at least one input parameter are located in the first device, sending a fourth subscription message to the first device, where the fourth subscription message is used to subscribe to the input parameters in the first device; receiving a fourth notification message sent by the first device, where the fourth notification message is used to notify the cloud platform that a subscribed input parameter has changed; The values of all input parameters belonging to the same atomic set in the second rule input are obtained from the first device.
33. The device according to claim 30, wherein: The acquisition unit is used to: When the reference address of the first part of the input parameters in the at least one input parameter is located in the N second devices and the reference address of the second part of the input parameters is located in the first device, a fifth subscription message is sent to each second device in the N second devices and the first device respectively, where the fifth subscription message is used to subscribe to the input parameters in the second device and the first device; receiving a fifth notification message sent by at least one second device among the N second devices and / or the first device, where the fifth notification message is used to notify the cloud platform that a subscribed input parameter has changed; The values of all input parameters belonging to the same atomic set in the second rule input are obtained from the N second devices and the first device.
34. The device according to any one of claims 30 to 33, wherein: The sending unit is used for: receiving a second subscription message sent by the first device, where the second subscription message is used to subscribe to the second rule input in the cloud platform; A second notification message is sent to the first device, where the second notification message is used to notify the first device that a second rule input subscribed to has changed; wherein the second notification message carries the values of all input parameters belonging to the same atomic set in the second rule input.
35. The device according to any one of claims 30 to 33, wherein: All input parameters in the second rule input belong to the same atom set.
36. The device according to any one of claims 30 to 33, wherein: All input parameters in the second rule input are divided into at least two atomic sets based on the rule expression.
37. The device according to claim 36, wherein If the expression has a first logical operator, and the first logical operator belongs to a first-level logical operator, then the input parameters on both sides of the first logical operator belong to different atomic sets; wherein the first logical operator refers to an OR operator.
38. The device according to any one of claims 30 to 33, wherein: The first rule input belongs to a collection resource type, and the second rule input belongs to a non-collection resource type; or, The first rule input and the second rule input both belong to a collection resource type.
39. An electronic device comprising: A processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory to execute the method as claimed in any one of claims 1 to 10 or any one of claims 11 to 19.
40. A chip, comprising: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as claimed in any one of claims 1 to 10 or any one of claims 11 to 19.
41. A computer-readable storage medium for storing a computer program, the computer program causing a computer to execute the method of any one of claims 1 to 10 or any one of claims 11 to 19.