Patent Description:
Machine-to-machine communications (Machine-to-Machine Communications, M2M for short hereinafter) is a networked application and service centering on intelligent machine-to-machine interaction. By embedding a wireless or wired communications module and application processing logic in a machine, the M2M implements data communication without manual intervention, so as to meet informatization requirements of users in aspects of monitoring, commanding and scheduling, data collection and measurement, and the like. In a conventional typical M2M application network architecture, various M2M terminals (such as a sensor and a microcontroller) access an M2M service platform directly or remotely by using an M2M gateway, while various M2M applications (such as electricity meter reading and intelligent traffic) retrieve, with a service capability provided by the M2M service platform, data collected by the M2M terminals, or perform remote control and management on the M2M terminals.

The European Telecommunications Standards Institute (European Telecommunication Standardization Institute, ETSI for short hereinafter) M2M uses a RESTful architecture. REST, an acronym for Representational State Transfer, means "representational state transfer". If an architecture is based on REST, the architecture is referred to as a RESTful architecture. Its characteristic is that everything is made up of resources (Resource), where a resource is a text segment existing in a network or is in multiple other media forms. Each resource has a unique uniform resource identifier (Uniform Resource Identifier, URI for short hereinafter). An application program or service capability middleware may access the resource by using the URI. Each resource is accessed in fixed manners, including manners such as create (Create), update (Update), delete (Delete), and retrieve (Retrieve). In addition, in the RESTful architecture, a client and a server are both stateless.

In an M2M system, the following scenario exists extensively: When a status of a device changes, another device or multiple devices may perform a single operation or a series of operations according to whether the change meets a condition. In the prior art, the action of foregoing operation triggering is implemented by an application program installed on a specific device (such as a device that directly performs the operations). However, in some restricted environments, the device needs to go to sleep periodically, and the application program is interrupted as the device goes to sleep; consequently, operations between resources cannot be triggered. In some scenarios in which the device needs to be offline and used outdoors, a service of the application program is interrupted as the device is offline. Therefore, in the M2M system in the prior art, operation triggering by using the application program suffers from a disadvantage of poor stability.

Document D1 (<NPL>) discloses a set of proposed Application Programming Interfaces (APIs) to interact with our new OpenMTC framework at FOKUS.

Document D2 (<NPL>) discloses the overall end to end M2M functional architecture, including description of the functional entities, the related reference points and the service capabilities; M2M identifiers, information model; procedures for bootstrapping, security, and management; charging; and implementation guidance.

Embodiments of the present invention provide an operation triggering method and apparatus for machine-to-machine communications to improve stability of operation triggering in an M2M system.

The scope of the present invention is set out by the appended claims. Embodiments of the description, which are not covered by the claims are provided as examples helpful for understanding the invention.

A first aspect of the present invention provides an operation triggering method for machine-to-machine communications, where service capability middleware stores a representation of a subject resource, where the representation of the subject resource includes content of the subject resource and information about an operation resource associated with the subject resource, and the method includes:.

With reference to the first aspect of the present invention, in a first possible implementation manner, the information about the operation resource associated with the subject resource is the representation of the operation resource associated with the subject resource, and the retrieving, by the service capability middleware according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource, includes: retrieving, by the service capability middleware according to the representation, included in the representation of the subject resource, of the operation resource associated with the subject resource, the representation of the operation resource associated with the subject resource; or.

With reference to the first aspect of the present invention or the first possible implementation manner, in a second possible implementation manner, before the retrieving, by the service capability middleware, a change result of the content of the subject resource stored in the service capability middleware, the method further includes:.

With reference to the first aspect or the first or second possible implementation manner, in a third possible implementation manner, the representation of the operation resource further includes a type of the operation request and an input parameter of the operation request, where the type of the operation request is create or update; and
when the input parameter is a uniform resource identifier of a parameter resource, the constructing the operation request for the object resource includes:.

With reference to the first aspect or any one of the first to the third possible implementation manners, in a fourth possible implementation manner, before the retrieving, by the service capability middleware, a change result of the content of the subject resource stored in the service capability middleware, the method further includes:.

With reference to the fourth possible implementation manner, in a fifth possible implementation manner, before the constructing, by the service capability middleware, the operation request for the object resource, the method includes:.

With reference to the fifth possible implementation manner, in a sixth possible implementation manner, types of the dependency resource are classified into a sufficient condition type and a necessary condition type, a dependency resource quantity is at least one, and before the constructing, by the service capability middleware, the operation request for the object resource in the representation of the operation resource, the method further includes:.

With reference to the fifth possible implementation manner, in a seventh possible implementation manner, the retrieving, by the service capability middleware according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, includes:.

With reference to the first aspect or any one of the foregoing possible implementation manners, in an eighth possible implementation manner, it is determined that at least two operation resources are associated with the subject resource, where representations of the operation resources further include priorities, and the constructing, by the service capability middleware, the operation request for the object resource in the representation of the operation resource, includes:
constructing, by the service capability middleware, an operation request for an object resource in the representation of each operation resource in sequence according to the priorities in the representations of the operation resources.

With reference to the first aspect or any one of the foregoing possible implementation manners, in a ninth possible implementation manner, the representation of the operation resource further includes an operation execution result, and the method further includes:.

A second aspect of the present invention provides an operation triggering apparatus for machine-to-machine communications, including a retrieving module, a constructing module, and a sending module, where:.

With reference to the second aspect of the present invention, in a first possible implementation manner,.

With reference to the second aspect of the present invention or the first possible implementation manner, in a second possible implementation manner, the apparatus further includes a receiving module, where the receiving module is configured to receive a subject resource update request before the retrieving module retrieves the change result of the content of the subject resource stored in the apparatus, where the subject resource update request includes a representation of a new subject resource and a uniform resource identifier of the subject resource to be updated, where the representation of the new subject resource includes information about an operation resource associated with the new subject resource, and the receiving module updates the stored representation of the subject resource to the representation of the new subject resource according to the uniform resource identifier of the subject resource to be updated; or
the receiving module is configured to receive an operation resource create request before the retrieving module retrieves the change result of the content of the subject resource stored in the apparatus, where the operation resource create request includes the representation of the operation resource associated with the subject resource and the uniform resource identifier of the operation resource set to which the operation resource belongs, and the receiving module adds the representation of the operation resource to the operation resource set according to the uniform resource identifier of the operation resource set to which the operation resource belongs.

With reference to the second aspect or the first or second possible implementation manner, in a third possible implementation manner, the representation of the operation resource further includes a type of the operation request and an input parameter of the operation request, where the type of the operation request is create or update; and.

With reference to the second aspect or any one of the first to the third possible implementation manners, in a fourth possible implementation manner, the receiving module is further configured to receive an operation resource update request before the retrieving module retrieves the change result of the content of the subject resource stored in the service capability middleware, where the operation resource update request includes a representation of a new operation resource, where the representation of the new operation resource includes a representation of a dependency resource or a uniform resource identifier of a dependency resource, and is configured to update the stored representation of the operation resource to the representation of the new operation resource; or
the receiving module is further configured to receive a dependency resource create request before the retrieving module retrieves the change result of the content of the subject resource stored in the service capability middleware, where the dependency resource create request includes a representation of a dependency resource and a uniform resource identifier of a dependency resource set to which the dependency resource belongs, and is configured to save the representation of the dependency resource to the dependency resource set according to the uniform resource identifier of the dependency resource set to which the dependency resource belongs, and add the uniform resource identifier of the dependency resource set to the representation of the operation resource.

With reference to the fourth possible implementation manner, in a fifth possible implementation manner, the apparatus may further include a determining module, where the retrieving module is further configured to retrieve, according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, retrieve a representation of a condition resource that is pointed to by a uniform resource identifier in the representation of the dependency resource, and send the representation of the condition resource and a condition in the representation of the dependency resource to the determining module; and
the determining module is configured to receive the representation of the condition resource, and determine, according to the representation of the condition resource, that the condition in the representation of the dependency resource is met.

With reference to the fifth possible implementation manner, in a sixth possible implementation manner, types of the dependency resource are classified into a sufficient condition type and a necessary condition type, and a dependency resource quantity is at least one; and before the constructing module constructs the operation request for the object resource in the representation of the operation resource, the determining module is further configured to determine that a condition specified by at least one dependency resource of the sufficient condition type is met; or
before the constructing module constructs the operation request for the object resource in the representation of the operation resource, the determining module is further configured to determine that conditions specified by all dependency resources of the necessary condition type are met, and the service capability middleware constructs the operation request for the object resource in the representation of the operation resource.

With reference to the fifth possible implementation manner, in a seventh possible implementation manner, that the retrieving module may further retrieve, according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, is specifically:.

With reference to the second aspect or any one of the foregoing possible implementation manners, in an eighth possible implementation manner, it is determined that at least two operation resources are associated with the subject resource, that is, in the operation triggering apparatus for machine-to-machine communications, at least two operation resources are associated with the subject resource, representations of the operation resources further include priorities, and that the constructing module constructs the operation request for the object resource in the representation of the operation resource is specifically: constructing an operation request for an object resource in the representation of each operation resource in sequence according to the priorities in the representations of the operation resources.

