Detailed Description
The application will be described in detail hereinafter with reference to the accompanying drawings in combination with embodiments. It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. It will be apparent that the described embodiments are some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
In order to facilitate understanding of the technical solutions of the embodiments of the present application, the following describes related technologies related to the embodiments of the present application.
Communication architecture
The open interconnection foundation (Open Connectivity Foundation, OCF) defines clients, which refer to devices that provide resources, and servers, which refer to devices that access resources.
The OCF adopts a Representational state transfer (Representational STATE TRANSFER, RESTFUL) architecture, and expresses information such as physical devices of the internet of things, function services provided by the devices, states of the devices and the like through resources, wherein the devices for providing the resources are servers, and the devices for accessing the resources are clients. The clients and the servers defined in the OCF are logical functional entities, and one device may be a client, or a server, or both a client and a server.
The business interaction between the client and the server is implemented by performing a RESTful operation on the resource, where the RESTful operation may be a Create-read-Update-Delete-Notify (CRUDN) operation, and obviously, the CRUDN operation may be any one or more of Create, read (Retrieve), update, delete, notify (Notify). The client is an initiator of RESTful operation, the server is a responder of RESTful operation, the client sends a resource operation request to the server, the resource operation is requested to be operated on the server, the server executes the resource operation, and returns a response to the client, wherein the response carries the content and description information of the resource.
FIG. 1 is an alternative communication architecture diagram provided by an embodiment of the present application, describing resources as resource model layers, each resource corresponding to a particular Uniform resource identifier (Uniform Resource Identifier, URI), accessible by accessing the URI of the resource, and each resource having a corresponding interface supporting Restful operations. The transmission protocol layer is used for transmitting the content and the description information of the resources, and the resource operation is mapped into a specific transmission protocol, so that the Restful operation of each resource is converted into entity information to be transmitted between devices, and a means is provided for interconnection and interworking between the devices.
The transmission protocol of the OCF adopts the constrained application protocol (Constrained Application Protocol, coAP) to carry resource operations, each CRUDN operation is mapped into a request message or a response message of CoAP, and the client can operate the resources of the server through three methods of GET, POST, DELETE in CoAP, so as to realize the conversion of the resource states.
Resource(s)
Uniform resource identifier (Uniform Resource Identifier, URI) of a resource
The resource is identified and addressed by a URI, and the URI of the resource specified by the OCF is expressed in the following form OCF:// < deviceID >/< path >:
ocf organization of URIs of resources (schema) is "ocf", if a URI omits the part before double slash "//", the default schema is "ocf".
DeviceID, namely the equipment Identification (ID) of the server, wherein the equipment ID is an identification mark globally unique to equipment.
Path, the path character string of accessing a certain resource, the path is globally unique in the range of the service end to which the resource belongs, and can be uniquely corresponding to a certain resource on the service end.
Query is a query string containing "< name > = < value >" segments, i.e. a list of "name-value pairs", each "name-value pair" being separated by one "&". In OCF, the query string will be mapped to CoAP, using the CoAP's corresponding syntax description.
The URI of a resource may be an absolute URI or a relative URI, the absolute URI is in the form of a complete URI, the relative URI does not include a schema and a deviceID part, the relative URI is a device to which the relative URI belongs, the resource is uniquely identified within the scope of the device, and the relative URI can be combined with the deviceID to form the absolute URI.
Resource model
The resource model is a core for realizing interconnection and interworking between devices, the transmission layer provides interconnection and interworking of transmission protocols, and the resource model is independent of the transmission protocols and provides technical support for complete interconnection and interworking between devices by mapping the resource model into the transmission protocols.
The features of the resource mainly include URI, attribute, resource reference and interface, and are described below:
URI-each resource is identified and addressed by a URI.
An attribute (property) that each resource contains an attribute for describing the state information of the resource, the attribute appearing in the form of a "< key > = < value >" key value pair. A resource expression is a snapshot of attributes. Interaction with the resource is achieved by exchanging requests and responses containing representations of the resource. For example, a read request is made to a resource, and a refresh request is made to the resource in response to the availability of a representation of the resource, the representation of the resource may be refreshed.
And resource references (Link), wherein the OCF defines resource connection (Link) for representing the association relation between the resources, and the OCF server can provide own resources in the form of the resource Link so as to facilitate the OCF client to find out the own resources. Wherein, the parameters of the OCF Link are shown in the following Table 1:
| Parameters (parameters) | Meaning of |
| anchor | The top and bottom hawks represent URIs of Link-containing owner resources |
| href | Target URIs, i.e. URIs of target resources referenced by Link |
| rel | Relationship between referenced resource URI and context URI |
| rt | Resource type identification for target resources |
| eps | Message endpoint (Endpoints) with access to a target resource |
TABLE 1
Interfaces (interfaces) are mechanisms for the representation and acquisition of resources, different interfaces corresponding to different representations of resources and to corresponding operating mechanisms.
The resources reside in the device and a resource must have a URI that can be specified by the resource creator at the time the resource is created. In addition, a resource must have one or more resource types, and the request to create the resource must specify the resource type to which the resource corresponds.
Fig. 2 is a schematic view of an application scenario provided by an embodiment of the present application, as shown in fig. 2, a server includes the following three resources:
Input resource-input resource is the resource that rule resource references through links.
Rule resources, which may also be called a rule engine, when the input resources change, the rule engine determines whether the rule expression is true according to the set rule logic, and if the determination result is true (true), an instruction is sent to the corresponding action resource to instruct the action resource to execute the corresponding action.
Action resource the action resource is a resource which determines that an action needs to be executed according to a rule resource.
As shown in fig. 2, the client may directly initiate CRUDN operations on the server containing the rule resources, so as to perform operations such as creating, updating, etc. on the input resources, rule resources, or action resources. The client may also initiate CRUDN operations on the server through the cloud platform. The cloud platform may also be referred to as a cloud, and in an alternative example, the cloud platform may be an internet of things (Internetwork of Things, ioT) cloud platform, as shown in fig. 2, comprising three entities:
The cloud interface is an anchor point on the cloud platform and is responsible for access management of the server and message routing of remote communication between the client and the server.
Authorization server-the authorization server is responsible for the registration of the server and the client and authentication of the client and the server.
Resource catalog, the resource catalog stores the resource index of the server, and the client can acquire the resource of the server by searching the resource catalog.
At present, rule resources can only contain locally stored resources, but cannot contain remote resources. The reason is that the current technical architecture cannot ensure that remote input resources can be timely, accurately and consistently perceived by electronic equipment, and cannot timely and consistently execute actions on different equipment. For this reason, the following technical solutions of the embodiments of the present application are provided.
Fig. 3 is a flow chart of a rule processing method according to an embodiment of the present application, where the method includes the following steps:
Step 301, a first device creates a first rule, wherein the first rule comprises a first rule input, a rule expression and a rule behavior, and the first rule input is used for creating a second rule input by the first device or a cloud platform.
In the embodiment of the present application, the first Device is an electronic Device (Rule Device), where the electronic Device may be a Device such as a home appliance, an industrial Device, or a vehicle-mounted terminal. In the context of the internet of things, the first rule is characterized by a first rule resource, the first rule input is characterized by a first rule input set resource, the rule expression is characterized by a rule expression resource, and the rule behavior is characterized by a rule behavior set resource.
FIG. 4 shows a schematic diagram of the architecture of a first rule, the first rule resource (i.e., oic. R. Rule) is a set resource that includes three resources, a first rule input set resource (i.e., oic. R. Rule input), a rule expression resource (i.e., oic. R. Rule expression), and a rule behavior set resource (i.e., oic. R. Rule). It should be noted that, the aggregate resource refers to a resource that refers to other resources through links.
Specifically, the first rule input set resource references rule input resources on each input device through links, and the rule input resources are used for determining input parameters of rule determination conditions, that is, for a specific rule, all rule input resources are stored in the first rule input set resource through links. The Rule expression resources include expressions formed from the Rule input resources, and when any Rule input resource is updated to the Rule expression and the Rule Enable determination result is true, the Boolean Rule result (Boolean Rule Result) determination is continued. When the Boolean rule result is changed from false (false) to true, and the Action Enable is also true, configuring the last event (LAST SCENE) in the event set resource as an event value (scene value) in the rule Action set resource through links referencing the event set resource in the rule Action set resource.
An expression for one of the rule inputs (or input parameters) in the first rule input set resource is exemplified as follows:
In the embodiment of the present application, the rule input resource may be a local resource (i.e., the rule input resource is located in the first device, abbreviated 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, abbreviated as a remote rule input resource). In the first rule input set resource, the relative path can be used for reference to the local rule input resource, and the absolute path is required for reference to the remote rule input resource.
In the 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, a rule input resource corresponding to the input parameter may be stored on an electronic device, or stored on each input device, and one device may store one or more rule input resources corresponding to one or more input parameters respectively. The input parameters in the first rule input set resource reference the rule input resource located on the first device or the second device via a reference address (e.g., links). The distribution condition of each reference address of at least one input parameter in the first rule input collection resource can comprise the following cases:
1) The reference addresses of all input parameters in the at least one input parameter are located in N second devices, and N is a positive integer;
2) The reference addresses of all of the at least one input parameter are located at the first device;
3) The reference addresses of a first part of the input parameters in the at least one input parameter are located in N second devices, the reference addresses of a second part of the input parameters are located in the first devices, and N is a positive integer.
The second device is an input device, where the second device may be a temperature sensor, an alarm, an infrared detector, or the like. It should be appreciated that any second device is not the same device as the first device that created the rule resource.
It should be noted that, the "reference address" in the embodiment of the present application includes, but is not limited to, URL.
For example, the first rule input includes a total of 4 input parameters, wherein the reference address of the first input parameter is located at the electronic device, the reference addresses of the second and third input parameters are located at the first input device, and the reference address of the fourth input parameter is located at the second input device. The example corresponds to the above class 3) case.
In the embodiment of the present application, the first rule input is used for the first device or the cloud platform to create the second rule input, and may be implemented in any one of the following manners:
the first rule input is used for the first device to create a second rule input;
And in a second mode, the first rule input is used for creating a second rule input by the cloud platform.
In a first aspect, the rule processing method provided in the embodiment of the present application further includes step 302a (not illustrated in the figure):
step 302a, the first device creates the second rule input based on the first rule input, wherein the second rule input comprises all input parameters of the first rule input.
In step 302a, the first device creates a second rule input resource based on links of a first rule input set resource of the first rule resources to all input resources, 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.
In the first embodiment, in a different embodiment, the second rule input resource may belong to a set resource type or a non-set resource type.
In some possible implementations, the second rule input resource belongs to a collection resource type. It should be appreciated that in this case, the second rule input resource stores reference addresses (i.e., links) of all input parameters in addition to all input parameters of the first rule input set resource, which are copies of links stored in the first rule input set resource.
In some preferred embodiments, the second rule input resource is of a non-aggregate resource type, in which case the second rule input resource does not hold reference addresses (i.e., links) for all input parameters referenced by the rule resource. In the following step of determining the input parameter variation, when the electronic device needs to send a subscription message to the second device, links used are links stored in the first rule set resource.
In the second mode, the rule processing method provided by the embodiment of the present application further includes step 302b (not illustrated in the figure):
Step 302b, the first device sends a creation request message to a cloud platform, where 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. Correspondingly, 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.
In step 302b, the first device sends a request to the cloud platform to create a second rule input resource that contains all input parameters corresponding to all input resources referenced by the first rule input set resource. Accordingly, the cloud platform receives a request for creating the second rule input resource sent by the first device, and creates the second rule input based on the request.
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 creation is successful.
In the second embodiment, in a different embodiment, the second rule input resource may belong to a set resource type or a non-set resource type.
In some possible implementations, the second rule input resource belongs to a collection resource type. It will be appreciated that in this case, the second rule input resource holds reference addresses for all input parameters in addition to all input parameters of the first rule input set resource. Specifically, the cloud platform may be requested to create a second rule input resource comprising a referenced input resource link by any of:
A) When the first equipment sends a request message for creating a second rule input resource to the cloud platform, the request message carries reference address information of all input parameters;
b) After the first device sends a request message for creating a second rule input resource to the cloud platform, actively sending a second message containing the reference addresses of all input parameters to the cloud platform;
C) When the first device sends a request message for creating a second rule input resource to the cloud platform, the request message carries a first indication message, and the first indication message is used for indicating the cloud platform to send the request message to the first device so as to acquire the reference addresses of all input parameters;
D) And after receiving a request message for creating the second rule input resource sent by the first device, the cloud platform actively requests the first device for acquiring the reference addresses of all the input parameters.
In other possible implementations, the second rule input resource is characterized as a non-aggregate resource, in which case the reference addresses (links) of all input parameters referenced by the rule resource are not saved in the second rule input resource. It should be noted that, in the subsequent step of determining the variation of the input parameter, when the cloud platform needs to send a subscription message to the second device and/or the first device, the links used may be that the electronic device actively sends the links stored in the first rule input set resource to the cloud platform, or the cloud platform actively acquires the links stored in the first rule input set resource in the electronic device, or may be implemented in other implementation manners, which is not limited in the embodiment of the present application.
Step 303, the first device obtains values of all input parameters belonging to the same atom 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.
In step 303, the first device obtains values of all input parameters belonging to the same atom set in the second rule input, and assigns the obtained values of all input parameters of the same atom set to the rule expression, where the rule expression obtains a determination result. If the judging result is true, the first equipment correspondingly modifies the attribute value of at least one rule behavior resource in the event set resource to execute the rule behavior, and if the judging result is false, the first equipment does not perform any operation on the rule behavior resource.
It should be noted that, the electronic device may preferentially attempt to obtain values of all input parameters in the second rule input, and then determine whether the obtained values of all input parameters belong to at least one atom set in the second rule input.
It should be further noted that, the implementation manner of assigning the values of all the obtained input parameters of the same atom set to the rule expression may be implemented through internal subscription or other implementation means, and the present application is not limited specifically.
First, the definition of an atomic set is explained, which means that every read or write operation in the set must contain all the contents of the set. It is only meaningful to assign all the attribute values within a collection, where a single element (attribute value) is meaningless. Because of the atomic characteristics, for all input parameters belonging to the same atomic set in the second rule input, the values of the corresponding input parameters need to be all acquired and then assigned to the same atomic set in the second rule input. That is, after any one of all input parameters in the same atom set is disconnected, if the values of all input parameters cannot be obtained, the rule cannot be started to determine, so that the false triggering rate of the rule can be effectively reduced.
It should be noted that the same atom set in the second rule input is the smallest resource set that can correctly trigger the rule expression in the rule resource. Two cases are included here:
1) All input parameters in the second rule input belong to the same atomic set.
2) All input parameters in the second rule input are partitioned into at least two sets of atoms based on the rule expression.
In case 1), the resource type entered by the second rule belongs to an atomic resource.
In case 2), the resource type of the second rule input is not an atomic resource, further the second rule input comprises at least two sets of atoms.
In step 303, for case 2), the electronic device may obtain values of all input parameters belonging to the same atom set in the second rule input, or may obtain values of all input parameters of one atom set in the second rule input, or may obtain values of all input parameters of a plurality of atom sets in the second rule input. Here, the specific electronic device should obtain the values of all input parameters of which one or more atom sets in the second rule input, which may be preset by the electronic device or configured by a user, and the present application is not limited to this.
Optionally, one way of dividing the different atom sets in the second rule input is:
if the expression has a first logical operator and the first logical operator belongs to a first-level logical operator, input parameters at two sides of the first logical operator belong to different atom sets, wherein the first logical operator refers to an OR operator.
For example, when creating the second rule input, a list identifier is added to each input parameter, and the relation and the category of each input parameter are determined according to the judgment of the rule expression, and different values are assigned to the list identifier. The specific method is that the input conditions at two sides of a first level or logical operator are respectively used as different atom sets, for example, A and B or C, A and B are the same category "1", C is another category "2", A and (B or C) and D, and here or is a second level logical operator, so that the category A, B, C, D is the same. In this way, the option of the second rule input in acquiring the resource can be optimized. For example, in A and B or C, as long as A, B or C can be obtained, the operation expression can be completed, the operation result of the rule expression is not affected, and the difficulty of obtaining the input parameters in the rule resource is reduced.
In the above example, there may be a case where only the input condition (i.e., the input parameter) C changes in the second rule input, and when the other input parameters are unchanged (i.e., the input parameters a and B are unchanged), that is, when the input parameter value changes in the second rule input but the rule expression determination result is not affected, the electronic device determines that the second rule input changes, and then may select to not acquire the values of all the input parameters belonging to the same atom set in the second rule input, or may select to continue acquiring the values of all the input parameters belonging to the same atom set in the second rule input, 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.
Corresponding to the foregoing step 302a, in step 303, the first device obtains values of all input parameters belonging to the same atom set in the second rule input, including the following three cases:
i) The first rule input comprises at least one input parameter, and when the reference addresses of all input parameters in the at least one input parameter are located in N second devices, the first device obtaining the values of all input parameters belonging to the same atom set in the second rule input comprises the following steps:
Step 3031-I, the first device sends a first subscription message to each of the N second devices, wherein the first subscription message is used for subscribing the input parameters in the second devices.
In step 3031-I, the electronic device sends a subscription message to all input devices based on the reference address of the input parameter invoked in the rule resource, for subscribing to the input parameter in the input device, and when any one of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
Optionally, after receiving the subscription message sent by the electronic device, the input device sends a subscription success notification message to the electronic device.
It should be noted that, in some possible embodiments, the electronic device may also send the first subscription message to one or more second devices of the N devices indirectly through the cloud platform.
Step 3032-I, the first device receives a first notification message sent by one or more second devices of the N second devices, where the first notification message is used to notify that an input parameter subscribed by the first device has changed.
In step 3032-I, the electronic device receives an input parameter variation notification message sent by one or more input devices. Note that, in the case where the plurality of input devices send notification messages, the input parameters in the plurality of input devices are changed within a preset time range. Here, the preset time range is a duration lasting from the time when the parameter change first occurs as a start point. The preset duration may be preset by the electronic device or may be actively set by the user, where the value of the preset duration is not limited, for example, may be 0 or 1ms.
Step 3033-I, 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.
In step 3033-I, the electronic device obtains values of all input parameters belonging to the same set of atoms in the second rule input from all input devices. In OCF, the notification message sent by the input device to the electronic device carries the updated value of the corresponding input parameter, so the electronic device may optionally need not acquire the value of the input parameter again from the input device that has sent the notification message. For other input devices that do not send notification messages to the electronic device, here, the value of the corresponding input parameter may be obtained through a read operation in the CRUDN operations.
II) the first rule input comprises at least one input parameter, and in case that the reference addresses of all input parameters in the at least one input parameter are located in the first device, the first device obtaining the values of all input parameters belonging to the same atom set in the second rule input comprises the following steps:
Step 3032-II, the first device receives a parameter value variation notification message of one or more input parameters on the first device.
In step 3032-II, the electronic device receives one or more parameter change notification messages entered on the device. It should be noted that, because all the input parameters referenced by the rule resource are on the electronic device, that is, are all local resources, the electronic device may, but is not limited to, receive the parameter value change message from the local resources in an active manner or in a request manner.
It should be noted that, in the case of a plurality of notification messages, a plurality of input parameters are changed within a preset time range. Here, the preset time range is a duration that is continued for a preset period of time starting from the time when the parameter change first occurs. The preset duration may be preset by the electronic device or may be actively set by the user, where the value of the preset duration is not limited, for example, may be 0 or 1ms.
And step 3033-II, the first device acquires the values of all input parameters belonging to the same atomic set in the second rule input from the first device.
In step 3033-II, the electronic device obtains 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 an updated value of the corresponding input parameter, the electronic device may not need to acquire the value of the input parameter of the sent notification message again. For other input devices that do not send notification messages, here, the value of the corresponding input parameter may be obtained by a read operation in CRUDN operations.
III) the first rule input comprises at least one input parameter, the reference address of a first part of input parameters in the at least one input parameter is located in N second devices, and in case that the reference address of a second part of input parameters is located in the first device, the first device obtains the values of all input parameters belonging to the same atom set in the second rule input, comprising the following steps:
Step 3031-III, the first device sends a first subscription message to each of the N second devices, wherein the first subscription message is used for subscribing the input parameters in the second devices.
In step 3031-III, the electronic device sends a subscription message to all input devices pointed to by the reference address based on the reference address of the input parameter invoked in the rule resource, for subscribing to the input parameter in the input device, and when any one of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
Optionally, after receiving the subscription message sent by the electronic device, the input device sends a subscription success notification message to the electronic device.
And step 3032-III, the first device receives one or more second devices in the N second devices and/or a notification message sent by the first device, wherein the notification message is used for notifying the first device that the invoked input parameters are changed.
In step 3032-III, the electronic device receives an input parameter variation notification message sent by one or more input devices and/or the electronic device itself. It should be noted that, in the case of receiving a plurality of notification messages, the input parameters in any of a plurality of devices are changed within a preset time range. Here, the preset time range is a duration that is continued for a preset period of time starting from the time when the parameter change first occurs. The preset duration may be preset by the electronic device or may be actively set by the user, where the value of the preset duration is not limited, for example, may be 0 or 1ms.
And step 3033-III, the first device acquires values of all input parameters belonging to the same atom set in the second rule input from the N second devices and the first device.
In step 3033-III, the electronic device obtains 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 is described in the above section and will not be described in detail here.
Preferably, the electronic device performs step 3033-III upon receiving the first notification message of the input parameter variation notification messages sent by the one or more input devices and/or the electronic device itself.
Corresponding to the foregoing step 302b, in step 303, the first device obtains values of all input parameters belonging to the same atom set in the second rule input, including step 3031b and step 3032b:
Step 3031b, the first device sends a second subscription message to the cloud platform, wherein the second subscription message is used for subscribing to the second rule input in the cloud platform. Correspondingly, the cloud platform receives a second subscription message sent by the first device.
Specifically, the electronic device sends a subscription message to the cloud platform, the subscription message being used to subscribe to a second rule input in the cloud platform. Accordingly, the cloud platform receives the subscription message sent by the electronic device.
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.
It should be noted that, after step 302b, the cloud platform sends, based on links pointing to all the input parameters in the second rule input, subscription messages to all the corresponding input devices and/or electronic devices, respectively, where the subscription messages are used to subscribe to all the input parameters in the second rule input.
Optionally, when sending a request message for creating the second rule input to the cloud platform, the electronic device instructs the cloud platform to actively subscribe to all input parameters in the second rule input. The indication may be implemented by adding a switch resource to the second rule input that sets the resource to "subscribe" when the second rule input is created. Yun Pingtai, upon which to perform a subscription request.
Optionally, the cloud platform actively subscribes to all input parameters in any resources of the second rule input type.
Optionally, the cloud platform subscribes to the input parameters in the corresponding second rule input indirectly to the device where the input parameters in the second rule input are located through other cloud platforms.
Optionally, the cloud platform receives a subscription success notification message sent by the input device and/or the electronic device.
Further, when the cloud platform receives the parameter value change notification message sent by the subscribed at least one arbitrary device earliest, the cloud platform acquires values of all input parameters belonging to the same atom set in the second rule input from all input devices and/or electronic devices. It should be noted that, the cloud platform may preferentially attempt to obtain values of all input parameters in the second rule input, and then determine whether the obtained values of all input parameters belong to at least one atom set in the second rule input.
For how the cloud platform determines whether all the values of the input parameters in the acquired second rule input belong to at least one atom set in the second rule input, the method can be implemented by the following steps:
The indication message is carried in a request for creating the second rule input, which is sent to the cloud platform by the electronic device, and the indication message is used for indicating the resource type of the second rule input, and in some possible implementation manners, the resource type of the second rule input belongs to an atomic resource. In other possible embodiments, the resource type of the second rule input is not an atomic resource, and further, the second rule input includes at least two atom sets, and the dividing manner of the different atom sets is described in detail above, which is not described herein.
It should be noted that, the electronic device may send an indication message to the cloud platform at any time, to change the resource type of the second rule input, or adjust the atom set to which any input parameter in the second rule input belongs. It should be further noted that, in the case where the second rule input includes at least two atom sets, preferably, in the case where the cloud platform cannot obtain values of all input parameters in the second rule input, but can obtain values of all input parameters in at least one atom set, the cloud platform sends the values of all input parameters belonging to the same atom set in the second rule input to the electronic device.
Specifically, the values of the respective input parameters in the second rule input in the cloud platform may be obtained by:
In case the reference addresses of all of the at least one input parameter are located in N second devices, obtaining the values of the respective input parameters of the second rule input from the N second devices, or
Acquiring values of respective input parameters in the second rule input from the first device in case that reference addresses of all input parameters of the at least one input parameter are located in the first device, or
The reference address of a first part of the at least one input parameter is located in N second devices, and the values of the respective input parameters in the second rule input are acquired from the N second devices and the first device in case that the reference address of the second part of the input parameter is located in the first device.
Specifically, in one example, the reference addresses of all input parameters in the at least one input parameter are located in N second devices, and the cloud platform obtains values of all input parameters belonging to the same atom set in the second rule input, and may include the following steps:
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 the input parameters in the second devices;
In step 401a, the cloud platform sends a subscription message to all input devices pointed to by the reference address based on the reference address of the input parameter called in the rule resource, the subscription message is used for subscribing the input parameter in the input device, and when any one of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the cloud platform.
Optionally, after receiving the subscription message sent by the cloud platform, the input device sends a subscription success notification message to the cloud platform.
Step 402a, the cloud platform receives a third notification message sent by one or more second devices in the N second devices, where the third notification message is used to notify the cloud platform that the input parameters subscribed by the cloud platform are changed;
In step 402a, the cloud platform receives an input parameter variation notification message sent by one or more input devices. Note that, in the case where the plurality of input devices send notification messages, the input parameters in the plurality of input devices are changed within a preset time range. Here, the preset time range is a duration that is continued for a preset period of time starting from the time when the parameter change first occurs. The preset duration may be preset by the electronic device or may be actively set by the user, where the value of the preset duration is not limited, for example, may be 0 or 1ms.
And 403a, the cloud platform acquires values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
In step 403a, the cloud platform obtains values of all input parameters belonging to the same atom set in the second rule input from all input devices. In the OCF, the notification message sent by the subscribed device to the subscribing device carries the updated value of the corresponding input parameter, so that, optionally, the cloud platform may not need to acquire the value of the input parameter from the input device that has sent the notification message again. For other input devices that do not send notification messages to the cloud platform, the values of the corresponding input parameters may be obtained through a read operation in the CRUDN operations.
In another example, where the reference address of all input parameters in the at least one input parameter is located in the first device, the cloud platform obtains values of all input parameters belonging to the same atom set in the second rule input, and may include the following steps:
Step 401b, the cloud platform sends a fourth subscription message to the first device, wherein the fourth subscription message is used for subscribing to input parameters in the first device;
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 the input parameters subscribed by the cloud platform are changed;
And 403b, the cloud platform acquires the values of all input parameters belonging to the same atomic set in the second rule input from the first device.
Steps 401b to 403b are performed similarly to steps 401a to 403a described above, and are not described here.
In another example, the reference address of a first part of input parameters in at least one input parameter is located in N second devices, the reference address of a second part of input parameters is located in the first device, and the cloud platform obtains values of all input parameters belonging to the same atom set in the second rule input, and may include the following steps:
Step 401c, the cloud platform sends a fifth subscription message to each of the N second devices and the first device, wherein the fifth subscription message is used for subscribing input parameters in the second device and the first device;
Step 402c, the cloud platform receives a fifth notification message sent by at least one second device and/or the first device of the N second devices, where the fifth notification message is used to notify that input parameters subscribed by the cloud platform are changed;
And 403c, the cloud platform acquires 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.
Steps 401c to 403c are performed similarly to steps 401a to 403a described above, and are not described here.
Step 3032b, the first device receives a second notification message sent by the cloud platform, where the second notification message is used to notify the first device that a second rule input subscribed by the first device changes, and the second notification message carries values of all input parameters belonging to the same atom set in the second rule input. Correspondingly, the cloud platform sends a second notification message to the first device.
Specifically, the electronic device receives a notification message sent by the cloud platform, where the notification message is used to notify the electronic device that the second rule input subscribed to by the electronic device has changed. Accordingly, the cloud platform sends the notification message to the electronic device.
It should be appreciated that for the case where the second rule input contains at least two atom sets, if the electronic device indicates a particular subscription rule in the second subscription message, the cloud platform will send the corresponding atom set in the second rule input as indicated by the electronic device. For example, if the subscription message sent to the cloud platform and subscribed to the second rule input carries the priority of the atom set in the second rule input, the cloud platform will send the atom set with high priority to the electronic device in the case that the values of the input parameters of the atom sets in the second rule input are acquired simultaneously.
Optionally, the notification message is used to notify the electronic device that the values of all input parameters belonging to the same atom set in the second rule input subscribed to have been obtained.
In the monitoring operation (observe) of the OCF, the second notification message sent by the cloud platform to the electronic device may carry updated values of all input parameters belonging to the same atomic set in the second rule input, so that, optionally, after receiving the second notification message sent by the cloud platform and carrying values of all input parameters belonging to the same atomic set in the second rule input, the electronic device may directly obtain the values of all input parameters belonging to the same atomic set from the second notification message.
In another alternative, the second notification message does not carry the values of all the input parameters belonging to the same atom set in the second rule input, and for this case, the first device needs to further acquire the values of all the input parameters belonging to the same atom set in the second rule input from the cloud platform through an acquisition message.
In an embodiment of the present application, optionally, after step 303, the rule processing method may further include step 305:
Step 305, the first device clears all input parameter values in the second rule input.
Specifically, after the rule resource finishes calculation, the electronic device clears all the values of the input parameters in the second rule input, and waits for the next assignment to the second rule input.
In the present application, a second rule input is created based on the first rule input, and the values of the input parameters used to determine the result of the rule expression are derived from the values of all input parameters belonging to the same atom set in the acquired second rule input. For the same set of atoms in the second rule input, each read or write operation must include the values of all input parameters corresponding thereto. Therefore, the problem that the rule input from each device cannot be uniformly perceived by the device where the rule is located in the related technology can be solved, and the problem that the prior art architecture cannot contain remote input resources can be solved, so that the effects of expanding input resource sources, reducing the false triggering rate of the rule and improving the rule execution accuracy are achieved.
The following description of the technology of embodiment 1 of the present application is given by way of example with reference to fig. 5 and 6, and it should be noted that the following application examples are only an alternative of the present application, and are not limited to the scope of the embodiments of the present application. The scenario in fig. 5 is illustrated by way of example in which the first device creates the second rule input, and the scenario in fig. 6 is illustrated by way of example in which the cloud platform creates the second rule input.
Example one:
The first rule input includes at least one input parameter, reference addresses for all of the at least one input parameter being located at the N input devices. The electronic equipment subscribes to the input parameters on each input equipment, updates the input parameters to the second rule input after receiving the parameter change notification message, then brings the input parameters into the rule expression, and notifies the action equipment to execute corresponding actions if the judgment result is true. The electronic device to be described 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, and the resource representing the second rule input belongs to the atomic resource. As shown in fig. 5, the specific process includes the following steps:
Step 501, the electronic device creates a rule resource.
Specifically, the electronic device creates rule resources including a first rule input set resource, a rule expression resource, and a rule behavior set resource.
Step 502. The electronic device creates a second rule input atomic resource based on the first rule input set resource.
Specifically, the electronic device creates a second rule input atomic resource based on links of the first rule input set resource to all input resources, where 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.
It should be noted that, step 502 may also be performed after step 505.
Step 503, the electronic device sends a first subscription message to each of all input devices, wherein the first subscription message is used for subscribing to input parameters in the input devices.
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, the subscription message is used for subscribing the input parameter in the input device, and when any one of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
Optionally, step 503 may be followed by the input device sending a subscription success response message to the electronic device.
In step 504, one of all the input devices sends a first notification message to the electronic device, where the first notification message is used to notify the electronic device that the subscribed input parameters change.
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 a first notification message to the electronic device, which refers to an input device corresponding to an input parameter that changes first in all the subscribed input parameters. It should be noted that, for the present example, the first-changed input parameter may refer to the first-changed input parameter after the input parameters are successfully subscribed to all the input devices.
Step 505, after receiving the first notification message, the electronic device actively acquires values of other input parameters under the condition that the second rule input atomic resource contains a plurality of input parameters.
Specifically, after receiving a first notification message, the electronic device includes a plurality of input parameters in the second rule input atomic resource. A read request is sent to the input device corresponding to the other input parameters except the input parameters contained in the first notification message, and the value of each input parameter is requested to be obtained. It is of course also possible that multiple input parameters exist for the same input device.
It should be noted that, in the OCF, the notification message sent by the input device to the electronic device carries the updated value of the corresponding input parameter, so optionally, the electronic device may not need to obtain the value of the input parameter from the input device that has sent the notification message again.
And step 506, the electronic equipment stores the obtained values of all the input parameters into the second rule input atomic resource, and determines the result of the rule expression based on the values of all the input parameters in the second rule input atomic resource.
Specifically, the electronic device obtains values of all input parameters in the second rule input atomic resource, assigns the obtained values of all input parameters to the rule expression for calculation, and the assignment operation can be realized through internal subscription or other realization means, and the rule expression obtains a judgment result.
Step 507, the electronic device clears all input parameter values in the second rule input atomic resource.
Specifically, after the rule expression calculation is completed, values of all input parameters of the second rule input atomic resource are cleared.
It should be noted that step 507 may be performed after step 508.
Step 508, the electronic device determines whether to execute the rule action according to the calculation result of the rule expression.
Specifically, when any Rule input resource is updated to the Rule expression and the Rule Enable determination is true, the electronic device proceeds with the boolean value Rule result (Boolean Rule Result) determination.
Step 509, if the rule result is true, executing the rule action.
Specifically, when the boolean rule result is changed from false (false) to true, and the Action Enable is also true, the electronic device configures the last event (LAST SCENE) in the event collection resource to be an event value (scene value) in the rule Action collection resource through links in the rule Action collection resource referencing the event collection resource.
In the present application, a second rule input is created based on the first rule input, and the values of the input parameters used to determine the result of the rule expression are derived from the values of all input parameters belonging to the same atom set in the acquired second rule input. For the same set of atoms in the second rule input, each read or write operation must include the values of all input parameters corresponding thereto. Therefore, the problem that the rule input from each device cannot be uniformly perceived by the device where the rule is located in the related technology can be solved, and the problem that the prior art architecture cannot contain remote input resources can be solved, so that the effects of expanding input resource sources, reducing the false triggering rate of the rule and improving the rule execution accuracy are achieved.
Example two:
The first rule input includes at least one input parameter, reference addresses for all of the at least one input parameter being located at the N input devices. The cloud platform establishes a second rule input based on the request of the electronic equipment, subscribes input parameters on each input equipment, updates the input parameters to the second rule input after receiving the parameter change notification message, then notifies the electronic equipment, brings the second rule input into a rule expression, and notifies the action equipment to execute corresponding actions if the judgment result is true. The electronic device to be described corresponds to a first device in the embodiment of the present application, the input device corresponds to a second device in the embodiment of the present application, and the input device may be a local device or a remote device, and the second rule input is an atomic resource. As shown in fig. 6, the specific flow includes the following steps:
Step 601, the electronic device creates a rule resource.
Specifically, the electronic device creates a new rule resource including a first rule input set resource, a rule expression resource, and a rule behavior set resource.
Optionally, following step 601, the electronic device further comprises determining whether the first rule input set resource includes a resource link other than the electronic device.
Step 602, the electronic device sends a request message for creating a second rule input atomic resource to the cloud platform.
Specifically, the electronic device sends a request to the cloud platform to create a second rule input atomic resource, where the second rule input atomic resource includes all input parameters corresponding to all input resources referenced by the first rule input set resource, and it should be understood that all input parameters referred to herein do not include input parameters within the input resources that are not related to the rule resources. The second rule input atomic resource is characterized as a non-aggregate resource, in which reference addresses (links) of all input parameters referenced by the rule resource are not saved. It should be noted that, in the subsequent step of determining the variation of the input parameter, when the cloud platform needs to send a subscription message to the input device, the links used may be that the electronic device actively sends the links stored in the first rule input set resource to the cloud platform, or the cloud platform actively obtains the links stored in the first rule input set resource in the electronic device, or may be implemented in other implementation manners, which is not limited in the present 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 of the rule resource call.
Step 603, the cloud platform creates a second rule input atomic resource.
Optionally, after step 603, the cloud platform further includes sending a response message to the electronic device, where the response message is used to indicate that the second rule input atomic resource creation is complete.
Step 604, the electronic device subscribes to the cloud platform for a second rule input atomic resource.
Optionally, after step 604, the cloud platform further includes sending a response message to the electronic device, where the response message is used to indicate that the subscription of the second rule input atomic resource is completed.
Step 605, a first subscription message is sent to each of all input devices, wherein the first subscription message is used for subscribing all input parameters in the second rule input atomic resource.
Specifically, the cloud platform sends a subscription message to all input devices based on the reference address of the input parameter called in the obtained rule resource, the subscription message is used for subscribing the input parameter in the input device, and when any one of the subscribed input parameters changes, the corresponding input device needs to send a notification message to the electronic device.
Optionally, after step 605, the method further includes sending a subscription success response message to the cloud platform by all subscribed input devices.
Step 606, one or more of all input devices sends a first notification message to the electronic device, the first notification message being used to notify the electronic device that the subscribed input parameters have changed.
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 a first notification message to the electronic device, which refers to an input device corresponding to an input parameter that changes first in all the subscribed input parameters. It should be noted that, for the present example, the first-changed input parameter may refer to the first-changed input parameter after the input parameters are successfully subscribed to all the input devices. And under the condition that the plurality of input devices send notification messages to the cloud platform, the input parameters in the plurality of input devices are changed within a preset time range correspondingly. Here, the preset time range is a duration that is continued for a preset period of time starting from the time when the parameter change first occurs. The preset duration may be preset by the electronic device or may be actively set by the user, where the value of the preset duration is not limited, for example, may be 0 or 1ms.
In step 607, the cloud platform obtains values of all input parameters in the second rule input atomic resource.
Specifically, the cloud platform obtains values of all input parameters in the second rule input from all input devices. In the OCF, the notification message sent by the input device to the cloud platform may carry the updated value of the corresponding input parameter, so optionally, the cloud platform may not need to acquire the value of the input parameter from the input device that has sent the notification message again. For other input devices that do not send notification messages to the cloud platform, the values of the corresponding input parameters may be obtained through a read operation in the CRUDN operations.
In 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 the second rule input atomic resource subscribed to by the electronic device has changed.
Specifically, in the monitoring operation (observe) of the OCF, the notification message sent by the cloud platform to the electronic device may carry the updated value of the second rule input atomic resource.
Step 609, the electronic device substitutes the obtained values of all input parameters in the second rule input atomic resource into the rule expression, and determines the result of the rule expression.
Specifically, the electronic device assigns values of all input parameters in the acquired second rule input atomic resource to the rule expression for calculation, the assignment operation can be realized through internal subscription or other realization means, and the rule expression obtains a judgment result.
Step 610, the electronic device clears the values of all input parameters in the second rule input atomic resource.
Specifically, after the rule expression calculation is completed, values of all input parameters of the second rule input atomic resource are cleared.
It should be noted that, step 610 may also be performed after step 611.
Step 611, according to the calculation result of the rule expression, the electronic device determines whether to execute the rule action.
Specifically, when any Rule input resource is updated to the Rule expression and the Rule Enable determination is true, the electronic device proceeds with the boolean value Rule result (Boolean Rule Result) determination.
Step 612, if the rule result is true, executing the rule action.
Specifically, when the boolean rule result is changed from false (false) to true, and the Action Enable is also true, the electronic device configures the last event (LAST SCENE) in the event collection resource to be an event value (scene value) in the rule Action collection resource through links in the rule Action collection resource referencing the event collection resource.
In the present application, a second rule input is created based on the first rule input, and the values of the input parameters used to determine the result of the rule expression are derived from the values of all input parameters belonging to the same atom set in the acquired second rule input. For the same set of atoms in the second rule input, each read or write operation must include the values of all input parameters corresponding thereto. Therefore, the problem that the rule input from each device cannot be uniformly perceived by the device where the rule is located in the related technology can be solved, and the problem that the prior art architecture cannot contain remote input resources can be solved, so that the effects of expanding input resource sources, reducing the false triggering rate of the rule and improving the rule execution accuracy are achieved.
Fig. 7 is a schematic structural diagram of a rule processing apparatus according to an embodiment of the present application, which is applied to a first device, as shown in fig. 7, and the rule processing apparatus includes:
A first creating unit 701, configured to create a first rule, where the first rule includes a first rule input, a rule expression, and a rule behavior, and the first rule input is used for the device or the cloud platform to create a second rule input;
An obtaining unit 702, configured to obtain values of all input parameters belonging to the same atom set in the second rule input;
A determining unit 703 for determining the result of the rule expression based on the values of all the input parameters, and determining whether to execute the rule behavior based on the result of the expression.
In one embodiment, the first rule input includes at least one input parameter, wherein,
The reference addresses of all of the at least one input parameter are located at N second devices, N being a positive integer, or
The reference addresses of all of the at least one input parameter being located at the device, or
The reference addresses of a first part of the input parameters in the at least one input parameter are located in N second devices, the reference addresses of a second part of the input parameters are located in the device, and N is a positive integer.
In an embodiment, the rule processing apparatus further includes:
a second creating unit 704, 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.
In an embodiment, the obtaining unit is configured to send a first subscription message to each of the N second devices when the reference addresses of all input parameters in the at least one input parameter are located in the N second devices, where the first subscription message is used to subscribe to the input parameters in the second devices, receive a first notification message sent by one or more second devices in the N second devices, where the first notification message is used to notify that the input parameters subscribed by the apparatus are changed, and obtain values of all input parameters belonging to the same atomic set in the second rule input from the N second devices.
In an embodiment, the rule processing apparatus further includes:
The request unit 705 is configured to send a creation request message to a cloud platform, where 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.
In an embodiment, the obtaining unit is configured to send 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, where the second notification message is used to notify the device that the subscribed second rule input changes, and the second notification message carries values of all input parameters belonging to the same atom set in the second rule input.
In an embodiment, the values of the respective input parameters in the second rule input in the cloud platform are obtained by:
In case the reference addresses of all of the at least one input parameter are located in N second devices, obtaining the values of the respective input parameters of the second rule input from the N second devices, or
In case the reference addresses of all of the at least one input parameter are located at the device, obtaining values of the respective input parameters in the second rule input from the device, or
The reference address of a first part of the at least one input parameter is located at N second devices, and the reference address of a second part of the input parameter is located at the apparatus, values of respective input parameters in the second rule input are obtained from the N second devices and the apparatus.
In an embodiment, all input parameters in the second rule input belong to the same atomic set.
In an embodiment, all input parameters in the second rule input are partitioned into at least two atom sets based on the rule expression.
In an embodiment, if the expression has a first logical operator, and the first logical operator belongs to a first level logical operator, input parameters on two sides of the first logical operator belong to different atom sets, where the first logical operator refers to an or operator.
In one embodiment, the first rule input belongs to a collective resource type and the second rule input belongs to a non-collective resource type, or the first rule input and the second rule input both belong to a collective resource type.
In an embodiment, the rule processing apparatus further includes:
and a clearing unit 706, configured to clear values of all input parameters in the second rule input.
Those skilled in the art will appreciate that the implementation functions of the units in the rule processing arrangement shown in fig. 7 can be understood with reference to the relevant description of the rule processing method. The functions of the respective modules in the rule processing means shown in fig. 7 may be realized by a program running on a processor or by a specific logic circuit.
Fig. 8 is a schematic diagram ii of the structural composition of a rule processing device according to an embodiment of the present application, which is applied to a cloud platform, as shown in fig. 8, where the rule processing device includes:
A creating unit 801, configured to receive a creation request message sent by a first device, and create a second rule input based on the creation request message, where the second rule input includes all input parameters of a first rule input, where 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 obtaining unit 802, configured to obtain values of all input parameters belonging to the same atom set in the second rule input;
A sending unit 803, configured to send, to the first device, values of all input parameters belonging to the same atom set in the second rule input;
Wherein values of all input parameters belonging to the same set of atoms in the second rule input are used by the first device to determine a result of the rule expression and to determine whether to execute the rule behavior based on the result of the expression.
In one embodiment, the first rule input includes at least one input parameter, wherein,
The reference addresses of all of the at least one input parameter are located at N second devices, N being a positive integer, or
The reference addresses of all of the at least one input parameter are located at the first device, or
The reference addresses of a first part of the input parameters in the at least one input parameter are located in N second devices, the reference addresses of a second part of the input parameters are located in the first devices, and N is a positive integer.
In an embodiment, the obtaining unit is configured to send a third subscription message to each of the N second devices when the reference addresses of all input parameters in the at least one input parameter are located in the N second devices, where the third subscription message is used to subscribe to the input parameters in the second devices, receive a third notification message sent by one or more second devices in the N second devices, where the third notification message is used to notify that the input parameters subscribed by the cloud platform are changed, and obtain values of all input parameters belonging to the same atom set in the second rule input from the N second devices.
In an embodiment, the obtaining unit is configured 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, where the fourth subscription message is used for subscribing to the input parameters in the first device, receive a fourth notification message sent by the first device, where the fourth notification message is used for notifying that the input parameters subscribed by the cloud platform have changed, and obtain values of all input parameters belonging to the same atom set in the second rule input from the first device.
In an embodiment, the obtaining unit is configured to send a fifth subscription message to each of the N second devices and the first device 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, where 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 of the N second devices and/or the first device, and the fifth notification message is used to notify that the input parameters subscribed by the cloud platform are changed, and obtain values of all the input parameters belonging to the same atom set in the second rule input from the N second devices and the first device.
In an implementation mode, the sending unit is used for receiving a second subscription message sent by the first device, wherein the second subscription message is used for subscribing to the second rule input in the cloud platform, sending a second notification message to the first device, and the second notification message is used for notifying the first device that the subscribed second rule input changes, and the second notification message carries values of all input parameters belonging to the same atom set in the second rule input.
In an embodiment, all input parameters in the second rule input belong to the same atomic set.
In an embodiment, all input parameters in the second rule input are partitioned into at least two atom sets based on the rule expression.
In an embodiment, if the expression has a first logical operator, and the first logical operator belongs to a first level logical operator, input parameters on two sides of the first logical operator belong to different atom sets, where the first logical operator refers to an or operator.
In one embodiment, the first rule input belongs to a collective resource type and the second rule input belongs to a non-collective resource type, or the first rule input and the second rule input both belong to a collective resource type.
Those skilled in the art will appreciate that the implementation functions of the units in the rule processing apparatus shown in fig. 8 can be understood with reference to the related description of the rule processing method. The functions of the respective modules in the rule processing means shown in fig. 8 may be realized by a program running on a processor or by a specific logic circuit.
Fig. 9 is a schematic block diagram of an electronic device 900 according to an embodiment of the present application. The electronic device 900 shown in fig. 9 comprises a processor 910, from which the processor 910 may call and run a computer program to implement the method in an embodiment of the application.
Optionally, as shown in fig. 9, the electronic device 900 may also include a memory 920. Wherein the processor 910 may invoke and run a computer program from the memory 920 to implement the method in the embodiments of the present application.
Wherein the memory 920 may be a separate device from the processor 910 or may be integrated in the processor 910.
Optionally, as shown in fig. 9, the electronic device 900 may further include a transceiver 930, and the processor 910 may control the transceiver 930 to communicate with other devices, and in particular, may send information or data to other devices, or receive information or data sent by other devices.
Wherein transceiver 930 may include a transmitter and a receiver. Transceiver 930 may further include antennas, the number of which may be one or more.
Optionally, the electronic device 900 includes a rule processing apparatus according to the embodiment of the present application, and the electronic device 900 may implement a corresponding flow implemented by the rule processing apparatus in each method according to the embodiment of the present application, which is not described herein for brevity.
Alternatively, the electronic device 900 may be the first device (i.e., a rule device) in the methods of embodiments of the present application.
Alternatively, the electronic device 900 may be any of the second devices (i.e., input devices) of the various methods of embodiments of the present application.
Alternatively, the electronic device 900 may be a cloud platform in the methods of embodiments of the present application.
Fig. 10 is a schematic structural view of a chip of an embodiment of the present application. The chip 1000 shown in fig. 10 includes a processor 1010, and the processor 1010 may call and run a computer program from a memory to implement the method in the embodiment of the present application.
Optionally, as shown in fig. 10, the chip 1000 may further include a memory 1020. Wherein the processor 1010 may call and run a computer program from the memory 1020 to implement the methods in embodiments of the present application.
The memory 1020 may be a separate device from the processor 1010 or may be integrated into the processor 1010.
Optionally, the chip 1000 may also include an input interface 1030. The processor 1010 may control the input interface 1030 to communicate with other devices or chips, and in particular, may obtain information or data sent by the other devices or chips.
Optionally, the chip 1000 may further include an output interface 1040. Wherein the processor 1010 may control the output interface 1040 to communicate with other devices or chips, and in particular, may output information or data to other devices or chips.
Optionally, the chip may be applied to the electronic device in the embodiment of the present application, and the chip may implement a corresponding flow implemented by the electronic device in each method in the embodiment of the present application, which is not described herein for brevity.
It should be understood that the chips referred to in the embodiments of the present application may also be referred to as system-on-chip chips, or the like.
The embodiment of the application also provides a computer readable storage medium for storing a computer program.
Optionally, the computer readable storage medium may be applied to the electronic device in the embodiment of the present application, and the computer program causes a computer to execute a corresponding flow implemented by the electronic device in each method of the embodiment of the present application, which is not described herein for brevity.
The embodiment of the application also provides a computer program product comprising computer program instructions.
Optionally, the computer program product may be applied to an electronic device in the embodiment of the present application, and the computer program instructions cause the computer to execute a corresponding flow implemented by the electronic device in each method in the embodiment of the present application, which is not described herein for brevity.
The embodiment of the application also provides a computer program.
Optionally, the computer program may be applied to the electronic device in the embodiment of the present application, and when the computer program runs on a computer, the computer is caused to execute a corresponding flow implemented by the electronic device in each method in the embodiment of the present application, which is not described herein for brevity.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of 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.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.