With reference to the second aspect or any one of the foregoing possible implementation manners, in a ninth possible implementation manner, the representation of the operation resource further includes an operation execution result, and the receiving module is further configured to receive an operation response returned by the device in which the object resource is located, and save the operation response into the operation execution result in the representation of the operation resource; or.

A third aspect of the present invention provides another operation triggering apparatus for machine-to-machine communications, including a network interface, a processor, and a memory, where:.

With reference to the third aspect of the present invention, in a first possible implementation manner, the information about the operation resource associated with the subject resource is the representation of the operation resource associated with the subject resource, and that the processor retrieves, according to the representation of the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the representation of the operation resource included in the representation of the subject resource, the representation of the operation resource associated with the subject resource; or.

With reference to the third aspect of the present invention or the first possible implementation manner, in a second possible implementation manner, the network interface is further configured to receive a subject resource update request, where the subject resource update request includes a representation of a new subject resource and a uniform resource identifier of the subject resource to be updated, where the representation of the new subject resource includes information about an operation resource associated with the new subject resource, and the processor invokes the application program stored in the memory to update the stored representation of the subject resource to the representation of the new subject resource according to the uniform resource identifier of the subject resource to be updated; or
the network interface is further configured to receive an operation resource create request, where the operation resource create request includes the representation of the operation resource associated with the subject resource and the uniform resource identifier of the operation resource set to which the operation resource associated with the subject resource belongs, and the processor invokes the application program stored in the memory to add the representation of the operation resource to the operation resource set according to the uniform resource identifier of the operation resource set to which the operation resource belongs.

With reference to the third aspect or the first or second possible implementation manner, in a third possible implementation manner, the representation of the operation resource further includes a type of the operation request and an input parameter of the operation request, where the type of the operation request is create or update; and.

With reference to the third aspect or any one of the first to the third possible implementation manners, in a fourth possible implementation manner, the network interface is further configured to receive an operation resource update request, where the operation resource update request includes a representation of a new operation resource, where the representation of the new operation resource includes a representation of a dependency resource or a uniform resource identifier of a dependency resource, and the processor invokes the application program stored in the memory to update the stored representation of the operation resource to the representation of the new operation resource; or
the network interface is further configured to receive a dependency resource create request, where the dependency resource create request includes a representation of a dependency resource and a uniform resource identifier of a dependency resource set to which the dependency resource belongs, and the processor invokes the application program stored in the memory to save the representation of the dependency resource to the dependency resource set according to the uniform resource identifier of the dependency resource set to which the dependency resource belongs, and add the uniform resource identifier of the dependency resource set to the representation of the operation resource.

With reference to the fourth possible implementation manner, in a fifth possible implementation manner, the processor further retrieves, according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, retrieves a representation of a condition resource that is pointed to by a uniform resource identifier in the representation of the dependency resource, and determines, according to the representation of the condition resource, that a condition in the representation of the dependency resource is met.

With reference to the fifth possible implementation manner, in a sixth possible implementation manner, types of the dependency resource are classified into a sufficient condition type and a necessary condition type, a dependency resource quantity is at least one, and before constructing the operation request for the object resource in the representation of the operation resource, the processor further determines that a condition specified by at least one dependency resource of the sufficient condition type is met, or
determines that conditions specified by all dependency resources of the necessary condition type are met.

With reference to the fifth possible implementation manner, in a seventh possible implementation manner, the processor retrieves, according to the representation of the dependency resource included in the representation of the operation resource, the representation of the dependency resource associated with the operation resource; or retrieves, according to the uniform resource identifier of the dependency resource included in the representation of the operation resource, the representation of the dependency resource associated with the operation resource; or retrieves, according to the uniform resource identifier, included in the representation of the operation resource, of the dependency resource set to which the dependency resource belongs, the representation of the dependency resource associated with the operation resource, where the representation of the dependency resource associated with the operation resource is a representation of a dependency resource included in the dependency resource set.

With reference to the third aspect or any one of the foregoing possible implementation manners, in an eighth possible implementation manner, at least two operation resources are associated with the subject resource, representations of the operation resources further include priorities, and the processor constructs an operation request for an object resource in the representation of each operation resource in sequence according to the priorities in the representations of the operation resources.

With reference to the third aspect or any one of the foregoing possible implementation manners, in a ninth possible implementation manner, the representation of the operation resource further includes an operation execution result, the network interface is further configured to receive an operation response returned by the device in which the object resource is located, and the processor saves the operation response into the operation execution result in the representation of the operation resource; or
the representation of the operation resource further includes an address reflecting an operation execution result and the operation execution result, the network interface is further configured to receive an operation response returned by the device that the object resource is located, and the processor retrieves, according to the address reflecting the operation execution result, an operation result corresponding to the operation request, and saves the operation result corresponding to the operation request into the operation execution result.

The service capability middleware in the foregoing embodiments of the present invention may be middleware on an M2M platform or a gateway. Both the M2M platform and the gateway are nodes having capabilities in a network, and therefore a problem of capability restriction does not exist, which is advantageous for handling situations in which services cannot be performed in restricted environments. In addition, in the foregoing embodiments of the present invention, the representation of the operation resource associated with the subject resource can be retrieved according to the representation of the subject resource, so that operation triggering relationships between resources may be distributed on each node (the M2M platform or the gateway), thereby avoiding complexity of a single application program. The technical solutions provided by the foregoing embodiments of the present invention can enhance capabilities of the middleware on the M2M platform and the gateway, so that it is possible to deploy richer applications. Introduction of the operation resource makes operation triggering more applicable to a RESTful architecture.

To describe the technical solutions in the embodiments of the present invention or in the prior art more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments or the prior art. Apparently, the accompanying drawings in the following description show some embodiments of the present invention, and persons of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.

To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following clearly and completely describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

In view of disadvantages of a high maintenance cost and poor stability of the operation triggering method for M2M in the prior art, an embodiment of the present invention provides a technical solution, where service capability middleware stores a representation of a subject resource, where the representation of the subject resource includes content of the subject resource and information about an operation resource associated with the subject resource. As shown in <FIG>, an operation triggering method for M2M according to the embodiment of the present invention includes the following steps:.

In the technical solution provided by the foregoing embodiment of the present invention, when the content of the subject resource is changed, the service capability middleware storing the change result of the content of the subject resource retrieves, according to the information about the operation resource associated with the subject resource, the representation of the operation resource associated with the subject resource, constructs the operation request for the object resource in the representation of the operation resource, and finally sends the operation request to the object resource in the representation of the operation resource.

The service capability middleware in the foregoing embodiment of the present invention may be middleware on an M2M platform or gateway. Both the M2M platform and the gateway are nodes having capabilities in a network, and therefore a problem of capability restriction does not exist, which is advantageous for handling situations in which services cannot be performed in restricted environments. In addition, in the foregoing embodiment of the present invention, the representation of the operation resource associated with the subject resource can be retrieved according to the information about the operation resource associated with the subject resource, that is, an association is established between the subject resource and the operation resource, so that operation triggering relationships between resources may be distributed on each node (the M2M platform or the gateway), for example, on each node storing a subject resource, thereby avoiding complexity of a single application program. For example, an operation of turning off an air conditioner may be used as an operation resource, while detecting whether a master is at home and detecting an indoor temperature may separately exist as a subject resource. According to the embodiment of the present invention, the operation resource of turning off the air conditioner may be saved to service capability middleware on a gateway to which the air conditioner belongs, while the two subject resources of detecting whether the host is at home and detecting the indoor temperature are separately saved to service capability middleware on different gateways; by establishing an association between the subject resources and the operation resource distributed on different platforms, an operation triggering function may also be implemented. The technical solution provided by the embodiment of the present invention can enhance capabilities of the middleware on the M2M platform and the gateway, so that it is possible to deploy richer applications. Introduction of the operation resource makes operation triggering more applicable to a RESTful architecture.

In the foregoing embodiment of the present invention, the information about the operation resource associated with the subject resource is the representation of the operation resource associated with the subject resource, and that the service capability middleware retrieves, according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource in step <NUM>, may include:.

That is, the association between the subject resource and the operation resource may be established in three manners: the representation of the subject resource includes the representation of the operation resource, the representation of the subject resource includes the uniform resource identifier of the operation resource, or the representation of the subject resource includes the uniform resource identifier of the operation resource set to which the operation resource belongs.

In the foregoing embodiment of the present invention, before the service capability middleware retrieves the change result of the content of the subject resource stored in the service capability middleware in step <NUM>, the method further includes:.

In addition, in the foregoing embodiment of the present invention, the representation of the operation resource may further include a type of the operation request, while the type of the constructed operation request may be any one of create, update, retrieve, and delete. When the type of the operation request is create or update, that is, when the operation request is used to create or update a representation of an object resource, the create operation request further needs to carry a representation of a new object resource for the operation resource. Specifically, the representation of the operation resource may further include an input parameter of the operation request, where the input parameter of the operation request may be a URI of a parameter resource, or the representation of the new object resource is directly saved in the input parameter of the operation request.

Specifically, when the input parameter is the uniform resource identifier of the parameter resource, the constructing the operation request for the object resource includes:.

In the foregoing embodiment of the present invention, before the service capability middleware retrieves the change result of the content of the subject resource stored in the service capability middleware, the method further includes:.

In the foregoing embodiment of the present invention, when the dependency resource exists, before the service capability middleware constructs the operation request for the object resource in the foregoing embodiment of the present invention, the method includes:.

Specifically, types of the foregoing dependency resource may be classified into a sufficient condition type and a necessary condition type, a dependency resource quantity is at least one, and before the service capability middleware constructs the operation request for the object resource in the representation of the operation resource, the method further includes:.

That is, when further determining that the condition specified by the at least one dependency resource of the sufficient condition type is met, the service capability middleware constructs the operation request for the object resource in the representation of the operation resource; or when further determining that the conditions specified by all the dependency resources of the necessary condition type are met, the service capability middleware constructs the operation request for the object resource in the representation of the operation resource.

Specifically, in the foregoing embodiment, the retrieving, by the service capability middleware according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, includes:.

That is, the association between the operation resource and the dependency resource may be established in three manners: the representation of the operation resource includes the representation of the dependency resource, the representation of the operation resource includes the uniform resource identifier of the dependency resource, and the representation of the operation resource includes the uniform resource identifier of the dependency resource set to which the dependency resource belongs.

In the foregoing embodiment of the present invention, it is determined that at least two operation resources are associated with the subject resource, where representations of the operation resources may further include priorities, and the constructing, by the service capability middleware, the operation request for the object resource in the representation of the operation resource may include:
constructing, by the service capability middleware, an operation request for an object resource in the representation of each operation resource in sequence according to the priorities in the representations of the operation resources.

In the foregoing embodiment of the present invention, the representation of the operation resource may further include an operation execution result, and the method further includes:.

The operation triggering method according to the present invention is hereinafter further described in detail in a specific embodiment. <FIG> is a schematic diagram of a resource structure according to an embodiment of the present invention. In this embodiment, a RESTful resource element structure is extended, and multiple operation resources are combined to constitute an operation resource set.

A relationship between a subject resource, an operation resource, and an operation resource set may be shown in <FIG>, where a rectangular block represents a resource, a rounded rectangular block represents an attribute, and a black solid line indicates an association relationship between two resources or between a resource and an attribute. Resources and attributes in this embodiment represent only an exemplary division manner, and there may also be different division manners according to different application scenarios.

The subject resource (Subject Resource) may be any type of resource in a RESTful architecture. In this embodiment, the subject resource may be a resource that causes an operation triggering event.

The operation resource set (Operations) includes one or more operation resources (Operation) where each operation resource is corresponding to one operation triggered by the subject resource. The operation resource set is associated with the subject resource, and a manner of indicating the association may be that a representation of the subject resource includes a URI of the operation resource set.

The operation resource (Operation) indicates an operation. The operation resource may include a series of attributes and resources. As described above, a rounded rectangular block represents an attribute, that is, attributes of the operation resource are some or all of a priority (Priority), a condition (Rule), an object resource (Object Resource), a request type (Method), an input parameter (Input), an address reflecting an operation execution result (Output URI), and the execution result (Result). Likewise, as described above, a rectangular block represents a resource, that is, a resource in the operation resource is a dependency resource included in a dependency resource set (Dependencies). Specifically, the dependency resource may further include several attributes, for example, logic, URI, and/or a condition. One or more operation resources are included in the operation resource set, and an association with the subject resource is generated by using the operation resource set. That is, if the representation of the subject resource includes the uniform resource identifier (URI) of the operation resource set, all operation resources in the operation resource set are operation resources associated with the subject resource. Therefore, when the subject resource changes, whether operations in the operation resources need to be executed is determined for all the operation resources in the operation resource set.

The priority (Priority) indicates a priority of the operation resource. When multiple operation resources, for example, two or more than two, are associated with the subject resource, and operations in the multiple operation resources need to be executed, service capability middleware executes the operations in the operation resources in descending order of priority according to the priorities in representations of the operation resources.

The condition (Rule) indicates a condition required for executing an operation in the operation resource. When a change result of content of the subject resource associated with the operation resource meets the condition defined by Rule, the operation in the operation resource is executed.

The object resource (Object Resource) may be specifically indicated by using a URI of the object resource. When the change result of the content of the subject resource associated with the operation resource meets the condition defined by Rule in the representation of the operation resource, a common operation request for the object resource is sent to the URI of the object resource.

Method indicates a type of an operation request for the operation resource. In the RESTful architecture, generally, finite types of operation requests are defined. For example, for ETSI M2M, there are four types of operation requests, namely, create (Create), retrieve (Retrieve), update (Update), and delete (Delete).

Input indicates an input parameter of the operation request for the operation resource. In a RESTful method, operation requests of the update and create types need to carry the input parameter. In a create request, the input parameter carried in the create request is a representation of a new object resource, and the representation of the new object resource carried in the create request is used to create the entire object resource. In an update request, a representation of a new object resource carried in the update request is used to replace a representation of an original object resource. Specifically, a value of the input parameter in the operation resource may further be a URI, where the URI points to a parameter resource, and a representation of the parameter resource is the representation of the new object resource that needs to be carried in the operation request. The input parameter may also be a text segment used to directly save the representation of the new object resource. The input parameter is not mandatory to each operation resource. When the type of the operation request is delete or retrieve, because the operation request does not need to carry the input parameter, the representation of the operation resource of this type may not carry the input parameter.

Output URI indicates an address reflecting an operation execution result. In some scenarios, the operation execution result needs to be fed back by using a status of another resource. For example, to determine whether a light is turned on, it is necessary to retrieve a value of a light sensor under the light, and an address of data of the light sensor is the address reflecting the operation execution result. The input parameter is also not mandatory to each operation resource. Representations of operation resources of some types may not include the input parameter.

Result indicates the operation execution result. It is a text segment. In a case in which Output URI exists, that is, when the operation execution result is reflected by a resource pointed to by Output URI, a representation of the resource retrieved from Output URI is saved in Result. When Output URI is not provided, an operation response that is fed back after the operation request is sent is saved in Result.

Dependencies indicate a dependency resource (Dependency) set, that is, a dependency resource set. The dependency resource indicates that execution of the operation resource further needs to depend on a dependency condition defined by a dependency resource.

Dependency indicates the dependency resource. Three attributes may be saved in the dependency resource. One is a URI, one is a condition (Rule), and the last one is logic (Logic). Specifically, the dependency resource is used to determine whether a representation of a condition resource pointed to by a URI in the dependency resource meets the condition defined by Rule in a representation of the dependency resource. Furthermore, if a parameter in Logic is AND, it indicates that meeting the condition defined by Rule in the representation of the dependency resource is a necessary condition for executing the sending of the operation request; if the parameter in Logic is OR, it indicates that meeting the condition defined by Rule in the representation of the dependency resource is a sufficient condition for executing the sending of the operation request.

With reference to the resource structure diagram shown in <FIG>, an embodiment of the present invention provides a complete flowchart of an operation triggering method. <FIG> is a schematic flowchart of an operation triggering method according to a specific embodiment of the present invention. As shown in <FIG>, the method includes the following steps:
Step <NUM>: Configure a subject resource, so that when content of the subject resource is changed, an operation on an object resource is triggered.

According to a service requirement of an M2M application, an application program may configure a subject resource, so that when a content of the subject resource is changed, one or more operations are performed on one or more object resources. A configuration method is to associate at least one operation resource with the subject resource. Specifically, the association may be established by using an operation resource set, or multiple operation resources may be directly associated with the subject resource, which is not limited herein in the embodiment of the present invention.

Specifically, for configuring the subject resource, it may be that the application program sends an operation resource create request to the operation resource set associated with the subject resource, so that an operation resource is created in the operation resource set. The operation resource create request defines what operation (Method) will be performed on which object resource (Object Resource) when what change (Rule) of the subject resource occurs, an input parameter (Input) that needs to be carried in an operation request for the operation, and whether a condition defined by Rule in a dependency resource needs to be met before the operation is executed. In addition, it may also be that the application program sends the operation resource create request, and an entity (for example, platform middleware) that receives the operation resource create request creates the operation resource. It may further be that the application program directly sends the operation resource create request to middleware that stores the subject resource, and the middleware creates the operation resource in the representation of the subject resource. For a specific configuration process, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: Retrieve a change result of the content of the subject resource.

The subject resource may be any resource stored in service capability middleware of an M2M system. Specifically, the subject resource may be a resource that causes an operation triggering event. For example, in an operation triggering event of turning on and off an air conditioner caused by an indoor temperature change, a resource that completes indoor temperature detection is the subject resource. Specifically, the content of the subject resource may be a text segment, a database record, or a file that is stored in the service capability middleware and has a specific structure. The stored text segment and the like may be changed into a data structure by means of a deserialization process. The representation of the subject resource may also be a data structure that is directly saved in a memory of the service capability middleware.

The change of the content of the subject resource may be caused by any situation. For example, the content of the subject resource may be changed by request sending by another application, or the content of the subject resource is changed by a process in the service capability middleware. The service capability middleware that stores the subject resource detects the change result of the content of the subject resource by listening on a program of the subject resource.

Step <NUM>: Retrieve representations of operation resources associated with the subject resource, and determine that the change result of the content of the subject resource meets conditions defined by rules in the representations of the operation resources.

As shown in <FIG>, the subject resource is associated with the operation resources by using the operation resource set.

However, in this embodiment, it may also be that the representation of the subject resource includes the representation of each operation resource in <FIG>, or the URI of each operation resource in <FIG>, or the URI of the operation resource set to which the operation resources in <FIG> belong. The operation resource set is a resource of a set type and includes at least one operation resource. Each operation resource includes a Rule attribute that defines a condition that the change result of the content of the subject resource associated with the operation resource needs to meet. The service capability middleware performs determining, one by one according to the change result of the content of the subject resource, on conditions in rules of the operation resources associated with the subject resource, and finally selects those operation resources in which conditions in rules are met. For a specific implementation process of step <NUM>, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: For the operation resources that are associated with the subject resource and determined in the foregoing step, select an operation resource according to priorities of the operation resources.

A priority attribute is defined in an operation resource and used to indicate a priority of the operation resource. Specifically, the priority may be indicated in a form of a number, where a greater number indicates a higher priority, or in other forms. Importance and a sequence of the operation resources are arranged by using the priorities.

Specifically, in step <NUM>, it is determined that at least two operation resources are associated with the subject resource, and the change result of the content of the subject resource meets conditions in rules in the operation resources. Then in this step, the service capability middleware constructs an operation request for an object resource in a representation of each operation resource in sequence according to the priorities in the representations of the operation resources, so that an operation described in each operation resource can be executed in sequence.

Step <NUM>: Determine that dependency resources associated with the operation resource that is selected according to the priorities in step <NUM> exist, and determine that all conditions defined by rules in the associated dependency resources can be met.

Specifically, for the operation resource selected in step <NUM>, it is determined that the dependency resources associated with the operation resource exist. Specifically, the dependency resources associated with the operation resource may be representations of the dependency resources included in the representation of the operation resource (the dependency resources as shown in <FIG>), or may be an identifier or identifiers of one or more dependency resources included in the representation of the operation resource or an identifier of a dependency resource set included in the representation of the operation resource, which is not limited herein in the embodiment of the present invention.

A dependency resource includes three attributes: URI, Logic, and Rule. After it is determined that the dependency resources associated with the operation resource exist, the determining that all conditions defined by rules in the dependency resources can be met is specifically: retrieving, according to a URI of a dependency resource, a representation of a condition resource indicated by the URI; determining whether the representation of the condition resource can meet a condition defined by Rule in the dependency resource; if the representation of the condition resource can meet the condition defined by Rule in the dependency resource, further checking whether a type of the dependency resource defined in Logic is a sufficient condition type or a necessary condition type; if it is the necessary condition type, continuing to check whether conditions defined by rules in other unchecked dependency resources can be met; and if it is the sufficient condition type, step <NUM> is executed directly. For a specific implementation process of this step, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: Retrieve an input parameter of an operation request according to a type of the operation request in a representation of the operation resource selected in step <NUM>, and construct the operation request.

Specifically, in this step, first, it is determined that the type of the operation request defined by Method in the representation of the operation resource is create (Create) or update (Update). The input parameter of the operation request is retrieved according to a value of Input in the operation resource. The input parameter of the operation request is a representation of an object resource to be created or a representation of an object resource to be updated. When Input includes a URI, a representation of a resource indicated by the URI needs to be retrieved by using a retrieve (Retrieve) request and used as the representation of the new object resource. The representation of the new object resource may also be saved directly as the value of Input. In this case, the representation of the new object resource is directly used to construct the operation request.

The operation request to be sent is constructed according to the type of the operation request, the object resource, and the input parameter defined in the operation resource. For a specific implementation process of step <NUM>, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: Send the operation request constructed in step <NUM> to a URI of an object resource, and receive an operation response returned by a device in which the object resource is located. Specifically, interaction between platform middleware that stores the subject resource and the device that stores the object resource may be performed by using a standard RESTful interface.

Step <NUM>: According to Output URI in the representation of the operation resource that is currently executed, retrieve an execution result corresponding to the operation request, and save it to Result.

Specifically, when the representation of the operation resource includes Output URI, the execution result corresponding to the operation request needs to be retrieved from a resource indicated by Output URI. After the request is sent in step <NUM>, the service capability middleware that stores the subject resource further sends a retrieve (Retrieve) request to Output URI to retrieve a representation of the resource indicated by Output URI, and saves the retrieved representation of the resource indicated by Output URI into the execution result (Result) attribute in the representation of the operation resource.

If Output URI is not provided in the representation of the operation resource, it indicates that the execution result corresponding to the operation request does not need to be reflected by a representation of another resource. In this case, after step <NUM> is executed, the operation response corresponding to the operation request in step <NUM> is received. Content of the operation response is saved into the execution result (Result) in the representation of the operation resource. For a specific implementation process of step <NUM>, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: Determine whether the selected resource is a last operation resource. If the selected resource is the last operation resource, that is, if it is determined that operations of the multiple operation resources selected in step <NUM> have been executed, go to step <NUM>; otherwise, return to step <NUM>. In this step, determining whether an operation of an operation resource is executed may be determining whether a corresponding operation response is received.

<FIG> is a schematic flowchart of configuring operation triggering according to an embodiment of the present invention. In this embodiment, an operation resource is configured for a temperature value of a temperature sensor, so that turning on an air conditioner is triggered when a temperature is higher than <NUM> and a family member is at home. A system architecture diagram thereof may be shown in <FIG>.

An M2M network application (Network application, NA for short hereinafter) server registers various M2M applications (such as electricity meter reading and intelligent traffic) with a network service capability layer (Network Service Capability Layer, NSCL for short hereinafter) of an M2M service platform by using a mIa interface. The M2M service platform accesses an M2M device by using a mId interface to collect data, and further performs remote device management on the M2M device by using the interface. An M2M device d (M2M device) is connected to the NSCL of the M2M service platform by using an M2M gateway (M2M Gateway). An M2M device D (M2M device domain) is connected to the NSCL of the M2M service platform by using the mId interface.

An M2M device D' is a conventional device that does not comply with an ETSI M2Mstandard. The M2M device D is a device that complies with the ETSI M2M standard. The M2M device D has a service capability layer (Service Capability Layer, SCL for short hereinafter) that is defined by the ETSI M2M standard. The M2M device D' does not have the SCL defined by the ETSI M2M standard.

By using a gateway interworking proxy function (Gateway Interworking Proxy, GIP for short hereinafter), the M2M gateway interworks with the conventional M2M device d and M2M device D' in a wireless or wired communications manner (for example, ZigBee, Bluetooth, DLMS/COSEM, Zwave, BACnet, ANSI C12, and mBus). The mId interface between the M2M gateway or M2M device D and the M2M platform generally uses wired or wireless wide area local area network communication manners (for example, xDSL, HFC, satellite, GERAN, UTRAN, E-UTRAN, WLAN, and WiMAX).

A D'A1 is a temperature sensor application. The D'A1 continuously saves temperature values to a temperature (Temperature) resource in a resource tree of a gateway service capability layer GSCL1. A URI of the subject resource Temperature resource is http://gscl1/temperature. An NA1 is a smart home application program. The NA1 is used to create a representation of an operation resource associated with the temperature resource. A D'A5 is an air conditioner application program. The D'A5 controls an air conditioner by monitoring a representation value of an air condition (AirCondition) resource in a GSCL2, for example, turns on the air conditioner when the representation value of the air condition resource is ON, and turns off the air conditioner when the representation value of the air condition resource is OFF. A URI of the air condition resource is http://gscl2/airCondition.

An NA2 is a host location application program. The application program saves location information of a host to a host location (HostLocation) resource in the NSCL. A URI of the host location resource is http://nscl/hostLocation.

When a representation value of the temperature resource is higher than <NUM> degrees Celsius, the GSCL1 needs to send a request to the GSCL2 to change the representation of the air condition resource to ON, thereby achieving an objective of turning on the air conditioner. The NA1 completes this process by creating the representation of the operation resource associated with the temperature resource.

As shown in <FIG>, the following steps are included:
Step <NUM>: Create a representation of an operation resource.

The NA1 on the network application server constructs an operation resource for turning on an air conditioner (TurnOnAC), which is used to express a condition for triggering the operation of turning on an air conditioner. According to a requirement of service logic, this step may be repeated multiple times to create representations of multiple operation resources. An architecture of the operation resource TurnOnAC is shown in <FIG>.

Step <NUM>: Send an operation resource create request.

After step <NUM>, the NA1 on the network application server encapsulates the constructed representation of the operation resource TurnOnAC according to a standard of a RESTful architecture on an interface, and sends it to the gateway service capability layer GSCL1, so that the GSCL1 creates the operation resource TurnOnAC in an operation resource set associated with the temperature resource, where a URI of the operation resource set is http://gscl1/temperature/Operations. That is, the operation resource create request carries the URI of the operation resource set and the constructed representation of the operation resource. If the operation resource set associated with the subject resource, for example, the temperature resource, does not exist, the operation resource create request may carry the URI of the temperature resource or a URI of the GSCL1, and the GSCL1 creates the operation resource, for example, creates the operation resource in the representation of the temperature resource, or creates the operation resource elsewhere, and includes a URI of the operation resource into the representation of the temperature resource. The embodiment of the present invention is described by using an example in which the operation resource create request carries the URI of the operation resource set.

Step <NUM>: Create the operation resource.

After receiving the operation resource create request sent by the NA1, the gateway service capability layer GSCL1 creates, in the operation resource set (Operations) associated with the temperature resource, the operation resource TurnOnAC in the operation resource create request, that is, adds the representation of the operation resource TurnOnAC to the operation resource set, so that the operation resource TurnOnAC and the temperature resource are associated. After completing creating the operation resource TurnOnAC, the gateway service capability layer returns a create response to the NA1.

Step <NUM>: Create a representation of a dependency resource.

According to service requirements, the NA1 begins to create dependency resources associated with different operation resources. In this embodiment, whether to turn on the air conditioner depends on a location of the host, that is, a status of the host location resource HostLocation, and the host location resource HostLocation is the dependency resource associated with the operation resource TurnOnAC. Therefore, a dependency resource MemberAtHome is created, and a representation of the dependency resource MemberAtHome may be used to indicate whether a member is at home. As shown in <FIG>, in the dependency resource MemberAtHome, a value of Logic is OR, indicating that a type of the dependency resource is a sufficient condition type; a URI is the URI of the host location resource; a condition Rule is that the status of a host location is at home.

Step <NUM>: Send a dependency resource create request.

After step <NUM>, the NA1 encapsulates the constructed representation of the dependency resource MemberAtHome according to a standard of the RESTful architecture on an interface, and sends it to the gateway service capability layer GSCL1, so that the GSCL1 creates the dependency resource MemberAtHome in a dependency resource set associated with the operation resource TurnOnAC, where a URI of the dependency resource set is http://gscl1/temperature/Operations/TurnOnAC/Dependencies. That is, the dependency resource create request includes the URI of the dependency resource set. In addition, referring to step <NUM>, the dependency resource create request may further include the URI of the operation resource to indicate that no dependency resource or dependency resource set exists in the operation resource, so that the GSCL1 directly saves the representation of the dependency resource into the operation resource TurnOnAC. This embodiment is described by using an example in which the dependency resource create request carries the URI of the dependency resource set. In addition, the dependency resource create (Create) request may be sent as defined in the standard.

Step <NUM>: Create the dependency resource.

After receiving the dependency resource create request sent by the NA1, the GSCL1 adds the representation of the dependency resource MemberAtHome in the dependency resource create request to the dependency resource set associated with the operation resource TurnOnAC, that is, associates the dependency resource MemberAtHome with the dependency resource set, and thereby also associates the dependency resource MemberAtHome with the operation resource TurnOnAC. After the dependency resource is created, a create response is returned.

On a basis of the embodiment shown in <FIG>, when the temperature is higher than <NUM> degrees Celsius, windows further need to be closed in addition to turning on the air conditioner, that is, two operations are triggered. The NA1 may define that a priority of closing the windows is higher than a priority of turning on the air conditioner, that is, the windows need to be closed before the air conditioner is turned on. The system architecture in <FIG> further includes a controller application program D'A4 for closing windows. The D'A4 controls the windows by monitoring a value of a Window resource in the gateway service capability layer GSCL2. For example, when a representation of the Window resource is ON, the windows are opened, and when the representation of the Window resource is OFF, the windows are closed. A URI of the Window resource is http://gscl2/window.

An architecture diagram of an operation resource CloseWindow for closing windows may be shown in <FIG>. A value of an input parameter Input of the operation resource CloseWindow is a URI, while an input parameter is directly saved in Input of the TurnOnAC. Output URI of the operation resource CloseWindow is http://gscl2/allWindowStatus, that is, a URI of an allWindowStatus resource. A representation of the allWindowStatus resource is used to indicate a closing status of windows in a house. ON indicates that a window is opened. OFF indicates that all the windows are closed.

The operation resource CloseWindow and the operation resource TurnOnAC are separately associated with the subject resource Temperature. A schematic diagram of a specific association may be shown in <FIG>.

When the representation of the temperature resource is higher than <NUM> degrees, the two operations of the operation resource TurnOnAC and operation resource CloseWindow are triggered. In this embodiment, the temperature resource Temperature is saved in the gateway service capability layer GSCL1, and both the operation resource TurnOnAC and operation resource CloseWindow are saved in the gateway service capability layer GSCL2. A specific process thereof includes steps shown in <FIG>.

Step <NUM>: The GSCL1 retrieves a change result of content of the temperature resource.

Specifically, the temperature resource Temperature is used as a subject resource, and the content of the temperature resource is changed. The change result of the content retrieved by the GSCL1 is <NUM> degrees.

Step <NUM>: The GSCL1 determines operation resources associated with the temperature resource Temperature.

Specifically, an association manner in this embodiment may be that the representation of the temperature resource includes a URI of an operation resource set to which the operation resource TurnOnAC and operation resource CloseWindow belong. In this embodiment, an architecture diagram of the temperature resource may be shown in <FIG>. In this step, the determined operation resources associated with the temperature resource are TurnOnAC and CloseWindow.

Step <NUM>: Determine that the change result of the content of the temperature resource meets conditions defined by rules in representations of the operation resources TurnOnAC and CloseWindow determined in step <NUM>. Rule defines a method for matching representations of resources. In ETSI M2M, Rule is a filterCriteria attribute defined by the ETSI M2M standard. In this embodiment, the conditions defined by the rules in the representations of the TurnOnAC and CloseWindow are ><NUM>, and the representation of the temperature resource is changed to <NUM>. Therefore, the conditions defined by the rules in the TurnOnAC and CloseWindow are both met, and the two operation resources are selected in this step. In subsequent steps, corresponding operations are executed on the selected operation resources one by one.

Step <NUM>: Both the representations of the two operation resources include priorities (Priority) of the operation resources. In this embodiment, the priority of the operation resource CloseWindow is <NUM>, and the priority of the operation resource TurnOnAC is <NUM>. Therefore, the priority of the operation resource CloseWindow is higher than the priority of the operation resource TurnOnAC. Therefore, in this step, choose to execute the operation corresponding to the operation resource CloseWindow of the higher priority first.

Step <NUM>: Determine that a condition defined by Rule in a dependency resource associated with the operation resource CloseWindow is met. For detailed steps, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: Retrieve an input parameter required for creating an operation request for the operation resource CloseWindow. For detailed steps, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: According to a request type (Method) and an object resource (Object Resource) included in the representation of the operation resource CloseWindow and the input parameter retrieved in step <NUM>, construct the operation request to be sent. In this embodiment, the type of the operation request is create (Create), a URI of the object resource is http://gscl3/window, and the retrieved input parameter (Input) is OFF. In the ETSI M2M standard, an operation request transmitted on a standard RESTful interface may be constructed according to the foregoing attributes.

Step <NUM>: Send the operation request constructed in step <NUM> to a GSCL3, where the operation request may be specifically sent by using a standard RESTful interface defined in an M2M system, and receive an operation response that is returned by the GSCL3 after the operation in the operation request, for example, closing a window, is completed by a window controller.

Step <NUM>: Retrieve an execution result corresponding to the operation request. For detailed steps, reference may be made to an embodiment shown in <FIG>.

Step <NUM>: With respect to the priorities of the operation resources selected in step <NUM>, select a remaining operation resource of a highest priority, and continue to execute the following steps. In this embodiment, the operation resource TurnOnAC is selected in this step.

Step <NUM>: Determine that a condition defined by Rule in a representation of a dependency resource associated with the operation resource TurnOnAC is met. For detailed steps, reference may be made to the embodiment shown in <FIG>.

Step <NUM>: Retrieve an input parameter required for creating an operation request for the TurnOnAC. For detailed steps, reference may be made to the embodiment shown in <FIG>.

Step <NUM>: According to a type (Method) and an object resource (Object Resource) included in the operation resource TurnOnAC and the input parameter retrieved in step <NUM>, construct the operation request to be sent. In this embodiment, the type of the operation request is create (Create), a URI of the object resource is http://gscl2/airCondition, and the retrieved input parameter (Input) is ON. With reference to the ETSI M2M standard, an operation request transmitted on a standard RESTful interface may be constructed according to the foregoing attributes.

Step <NUM>: Send the operation request created in step <NUM> to the GSCL2, where the operation request may be specifically sent by using a standard RESTful interface defined in the M2M system, and receive an operation response.

Step <NUM>: Retrieve an operation execution result. For detailed steps, reference may be made to the embodiment shown in <FIG>.

In the embodiment shown in <FIG>, the GSCL2, GSCL1, and GSCL3 may be a same GSCL, or may be different GSCLs, which is not limited herein in the embodiment of the present invention.

Input included in a representation of an operation resource indicates an input parameter required for constructing an operation request. operation requests of the types of operation requests specified by the RESTful architecture, delete (Delete) and retrieve (Retrieve) do not require an input parameter, but operation requests of create (Create) and update (Update) need to carry representations of object resources for creating an object resource and updating an object resource respectively. In step <NUM> and step <NUM> in the foregoing embodiment shown in <FIG>, the input parameters are retrieved when the operation requests for the operation resources CloseWindow and TurnOnAC are constructed separately. A specific process thereof is shown in <FIG>, where a URI saved in the input parameter is http://gscl3/OFF, and service capability middleware in which a resource pointed to by the URI is located is the GSCL3. As shown in <FIG>, a process for determining whether an input parameter needs to be retrieved may include the following steps:.

The URI is in a fixed format, and made up of parts such as a schema, a host, a port, and a path. For details, reference may be made to IETF RFC <NUM>. The URI saved in the input parameter Input indicates that the input parameter required for constructing the operation request is a representation of the parameter resource pointed to by the URI. For example, for the operation resource CloseWindow in this embodiment, the URI http://gscl2/OFF is saved in the input parameter Input in the representation of the operation resource. If the URI is saved in the input parameter, the process proceeds to step <NUM>. If no URI is saved in the input parameter, but a representation of a resource is directly saved as a representation of a new object resource, the process proceeds to step <NUM>.

Step <NUM>: Construct an operation request of the create type, and directly use a representation of an object resource saved in the input parameter, as content of the operation request. For example, <textContent>ON<textContent> is saved in the input parameter in the representation of the operation resource TurnOnAC, and the text segment is the input parameter that is required for creating the operation request for the operation resource TurnOnAC.

Step <NUM>: When the input parameter in the representation of the operation resource that is being executed is the URI, a retrieve request needs to be sent to the URI to retrieve a representation of a resource pointed to by the URI as the representation of the new object resource. For example, the URI saved in the input parameter Input in the representation of the operation resource CloseWindow is http://gscl3/OFF, which indicates that the GSCL1 (the service capability middleware in which the Temperature is located) needs to send a retrieve request (Retrieve) to the GSCL3 (the service capability middleware in which http://gscl3/OFF is located) to retrieve a representation of a resource indicated by http://gscl3/OFF as the representation of the new object resource.

Step <NUM>: The input parameter is not required for constructing an operation request of the delete or retrieve type, and the process directly proceeds to step <NUM>.

Step <NUM>: Execute the steps next to step <NUM> and step <NUM> in the embodiment shown in <FIG>.

In step <NUM> and step <NUM> in the embodiment shown in <FIG>, before the operations are executed, it is necessary to determine whether the conditions defined by the rules in the representations of the dependency resources of the operation resources are met. In this embodiment, it is to determine whether a condition defined by Rule in a representation of each dependency resource of the operation resources TurnOnAC and CloseWindow can be met. In the system architecture shown in <FIG>, a D'A2 is a bedroom window sensor application program used to detect whether a window in a bedroom is closed, and this application program uses a representation of a BedroomWindowStatus resource in the GSCL1 to indicate a current status of the window in the bedroom. A URI of the BedroomWindowStatus resource is http://gscl1/bedroomWindowStatus. A D'A3 is a living room window sensor application program used to detect whether a window in a living room is closed, and this application program uses a representation of a LivingroomWindowStatus resource in the GSCL1 to indicate a current status of the window in the living room. A URI of the LivingroomWindowStatus resource is http://gscl1/livingroomWindowStatus. In the current embodiment, when the representation of the temperature resource is higher than <NUM>, the windows needs to be closed before the air conditioner is turned on. Before the operation of closing the windows is executed, it is necessary to determine whether the windows in the living room and bedroom have been closed. That is, execution of the operation of the operation resource CloseWindow further depends on the representations of the two dependency resources BedroomWindowStatus and LivingroomWindowStatus. If one window is not closed, the operation of closing a window needs to be executed.

Meanwhile, the operation of turning on the air conditioner is executed only after it is ensured that all the windows are closed and it is determined that the host is at home. In summary, the architecture of the dependency resource sets of the updated operation resource TurnOnAC for turning on the air conditioner and the updated operation resource CloseWindow for closing the windows may be shown in <FIG> and <FIG>.

For each operation resource, determining whether a condition defined by Rule in a representation of a dependency resource associated with the operation resource may include the steps shown in <FIG>.

Step <NUM>: The GSCL1 determines all the dependency resources associated with the operation resources, where the dependency resources associated with the operation resource TurnOnAC include MemberAtHome, LivingroomWindowClosed, and BedroomWindowClosed, and the dependency resources associated with the operation resource CloseWindow include LivingroomWindowOpen and BedroomWindowOpen.

Step <NUM>: Select one dependency resource associated with each operation resource in sequence, and execute the following step <NUM> to step <NUM> for each dependency resource.

Step <NUM>: According to a URI in the representation of the dependency resource, retrieve a representation of a condition resource pointed to by the URI; for example, according to http://nscl/hospLocation, retrieve a representation of a condition resource pointed to by the URI, that is, retrieve the location of the host.

Step <NUM>: Determine whether the representation of the condition resource meets the condition defined by Rule in the dependency resource. If the condition is met, execute step <NUM>; otherwise, execute step <NUM>.

In this embodiment, assuming that the location of the host is at home, the representation of the condition resource meets the condition defined by Rule in the dependency resource.

Step <NUM>: Determine whether a type of the dependency resource is the sufficient condition type or the necessary condition type. If it is the sufficient condition type, execute step <NUM>; if it is the necessary condition type, execute step <NUM>.

In this embodiment, the type of the dependency resource MemberAtHome is AND, that is, the necessary condition type, and therefore, it is further necessary to determine whether a condition in another dependency resource is met.

Step <NUM>: Determine whether a type of the dependency resource is the sufficient condition type or the necessary condition type. If it is the necessary condition type, execute step <NUM>; if it is the sufficient condition type, execute step <NUM>.

Step <NUM>: Determine whether the dependency resource is a last dependency resource. If the dependency resource is not the last dependency resource, execute step <NUM>. If the dependency resource is the last dependency resource, there are two cases: if it is determined in step <NUM> that the representation of the condition resource meets the condition defined by Rule in the dependency resource, execute step <NUM>; if it is determined in step <NUM> that the representation of the condition resource does not meet the condition defined by Rule in the dependency resource, execute step <NUM>.

Step <NUM>: Proceed to execute a next step, that is, step <NUM> and step <NUM> in the embodiment shown in <FIG>.

Step <NUM>: Terminate the operation for the operation resource.

Specifically, for the operation resource CloseWindow, the dependency resource first selected in step <NUM> is the LivingroomWindowOpen; a representation of a resource indicating whether the window in the living room is opened, namely, a closed state (Closed), is further retrieved according to the URI http://gscl1/livingroomWindowStatus of the dependency resource LivingroomWindowOpen in step <NUM>; in step <NUM>, it is determined whether the representation of the resource retrieved in step <NUM> and indicating whether the window in the living room is opened meets the condition defined by Rule in the representation of the dependency resource LivingroomWindowOpen, the condition defined by Rule in the representation of the dependency resource LivingroomWindowOpen is an open state (Open), and therefore, a determining result is that the condition is not met, and step <NUM> is executed; in step <NUM>, it is determined that the type of the dependency resource defined by logic (Logic) in the representation of the dependency resource LivingroomWindowOpen is the sufficient condition type (OR), and therefore, step <NUM> is further executed; in step <NUM>, it is determined that, for the operation resource CloseWindow, there is another dependency resource on which determining has not been performed, and therefore, the process returns to step <NUM>; in step <NUM>, the next dependency resource BedroomWindowOpen is selected, and a representation of a resource indicating whether the window in the bedroom is opened, namely, an open state (Open), is retrieved according to the URI http://gscl1/bedroomWindowStatus of the dependency resource BedroomWindowOpen in step <NUM>. In step <NUM>, it is determined whether the representation of the resource retrieved in step <NUM> and indicating whether the window in the bedroom is opened meets the condition defined by Rule in the representation of the dependency resource BedroomWindowOpen, the condition defined by Rule in the representation of the dependency resource BedroomWindowOpen is an open state (Open), and therefore, a determining result is that the condition is met, and step <NUM> is executed; in step <NUM>, it is determined that the type of the dependency resource defined by logic (Logic) in the representation of the dependency resource BedroomWindowOpen is the sufficient condition type, and step <NUM> is executed.

For the operation resource TurnOnAC, the dependency resource LivingroomWindowClosed is selected first in step <NUM>, and the representation of the resource indicating whether the window in the living room is opened, namely, the closed state (Closed), is retrieved according to the URI http://gscl1/livingroomWindowStatus of the dependency resource LivingroomWindowClosed in step <NUM> is. In step <NUM>, it is determined whether the representation of the resource retrieved in step <NUM> and indicating whether the window in the living room is opened meets the condition defined by Rule in the representation of the LivingroomWindowOpen, the condition defined by Rule in the representation of the dependency resource LivingroomWindowOpen is the closed state (Closed), and therefore, a determining result is that the condition is met, and step <NUM> is executed. In step <NUM>, it is determined that the type of the dependency resource defined by the logic (Logic) in the representation of the dependency resource LivingroomWindowOpen is the necessary condition type (AND), and therefore, step <NUM> is further executed; in step <NUM>, it is determined whether there is another dependency resource that is associated with the operation resource TurnOnAC and on which determining has not been performed. Because the dependency resource BedroomWindowClosed exists, step <NUM> is executed, and the dependency resource BedroomWindowClosed is selected. The representation of the resource indicating whether the window in the bedroom is opened, namely, the closed state (Closed), is retrieved according to the URI http://gscl1/bedroomWindowStatus of the dependency resource BedroomWindowClosed in step <NUM> is. In step <NUM>, it is determined whether the representation of the resource retrieved in step <NUM> and indicating whether the window in the bedroom is opened meets the condition defined by Rule in the representation of the dependency resource BedroomWindowOpen, the condition defined by Rule in the representation of the dependency resource BedroomWindowOpen is the closed state (Closed), and therefore, a determining result is that the condition is not met, and step <NUM> is executed. In step <NUM>, it is further determined that the logic (Logic) in the representation of the dependency resource MemberAtHome defines that the type of the dependency resource is the necessary condition type, and step <NUM> is executed directly.

The following is an embodiment of how to retrieve execution results of operation requests after operations are triggered by a change of a subject resource. For details, reference may be made to step <NUM> and step <NUM> in the embodiment shown in <FIG>, where operation execution results need to be retrieved after operation requests for the operation resource CloseWindow and operation resource TurnOnAC are sent separately. As shown in the resource structural diagram of the operation resource TurnOnAC shown in <FIG> and the resource structural diagram of the operation resource CloseWindow shown in <FIG>, Output URI of the operation resource TurnOnAC is N/A, while Output URI of the operation resource CloseWindow is http://gscl2/allWindowStatus. A specific process of retrieving the operation execution results may include the steps shown in <FIG>.

Step <NUM>: Referring to step <NUM> and step <NUM> in the embodiment shown in <FIG>, start after the operation requests for the operation resource CloseWindow and operation resource TurnOnAC are sent and operation responses are received.

Step <NUM>: The GSCL1 determines whether the addresses (Output URI) reflecting the operation execution results in the representations of the operation resources are N/A. In this embodiment, Output URI in the representation of the operation resource TurnOnAC is N/A, and step <NUM> is executed, while Output URI in the representation of the operation resource CloseWindow is not N/A, and step <NUM> is executed.

Step <NUM>: As shown in step <NUM> in the embodiment shown in <FIG>, the process of retrieving the operation execution results occurs after the operation requests are sent and the operation responses are received. In a case in which Output URI in the representation of the operation resource is N/A, the operation response is directly saved into the execution result Result. For the operation resource TurnOnAC, the operation response corresponding to the operation request of the create (Create) type is OK, and therefore, OK is saved into Result in the representation of the operation resource TurnOnAC.

Step <NUM>: In a case in which Output URI of the operation resource is not N/A, the address reflecting the operation execution result, that is, a URI of a resource that stores the operation execution result, is saved into Output URI. Therefore, a retrieve request is sent to the URI of the resource that stores the operation execution result, so that the representation of the resource is retrieved. For the operation resource CloseWindow, a retrieve request is sent to the URI http://gscl2/allWindowStatus of the resource that stores the operation execution result, and a retrieve response is received, where the retrieve response includes the representation of the allWindowStatus resource, that is, all windows are closed (Closed).

Step <NUM>: Save the representation of the allWindowStatus resource retrieved in step <NUM> into the execution result Result in the representation of the operation resource CloseWindow.

An embodiment of the present invention further provides an apparatus corresponding to the foregoing method. <FIG> is schematic structural diagram <NUM> of an operation triggering apparatus for machine-to-machine communications according to an embodiment of the present invention, where the apparatus stores a representation of a subject resource, where the representation of the subject resource includes content of the subject resource and information about an operation resource associated with the subject resource, as shown in <FIG>.

The apparatus includes a retrieving module <NUM>, a constructing module <NUM>, and a sending module <NUM>. The retrieving module <NUM> is configured to retrieve a change result of the stored content of the subject resource when the content of the subject resource is changed, and retrieve, according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource, where the representation of the operation resource includes a condition for sending an operation request to an object resource and a uniform resource identifier of the object resource; the retrieving module is further configured to send the change result and the representation of the operation resource to the constructing module; the constructing module <NUM> is configured to receive the change result and the representation of the operation resource associated with the subject resource, and when it is determined that the change result meets the condition for sending the operation request to the object resource in the representation of the operation resource, construct the operation request for the object resource, and send the operation request to the sending module; and the sending module <NUM> is configured to receive the operation request, and send the operation request to the object resource according to the uniform resource identifier of the object resource.

In the technical solution provided by the foregoing embodiment of the present invention, when the content of the subject resource is changed, the apparatus that stores the change result of the content of the subject resource retrieves, according to the information about the operation resource associated with the subject resource, the representation of the operation resource associated with the subject resource, and constructs the operation request for the object resource in the representation of the operation resource, and finally sends the operation request to the object resource in the representation of the operation resource. The operation triggering apparatus for machine-to-machine communications in the foregoing embodiment of the present invention may be middleware on an M2M platform or gateway. Both the M2M platform and the gateway are nodes having capabilities in a network, and therefore a problem of capability restriction does not exist, which is advantageous for handling situations in which services cannot be performed in restricted environments.

Further, the information about the operation resource associated with the subject resource is the representation of the operation resource associated with the subject resource, and that the retrieving module retrieves, according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the representation, included in the representation of the subject resource, of the operation resource associated with the subject resource, the representation of the operation resource associated with the subject resource; or the information about the operation resource associated with the subject resource is a uniform resource identifier of the operation resource associated with the subject resource, and that the retrieving module retrieves, according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the uniform resource identifier of the operation resource included in the representation of the subject resource, the representation of the operation resource associated with the subject resource; or the information about the operation resource associated with the subject resource is a uniform resource identifier of an operation resource set to which the operation resource associated with the subject resource belongs, and that the retrieving module retrieves, according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the uniform resource identifier, included in the representation of the subject resource, of the operation resource set to which the operation resource belongs, the representation of the operation resource associated with the subject resource, where the representation of the operation resource associated with the subject resource is a representation of an operation resource included in the operation resource set.

The operation triggering apparatus for machine-to-machine communications according to the foregoing embodiment of the present invention may further include a receiving module, where the receiving module is configured to receive a subject resource update request before the retrieving module retrieves the change result of the content of the subject resource stored in the apparatus, where the subject resource update request includes a representation of a new subject resource and a uniform resource identifier of the subject resource to be updated, where the representation of the new subject resource includes information about an operation resource associated with the new subject resource, and the receiving module updates the stored representation of the subject resource to the representation of the new subject resource according to the uniform resource identifier of the subject resource to be updated; or
the receiving module is configured to receive an operation resource create request before the retrieving module retrieves the change result of the content of the subject resource stored in the apparatus, where the operation resource create request includes the representation of the operation resource associated with the subject resource and the uniform resource identifier of the operation resource set to which the operation resource belongs, and the receiving module adds the representation of the operation resource to the operation resource set according to the uniform resource identifier of the operation resource set to which the operation resource belongs.

In addition, in the foregoing embodiment of the present invention, the representation of the operation resource further includes a type of the operation request and an input parameter of the operation request, where the type of the operation request is create or update; and.

In addition, the receiving module in the foregoing operation triggering apparatus for machine-to-machine communications is further configured to receive an operation resource update request before the retrieving module retrieves the change result of the content of the subject resource stored in the service capability middleware, where the operation resource update request includes a representation of a new operation resource, where the representation of the new operation resource includes a representation of a dependency resource or a uniform resource identifier of a dependency resource, and is configured to update the stored representation of the operation resource to the representation of the new operation resource; or
the receiving module is further configured to receive a dependency resource create request before the retrieving module retrieves the change result of the content of the subject resource stored in the service capability middleware, where the dependency resource create request includes a representation of a dependency resource and a uniform resource identifier of a dependency resource set to which the dependency resource belongs, and is configured to save the representation of the dependency resource to the dependency resource set according to the uniform resource identifier of the dependency resource set to which the dependency resource belongs, and add the uniform resource identifier of the dependency resource set to the representation of the operation resource.

Further, in the technical solution in which the dependency resource exists, the foregoing apparatus may further include a determining module. The retrieving module is further configured to retrieve, according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, retrieve a representation of a condition resource that is pointed to by a uniform resource identifier in the representation of the dependency resource, and send the representation of the condition resource and a condition in the representation of the dependency resource to the determining module; and the determining module is configured to receive the representation of the condition resource, and determine, according to the representation of the condition resource, that the condition in the representation of the dependency resource is met.

Specifically, types of the dependency resource are classified into a sufficient condition type and a necessary condition type, and a dependency resource quantity is at least one; and before the constructing module constructs the operation request for the object resource in the representation of the operation resource, the determining module is further configured to determine that a condition specified by at least one dependency resource of the sufficient condition type is met; or before the constructing module constructs the operation request for the object resource in the representation of the operation resource, the determining module is further configured to determine that conditions specified by all dependency resources of the necessary condition type are met.

The association relationship between the operation resource and the dependency resource may be implemented in three manners. Specifically, that the retrieving module retrieves, according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, is specifically: retrieving, according to the representation of the dependency resource included in the representation of the operation resource, the representation of the dependency resource associated with the operation resource; or retrieving, according to the uniform resource identifier of the dependency resource included in the representation of the operation resource, the representation of the dependency resource associated with the operation resource; or retrieving, according to the uniform resource identifier, included in the representation of the operation resource, of the dependency resource set to which the dependency resource belongs, the representation of the dependency resource associated with the operation resource, where the representation of the dependency resource associated with the operation resource is a representation of a dependency resource included in the dependency resource set.

In the foregoing embodiment of the present invention, at least two operation resources are associated with the subject resource, representations of the operation resources further include priorities, and that the constructing module constructs the operation request for the object resource in the representation of the operation resource is specifically: constructing an operation request for an object resource in the representation of each operation resource in sequence according to the priorities in the representations of the operation resources.

In the foregoing embodiment of the present invention, the representation of the operation resource further includes an operation execution result, and the receiving module is further configured to receive an operation response returned by a device that the object resource is located, and save the operation response into the operation execution result in the representation of the operation resource; or.

In addition, an embodiment of the present invention further provides another operation triggering apparatus for machine-to-machine communications. <FIG> is schematic structural diagram <NUM> of an operation triggering apparatus for machine-to-machine communications according to an embodiment of the present invention. As shown in <FIG>, the operation triggering apparatus for machine-to-machine communications includes a network interface <NUM>, a processor <NUM>, and a memory <NUM>.

The network interface <NUM> is configured to perform communication with an external device; the memory <NUM> is configured to store an application program and store a representation of a subject resource, where the representation of the subject resource includes content of the subject resource and information about an operation resource associated with the subject resource; the processor <NUM> is configured to: invoke the application program stored in the memory; when the content of the subject resource is changed, retrieve a change result of the content of the subject resource stored in the memory, and retrieve, according to the information about the operation resource associated with the subject resource, a representation of the operation resource associated with the subject resource, where the representation of the operation resource includes a condition for sending an operation request to an object resource and a uniform resource identifier of the object resource; and when it is determined that the change result meets the condition for sending the operation request to the object resource in the representation of the operation resource, construct the operation request for the object resource; and
the network interface <NUM> is further configured to send the operation request to the object resource according to the uniform resource identifier of the object resource.

In the technical solution provided by the foregoing embodiment of the present invention, the network interface <NUM>, processor <NUM>, and memory <NUM> may be connected by a system bus <NUM>; when the content of the subject resource is changed, the service capability middleware that stores the change result of the content of the subject resource retrieves, according to the information about the operation resource associated with the subject resource, the representation of the operation resource associated with the subject resource, and constructs the operation request for the object resource in the representation of the operation resource, and finally sends the operation request to the object resource in the representation of the operation resource. The computer device in the foregoing embodiment of the present invention may be an M2M platform or gateway. Both the M2M platform and the gateway are nodes having capabilities in a network, and therefore a problem of capability restriction does not exist, which is advantageous for handling situations in which services cannot be performed in restricted environments.

In the foregoing embodiment of the present invention, the information about the operation resource associated with the subject resource is the representation of the operation resource associated with the subject resource, and that the processor retrieves, according to the representation of the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the representation of the operation resource included in the representation of the subject resource, the representation of the operation resource associated with the subject resource; or the information about the operation resource associated with the subject resource is a uniform resource identifier of the operation resource associated with the subject resource, and that the processor retrieves, according to the representation of the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the uniform resource identifier of the operation resource included in the representation of the subject resource, the representation of the operation resource associated with the subject resource; or the information about the operation resource associated with the subject resource is a uniform resource identifier of an operation resource set to which the operation resource associated with the subject resource belongs, and that the processor retrieves, according to the representation of the subject resource, a representation of the operation resource associated with the subject resource, is specifically: retrieving, according to the uniform resource identifier, included in the representation of the subject resource, of the operation resource set to which the operation resource belongs, the representation of the operation resource associated with the subject resource, where the representation of the operation resource associated with the subject resource is a representation of an operation resource included in the operation resource set.

In addition, the network interface is further configured to receive a subject resource update request, where the subject resource update request includes a representation of a new subject resource and a uniform resource identifier of the subject resource to be updated, where the representation of the new subject resource includes information about an operation resource associated with the new subject resource, and the processor invokes the application program stored in the memory to update the stored representation of the subject resource to the representation of the new subject resource according to the uniform resource identifier of the subject resource to be updated; or the network interface is further configured to receive an operation resource create request, where the operation resource create request includes the representation of the operation resource associated with the subject resource and the uniform resource identifier of the operation resource set to which the operation resource associated with the subject resource belongs, and the processor invokes the application program stored in the memory to add the representation of the operation resource to the operation resource set according to the uniform resource identifier of the operation resource set to which the operation resource belongs.

In the foregoing embodiment of the present invention, the representation of the operation resource further includes a type of the operation request and an input parameter of the operation request, where the type of the operation request is create or update; and.

In the foregoing embodiment of the present invention, the network interface is further configured to receive an operation resource update request, where the operation resource update request includes a representation of a new operation resource, where the representation of the new operation resource includes a representation of a dependency resource or a uniform resource identifier of a dependency resource, and the processor invokes the application program stored in the memory to update the stored representation of the operation resource to the representation of the new operation resource; or the network interface is further configured to receive a dependency resource create request, where the dependency resource create request includes a representation of a dependency resource and a uniform resource identifier of a dependency resource set to which the dependency resource belongs, and the processor invokes the application program stored in the memory to save the representation of the dependency resource to the dependency resource set according to the uniform resource identifier of the dependency resource set to which the dependency resource belongs, and add the uniform resource identifier of the dependency resource set to the representation of the operation resource.

Further, the processor in the foregoing embodiment further retrieves, according to the representation of the operation resource, the representation of the dependency resource associated with the operation resource, retrieves a representation of a condition resource that is pointed to by a uniform resource identifier in the representation of the dependency resource, and determines, according to the representation of the condition resource, that a condition in the representation of the dependency resource is met.

Types of the dependency resource are classified into a sufficient condition type and a necessary condition type, a dependency resource quantity is at least one, and before constructing the operation request for the object resource in the representation of the operation resource, the processor further determines that a condition specified by at least one dependency resource of the sufficient condition type is met (that is, the processor constructs the operation request for the object resource in the representation of the operation resource when determining that a condition specified by at least one dependency resource of the sufficient condition type is met); or before constructing the operation request for the object resource in the representation of the operation resource, the processor further determines that conditions specified by all dependency resources of the necessary condition type are met (that is, the processor constructs the operation request for the object resource in the representation of the operation resource when determining that conditions specified by all dependency resources of the necessary condition type are met).

The processor retrieves, according to the representation of the dependency resource included in the representation of the operation resource, the representation of the dependency resource associated with the operation resource; or retrieves, according to the uniform resource identifier of the dependency resource included in the representation of the operation resource, the representation of the dependency resource associated with the operation resource; or retrieves, according to the uniform resource identifier, included in the representation of the operation resource, of the dependency resource set to which the dependency resource belongs, the representation of the dependency resource associated with the operation resource, where the representation of the dependency resource associated with the operation resource is a representation of a dependency resource included in the dependency resource set.

In addition, at least two operation resources are associated with the subject resource, representations of the operation resources further include priorities, and the processor constructs an operation request for an object resource in the representation of each operation resource in sequence according to the priorities in the representations of the operation resources.

The representation of the operation resource further includes an operation execution result, the network interface is further configured to receive an operation response returned by the device in which the object resource is located, and the processor saves the operation response into the operation execution result in the representation of the operation resource; or
the representation of the operation resource further includes an address reflecting an operation execution result and the operation execution result, the network interface is further configured to receive an operation response returned by the device in which the object resource is located, and the processor retrieves, according to the address reflecting the operation execution result, an operation result corresponding to the operation request, and saves the operation result corresponding to the operation request into the operation execution result.

Claim 1:
A method, comprising:
storing, by a service capability middleware, a representation of a subject resource, wherein the representation of the subject resource comprises content of the subject resource and information about an operation resource associated with the subject resource, wherein the service capability middleware is integrated in a gateway or a M2M service platform;
detecting, by the service capability middleware, change of the content of the subject resource according to the representation of the subject resource by listening on a program of the subject resource;
determining, by the service capability middleware, that the change result meets a condition for sending an operation request to an object resource ;
sending, by service capability middleware, the operation request to the object resource according to a uniform resource identifier of the object resource, wherein the condition and the uniform resource identifier of the object resource are retrieved according to the information about an operation resource associated with the subject resource.