Methods and apparatus for data querying
By including time range information in the query request, the range of data to be transmitted by the server and client can be determined, and a query method with a smaller data volume can be selected, thus solving the problem of insufficient flexibility in the existing technology and realizing a more efficient data query process.
Patent Information
- Application Number
- CN202110473082.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-29
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2041-04-29
AI Technical Summary
Existing client-side and server-side query methods lack flexibility when faced with dynamically changing client-side and server-side keywords, resulting in an inflexible data query process and high communication overhead.
By including time range information in the query request, it is determined that the data to be transmitted by both the server and the client is limited to this time range. The target query method is selected based on the amount of data in the two query methods, and the method with smaller data volume is given priority for data query.
It improves the flexibility of the data query process, reduces communication overhead, and lowers the complexity of the implementation process and signaling overhead.
Smart Images

Figure CN115269641B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a method and apparatus for data querying. Background Technology
[0002] Data querying is a basic need for users in the mobile internet era. Users can obtain query results related to keywords by searching for those keywords.
[0003] Current query methods include client-side and server-side queries. The client stores the keywords to be queried, while the server stores data records. These data records include the keywords for the client to query, and optionally, also include the corresponding data content. In the client-side query method, the server sends its data records to the client, which then compares its locally stored keywords with those in the server's data records to obtain the query results. In the server-side query method, the client sends its locally stored keywords to the server, which then compares these received keywords with those in its data records to obtain the query results.
[0004] In some scenarios, the keywords on the client side and the keywords on the server side are dynamic and uncertain. Relying solely on client-side or server-side query methods reduces the flexibility of the data query process.
[0005] Therefore, there is a need to provide a technology to improve the flexibility of the data query process. Summary of the Invention
[0006] This application provides a method and apparatus for data querying. By carrying time information indicating a time range in the query request, the two types of data to be transmitted when querying data using server-side querying and client-side querying can be limited to this time range. The final target query method can be determined according to the amount of the two types of data to be transmitted, thereby improving the flexibility of the data querying process.
[0007] Firstly, a method for data querying is provided, including:
[0008] Receive a query request sent by a client, the query request including time information for indicating a time range;
[0009] Based on the query request, a target query method is determined, wherein the target query method is either a server-side query method or a client-side query method. The target query method is obtained based on a first data volume and a second data volume. The first data volume is the data volume of a first set of data to be transmitted, and the second data volume is the data volume of a second set of data to be transmitted. The first data to be transmitted is the data that the client needs to transmit when performing a data query using the server-side query method. The first data to be transmitted includes a first set of keywords stored by the client, and the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that the server needs to transmit when performing a data query using the client-side query method. The second data to be transmitted includes a second set of keywords stored by the server, and the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0010] A response message is sent to the client, the response message including first information indicating the target query method.
[0011] The first keyword set includes at least one keyword, which is a keyword in the client's keyword set A whose time falls within the specified time range. Keyword set A can include all keywords from the client. The second keyword set includes at least one keyword, which is a keyword in the server's keyword set B whose time falls within the specified time range. Keyword set B can include all keywords from the server.
[0012] The data query method provided in this application includes time information indicating a time range in the query request. Based on this time range, both the first data to be transmitted when querying data using a server-side query method and the second data to be transmitted when querying data using a client-side query method are limited to this time range. Specifically, the time corresponding to the keywords in the first set of keywords in the first data to be transmitted belongs to this time range, and the time corresponding to the keywords in the second set of keywords in the second data to be transmitted belongs to this time range. The server determines the target query method based on the data volume of the two data to be transmitted and instructs the client on the target query method through a response message. In scenarios where the keywords on the client and server sides change dynamically over time, compared to the prior art where only one query method is used by default, associating the time range with both server-side and client-side keywords narrows the keyword query scope. This allows for a more accurate determination of the data volume corresponding to each of the two query methods, and further, the determination of the target query method based on the data volume of the two data to be transmitted effectively improves the flexibility of the data query process.
[0013] Optionally, the target query method is the query method corresponding to the data to be transmitted that has the smaller data volume between the first data volume and the second data volume.
[0014] The data query method provided in this application embodiment, when the first data volume of the first data to be transmitted and the second data volume of the second data to be transmitted are different, the server determines the query method corresponding to the data to be transmitted with the smaller data volume of the two data volumes as the target query method. While improving flexibility, it can effectively reduce the data volume of the data to be transmitted during the transmission process, thereby effectively reducing communication overhead.
[0015] Optionally, the keywords in the first keyword set are the same as the keywords in the second keyword set; or,
[0016] The keywords in the first keyword set are obtained based on the keywords in the second keyword set; or,
[0017] The keywords in the second keyword set are obtained based on the keywords in the first keyword set.
[0018] In other words, the keywords in the first keyword set are those in keyword set A that are related to keyword set B and fall within the time range, while the keywords in the second keyword set are those in keyword set B that are related to keyword set A and fall within the time range.
[0019] If the element attributes of the keywords in the first key set are the same as those in the second key set, then the keywords in the first key set are the same as those in the second key set. For example, the element attributes of the keywords are both public keys or device identifiers.
[0020] When the element attributes of the keywords in the first keyword set are different from those in the second keyword set, the keywords in the first keyword set are derived from the keywords in the second keyword set, and vice versa. For example, one keyword set may have an element attribute of device identifier, while the other keyword set may have an element attribute of random code.
[0021] The data query method provided in this application provides that by making the keywords in the first keyword set and the second keyword set relevant, effective data for data query can be obtained. As a result, the amount of data obtained in the first data to be transmitted and the second data to be transmitted is small, the estimation result is more accurate, and the communication overhead is smaller.
[0022] Optionally, the second data to be transmitted may also include the data content corresponding to each keyword in the second keyword set.
[0023] Optionally, the target query method is the client query method; and,
[0024] The response message also includes at least a portion of the data in the second data to be transmitted.
[0025] The data query method provided in this application, when the target query method is a client query method, can reduce the number of interactions between the client and the server by indicating the target query method and at least part of the data carrying the second data to be transmitted in a response message, so as to minimize signaling overhead and reduce the complexity of the implementation process.
[0026] Optionally, the target query method is the server-side query method; and,
[0027] The response message also includes query result information, which includes query results corresponding to each keyword in at least a portion of the keywords in the first keyword set.
[0028] The data query method provided in this application, when the target query method is a server-side query method, can reduce the number of interactions between the client and the server by indicating the target query method and carrying query result information in a single response message, thereby minimizing signaling overhead and reducing the complexity of the implementation process.
[0029] Optionally, the query request further includes the first set of keywords; or,
[0030] The query request also includes a third set of keywords, which includes the first set of keywords.
[0031] Optionally, the query request may also include at least one of the following:
[0032] The time interval used to generate the keywords in the first keyword set; or,
[0033] The size of the keywords in the first keyword set; or,
[0034] Seed data used to generate keywords in the first keyword set; or,
[0035] The number of keywords included in the first keyword set.
[0036] Secondly, a method for data querying is provided, including:
[0037] Send a query request to the server, the query request including time information for indicating a time range;
[0038] The system receives a response message sent by the server. The response message includes first information indicating the target query method, wherein the target query method is either a server-side query method or a client-side query method. The target query method is derived based on a first data volume and a second data volume. The first data volume is the data volume of a first set of data to be transmitted, and the second data volume is the data volume of a second set of data to be transmitted. The first data to be transmitted is the data that needs to be transmitted by the client when performing a data query using the server-side query method. The first data to be transmitted includes a first set of keywords stored by the client, and the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that needs to be transmitted by the server when performing a data query using the client-side query method. The second data to be transmitted includes a second set of keywords stored by the server, and the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0039] Optionally, the target query method is the query method corresponding to the data to be transmitted that has the smaller data volume between the first data volume and the second data volume.
[0040] Optionally, the keywords in the first keyword set are the same as the keywords in the second keyword set; or,
[0041] The keywords in the first keyword set are obtained based on the keywords in the second keyword set; or,
[0042] The keywords in the second keyword set are obtained based on the keywords in the first keyword set.
[0043] Optionally, the second data to be transmitted may also include the data content corresponding to each keyword in the second keyword set.
[0044] Optionally, the target query method is the client query method; and,
[0045] The first response message also includes at least a portion of the data in the second data to be transmitted.
[0046] Optionally, the target query method is the server-side query method; and,
[0047] The first response message also includes query result information, which includes query results corresponding to each keyword in at least a portion of the keywords in the first keyword set.
[0048] Optionally, the query request further includes the first set of keywords; or,
[0049] The query request also includes a third set of keywords, which includes the first set of keywords.
[0050] Optionally, the query request may also include at least one of the following:
[0051] The time interval used to generate the keywords in the first keyword set; or,
[0052] The size of the keywords in the first keyword set; or,
[0053] Seed data used to generate keywords in the first keyword set; or,
[0054] The number of keywords included in the first keyword set.
[0055] Thirdly, an apparatus for data querying is provided, the apparatus being used to perform the method provided in either the first or second aspect described above. Specifically, the apparatus may include modules for performing any possible implementation of either the first or second aspect described above.
[0056] Fourthly, an apparatus for data querying is provided, including a processor. The processor is coupled to a memory and can be used to execute instructions in the memory to implement the method in any possible implementation of either the first or second aspect described above. Optionally, the apparatus further includes a memory. Optionally, the apparatus further includes a communication interface, to which the processor is coupled.
[0057] Fifthly, a system for data querying is provided, comprising a server and a client, wherein the server is configured to execute a method as described in any possible implementation of the first aspect; and the client is configured to execute a method as described in any possible implementation of the second aspect.
[0058] In a sixth aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a device, causes the device to implement the method in any possible implementation of either the first or second aspect described above.
[0059] In a seventh aspect, a computer program product comprising instructions is provided, which, when executed by a computer, cause a device to implement the method in any possible implementation of either the first or second aspect described above.
[0060] Eighthly, a chip is provided, comprising: an input interface, an output interface, a processor, and a memory, wherein the input interface, the output interface, the processor, and the memory are connected via an internal connection path, and the processor is configured to execute code in the memory, wherein when the code is executed, the processor is configured to execute a method in any possible implementation of either the first or second aspect described above. Attached Figure Description
[0061] Figure 1 This is a schematic diagram of the data system provided in the embodiments of this application.
[0062] Figure 2 This is a schematic flowchart illustrating the server-side query method provided in the embodiments of this application.
[0063] Figure 3 This is a schematic flowchart illustrating the client query method provided in the embodiments of this application.
[0064] Figure 4 This is a schematic diagram illustrating a method for data querying in a scenario of searching for lost or offline devices, as provided in an embodiment of this application.
[0065] Figure 5 This is a schematic diagram of a method for data querying in a contact tracking scenario provided in an embodiment of this application.
[0066] Figure 6 This is a schematic flowchart of a data query method 600 provided in an embodiment of this application.
[0067] Figure 7 This is a schematic block diagram of a data query apparatus provided in an embodiment of this application.
[0068] Figure 8 This is a schematic structural diagram of a data query apparatus provided in an embodiment of this application. Detailed Implementation
[0069] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0070] Figure 1 This application provides a schematic diagram of a data system. The data system 100 includes a client 110 and a server 120. The client 110 can connect to the server 120 via a wired or wireless network.
[0071] Client 110 has functions for requesting data query, data storage, and data query. For example, client 110 can be a mobile phone, tablet computer, e-reader, personal computer, in-vehicle equipment, wearable device, smart home device, router, gateway, or other device that can directly interact with the user.
[0072] In this embodiment of the application, the client 110, as a device that directly interacts with the user, stores multiple keywords for data querying.
[0073] Server 120 has data query functions, data storage, and determines the query method based on query requests sent from client 110. Server 120 can be a computing device or server, or other device used for querying data. For example, server 120 can be a server in a remote server cluster running in data centers in various locations.
[0074] In this embodiment of the application, the server 120 stores multiple data records, each data record including keywords for the client 110 to query, and optionally, each data record also includes data content corresponding to the keywords.
[0075] Data records can be stored in devices in various forms. For example, data records can be stored as files, with each data record constituting a file, the keyword serving as the file name, and the data content as the file content. Another example is that data records can be stored in devices as data tables. For ease of description, the following text will consistently use data tables as an example to describe data records.
[0076] Table 1 is an example of a server-side data table provided in an embodiment of this application. Referring to Table 1, each row of data in the data table represents a data record. Table 1 includes m data records, each data record including a keyword and corresponding data content. For example, taking the keyword as a public key and the data content as a location as an example, a data record includes a public key and the location corresponding to that public key. Of course, if there is no data content in Table 1, a data record includes a keyword.
[0077] Table 1
[0078] Keywords Data content key-1 data-1 key-2 data-2 … … key-k data-k … … key-m data-m
[0079] In some embodiments, the client 110 may send a query request including keywords to the server 120, and the server 120 performs a data query based on the query request and the keywords in its data records.
[0080] In other embodiments, server 120 may send multiple data records stored on server 120 to client 110, and client 110 may perform data query based on keywords in the received data records and keywords stored on client 110.
[0081] In other embodiments, client 110 may send a query request to server 120 including time information indicating a time range, where the time range is a period of time. Based on the query request, server 120 restricts both the client's keywords and the server's keywords to this time range, so as to determine the query method for data query based on the keywords in the server and client within this time range, and instructs the query method to client 110, so that client 110 and server 120 use the query method to perform data query.
[0082] It should be understood that Figure 1 The data system shown is for illustrative purposes only and should not be construed as limiting the scope of the embodiments described in this application. The data system may include multiple clients 110 and multiple servers 120, and the types of clients 110 may be the same or different.
[0083] This application's embodiments involve two query methods, including client-side query and server-side query. Below, we will combine... Figures 2 to 5 Taking a keyword to be queried on the client side as an example, this paper provides a detailed description of the client-side query method and the server-side query method.
[0084] Furthermore, for ease of description, we define a keyword set A for the client and a keyword set B for the server. Keyword set A includes multiple keywords stored on the client, and keyword set B includes multiple keywords stored on the server.
[0085] Server-side query method
[0086] In the server-side query method, the data query process is mainly implemented by the server.
[0087] Figure 2 This is a schematic flowchart illustrating the server-side query method provided in the embodiments of this application.
[0088] In S210, the client sends a query request to the server, which includes keywords.
[0089] Correspondingly, the server receives the query request.
[0090] This query request is used to retrieve the query results from the server, so that the server can respond with the results based on the query request. This query request includes a Uniform Resource Locator (URL).
[0091] The client stores a set of keywords A, and the keyword in the query request is any keyword in the set of keywords A.
[0092] In S220, the server performs a data query based on the query request and obtains the query results.
[0093] The server stores a set of keywords B. The server can compare the received keywords with the keywords in the set of keywords B stored on the server to obtain the query results.
[0094] If the server's keyword set B contains keywords related to the client's keyword, it means that the client's keyword is related to the server's keyword. In this case, the server can return query results that satisfy the query request. For example, query results that satisfy the query request may include the data content corresponding to the server's keyword and / or be represented by "yes". If the server's keyword set B does not contain keywords related to the client's keyword, it means that the client's keyword is not related to any of the server's keywords. In this case, the server can return query results that do not satisfy the query request. For example, query results that do not satisfy the query request may be an empty set and / or be represented by "no".
[0095] It should be noted that, in the embodiments of this application, the relationship between the client's keywords and the server's keywords means that the client's keywords match the server's keywords, or that the client's keywords match keywords derived from the server's keywords, or that keywords derived from the client's keywords match the server's keywords. For example, when the content of one keyword is part or all of the content of another keyword, the two keywords can be considered a match. For instance, if a client's keyword is 1011 and a server's keyword is also 1011, the two keywords have the same content, so they match. As another example, if a client's keyword is 1011 and a server's keyword is 1012, the two keywords have partially the same content, so they also match. For ease of description, in the following examples, the example of two keywords having the same content is used to represent a match.
[0096] In this embodiment, the element attributes of the client's keyword and the element attributes of the server's keyword can be the same or different. The element attributes of a keyword can be understood as the type of the keyword. For example, the element attributes of a keyword can be a public key, device identifier, random code, etc. The value of the element attribute represents the element content of the keyword. For example, if the element attribute of a keyword is a public key and the element content of the keyword is 1011, then 1011 is a value of the public key.
[0097] If the element attributes of the client-side keyword and the server-side keyword are the same, then the client-side keyword and the server-side keyword are considered related if they match. For example, if both the client-side and server-side keywords have the element attribute "public key," then the two public keys are considered related if they match.
[0098] When the element attributes of the client-side keywords differ from those of the server-side keywords, a keyword with the same element attributes as the client-side keywords can be calculated from the server-side keywords. Alternatively, a keyword with the same element attributes as the server-side keywords can be calculated from the client-side keywords. These two keywords with identical element attributes are then compared to obtain the query results. If the two keywords with the same element attributes match, the client-side keywords are considered related to the server-side keywords. For example, if the element attribute of the client-side keyword is "device identifier" and the element attribute of the server-side keyword is "random code," multiple device identifiers can be calculated from a single random code. Therefore, by comparing keywords with the element attribute "device identifier," if two device identifiers match, the client-side device identifier is considered related to the server-side random code.
[0099] Similarly, the statement in this application embodiment that the client's keywords are unrelated to the server's keywords means that the client's keywords do not match the server's keywords, or that the client's keywords do not match the keywords obtained based on the server's keywords, or that the server's keywords do not match the keywords obtained based on the keywords.
[0100] In some embodiments, based on the keyword comparison results, the query results can be expressed as "yes" or "no" to indicate different meanings and thus different query results. It should be understood that "yes" and "no" have different meanings in different application scenarios, as illustrated below.
[0101] For example, if the keywords on the client side and the keywords on the server side are related, the query result indicates that the query request is satisfied, and can be represented by "yes". If the keywords on the client side and the keywords on the server side are not related, the query result indicates that the query request is not satisfied, and can be represented by "no".
[0102] For example, in a contact tracing scenario, the server-side keywords are keywords related to the infected patient, say, the patient's random code. The client-side keywords are keywords related to the contact, say, the contact's device identifier. This contact is a user who has been in contact with user A who owns the client. User A wants to perform contact diagnosis, i.e., check if they have been in contact with an infected patient. The client can send its stored device identifier to the server. The server compares the patient's random code with the device identifier sent by the client. One random code can generate multiple device identifiers. If the server generates multiple device identifiers based on the random code and finds one that matches the client's device identifier, it means the server's random code is related to the client's device identifier, implying that user A has been in contact with the infected patient possessing that random code, and the query result can be "yes". If the server generates multiple device identifiers based on the random code and finds no matching device identifier, it means the server's random code is not related to the client's device identifier, implying that user A has not been in contact with the infected patient, and the query result can be "no".
[0103] In other embodiments, the server stores a keyword set B and the data content corresponding to each keyword in the keyword set B. This data content includes various aspects of the data entity corresponding to the keyword. The data entity represents an object possessing the keyword; for example, the data entity can be a user, a user's device, etc. Exemplarily, the data content may include the data entity's identification (ID), the data entity's name, the data entity's geographical location, the data entity's education level, the data entity's medical condition, etc.
[0104] In this embodiment, for example, when the client's keywords are related to the server's keywords, the query results can include the data content corresponding to the server's keywords. For instance, in a scenario of finding a lost or offline device, both the client's and server's keywords are public keys. The server stores multiple public keys and multiple locations, which represent the public keys and locations of multiple lost or offline devices. Each public key corresponds to one location, which is an example of the data content. The server's multiple public keys form a keyword set B, and the client stores the public key of a certain lost or offline device. If a user wants to find the location of their lost or offline device, taking a user's client's public key 11 as an example, if public key 11 exists in the server's keyword set B, it means that the client's public key 11 is related to the server's public key 11, and the query results include the location corresponding to the server's public key 11; if public key 11 does not exist in the server's keyword set B, the query results can be an empty set.
[0105] In other embodiments, the two query results described above can be used in combination.
[0106] For example, when the keywords on the client side and the keywords on the server side are related, the query result indicates that the query request is satisfied, and is represented by "Yes". The query result can also include data content corresponding to the keywords on the server side. For instance, in a contact tracing scenario, if user A wants to check whether they have been in contact with a patient with an illness, the query result can not only use "Yes" to indicate that user A has been in contact with a patient with an illness, but can also include specific details about the patient, such as the patient's illness, the duration of contact, distance, and risk level. If the keywords on the client side and the keywords on the server side are unrelated, the query result indicates that the query request is not satisfied, and can be represented by "No". In this case, user A can determine that they have not been in contact with a patient with an illness.
[0107] In S230, the server sends the query results to the client.
[0108] Correspondingly, the client receives the query result.
[0109] It should be understood that although the above describes the process of querying data based on a single keyword from the client, the process of querying data based on multiple keywords from the client is the same as the process of querying data based on a single keyword, and will not be repeated here.
[0110] When a client needs to query results for multiple keywords, in one example, in S210, the client can send a query request including the multiple keywords; in S220, the server can obtain the query results related to the multiple keywords; and in S230, the query results are sent to the client.
[0111] Client query method
[0112] In the client-side query method, the data query process is mainly implemented by the client.
[0113] Figure 3 This is a schematic flowchart illustrating the client query method provided in the embodiments of this application.
[0114] In S310, the client sends a query request to the server.
[0115] Correspondingly, the server receives the query request.
[0116] This query request is used to retrieve data from the server so that the server can respond with data based on the query request. The query request includes a URL.
[0117] In S320, the server responds to the query request by sending a response message to the client, which includes multiple data records.
[0118] Each data record includes a keyword, or each data record includes a keyword and the corresponding data content. In other words, multiple data records include multiple keywords, and these multiple keywords constitute a keyword set B.
[0119] In S330, the client performs a data query based on the response information and obtains the query results.
[0120] The client performs a data query based on the keywords stored locally and the keywords in the received keyword set B, and obtains the query results.
[0121] If the server's keyword set B contains keywords related to the client's keyword, it means that the client's keyword is related to the server's keyword, and the client can obtain query results that satisfy the query request. If the server's keyword set B does not contain keywords related to the client's keyword, it means that the client's keyword is not related to any of the server's keywords, and the client can obtain query results that do not satisfy the query request or an empty set of query results. For a detailed description of whether the client's keyword is related to or not related to the server's keyword, please refer to the relevant description of the server-side query method; it will not be repeated here.
[0122] Furthermore, for a detailed description of the query results, please refer to the relevant description of the server-side query method above, which will not be repeated here.
[0123] Additionally, it should be noted that when the data record does not include the data content, the query results will not involve the data content; when the data record includes the data content, the query results that satisfy the query request may include the data content.
[0124] For example, this application provides two scenarios for data querying: scenario 1 is the scenario of finding lost or offline devices, and scenario 2 is the scenario of contact tracing. The following describes the client query method and the server query method using scenario 1 and scenario 2 as examples.
[0125] Scenario 1: Finding a lost or offline device
[0126] This section explains the data query process in this scenario using server-side queries.
[0127] Device A and Device B belong to the same user. Device A is a lost or offline device, Device B is the client for data query in this embodiment of the application, and Device C is a third-party device used to help find the lost or offline device.
[0128] Figure 4 This is a schematic diagram illustrating a method for data querying in a scenario of searching for lost or offline devices, as provided in an embodiment of this application.
[0129] In the S410, when device A is lost or offline, it periodically broadcasts multiple public keys via Bluetooth so that they can be scanned by nearby devices.
[0130] For example, device A may be configured with seed data, which is used to generate multiple public keys. For instance, based on the seed data, public keys are generated periodically according to a certain calculation method. One public key is generated within one time period, and multiple public keys are generated over multiple time periods, and the multiple public keys are all different. For example, assuming the duration of the time period is 1 hour, then device A will generate one public key every 1 hour, and 24 public keys will be generated in 24 hours.
[0131] In S420, after device C scans for at least one public key of device A via Bluetooth, it encrypts the location of device C using each public key to obtain at least one encrypted location. The encrypted location and the at least one public key are then uploaded to the server. The at least one public key is some or all of the multiple public keys broadcast by device A.
[0132] Correspondingly, the server stores the encrypted location and public key.
[0133] In this system, the public key stored on the server is the server's keyword. The server stores multiple public keys, which together form a keyword set B. Keyword set B includes the public key of device A and the public keys of other devices. The location corresponds to the data content of the keyword (public key). It should be understood that device A is just one example of a lost or offline device. The public keys of other lost or offline devices will also be sent to the server by a nearby device C. Therefore, in addition to storing the public key and corresponding location of device A, the server also stores the public keys and corresponding locations of other lost or offline devices.
[0134] It should be understood that since equipment C is very close to equipment A, the position of equipment C can be considered as the position of equipment A.
[0135] It should be noted that device C near device A at different times may not be the same device. For example, device C1 may be near device A in time period 1, while device C2 may be near device A in time period 2. Therefore, different devices C will obtain device A's public key for different time periods, and different devices C will upload public keys for different time periods. Thus, at least one public key scanned and uploaded by device C is part or all of the multiple public keys generated by device A.
[0136] Continuing with the example of device A generating one public key every hour, let's say device A is lost or offline for 12 hours. For the first 8 hours, device C1 is near device A and uploads the 8 public keys and 8 encrypted locations to the server. For the next 4 hours, device C2 is near device A and uploads the 4 public keys and 4 encrypted locations to the server. Within 12 hours, device A generates 12 public keys. The two nearby devices C obtain public keys and locations for different time periods and upload them to the server. Device C1 or Device C2 can be any of the aforementioned devices C, receiving a portion of the multiple public keys generated by device A. Of course, if the same device C is near device A for 12 hours, then device C uploads all the public keys generated by device A.
[0137] In S430, if a user wants to locate device A, device B, acting as a client, generates multiple public keys according to preset rules and sends these public keys to the server. The server then uses the received public keys and the public keys in the keyword set B to query the location of device A.
[0138] Among them, the public key generated by device B is the client's key, and multiple public keys form the client's key set A.
[0139] It should be understood that Device B will generate the same public key as Device A according to the same preset rules as Device A. For example, it will periodically generate a public key based on the same seed data as Device A according to a certain calculation method.
[0140] In S440, the server sends query result information back to device B. This query result information includes at least one query result, and each query result includes a location. This location is encrypted with a public key, which is a public key associated with key set A and key set B.
[0141] The server compares the public keys in keyword set A with the public keys in keyword set B. If a public key in keyword set B matches the public key in keyword set A, the server returns the location encrypted by that public key, which is the public key that the query matches.
[0142] Correspondingly, device B receives the query result information and, using its locally stored private key, decrypts each location encrypted with the public key to obtain the decrypted location. Thus, it determines the location of device A at different times.
[0143] In this scenario, as time changes, the keywords on the client side become uncertain, as do the keywords on the server side, and the amount of keyword data on the client side may be very large.
[0144] Assume the periodic public key generation interval is 10 minutes, each public key is 32 bytes (B) long, and the encrypted location is 32 bytes long. If a user needs to view the location record details of device A over the past day, and the server stores a total of 80 data records, the amount of data for the keyword (public key) on the client (e.g., device B) within one day is 1 * 32 * 24 * 60 / 10 = 4680 bytes, while the amount of data for the data records (public key and location) on the server is (32 + 32) * 80 = 6400 bytes. In this case, using the server-side query method, the client needs to transmit approximately 5 kilobytes (KB) of data, resulting in low communication overhead. As time progresses, if a user needs to view the location records of device A over the past 90 days, and the server stores only 100 records within that period, then the amount of data for the keyword (public key) on the client (e.g., device B) over those 90 days would be 90 * 32 * 24 * 60 / 10 = 414720 bytes, while the amount of data for the records (public key and location) on the server would be (32 + 32) * 100 = 6400 bytes. In this case, if the server-side query method is continued, the client would need to transmit at least approximately 400 KB of data, resulting in significant communication overhead.
[0145] It should be understood that the data size of the client-transmitted data (e.g., client keywords) in the above scenario does not take into account the file header carrying the data information, nor does it consider the case of transmitting compressed data based on methods such as data compression. The explanation of the data transmitted by the server in the following text is the same as here, and will not be repeated here.
[0146] Scenario 2, Contact Tracking
[0147] This scenario could be a Bluetooth-based contact tracking scenario, and the data query process in this scenario will be explained through client-side queries.
[0148] In this scenario, each terminal device (client) generates multiple device identifiers to identify itself. To protect user privacy, these device identifiers can, for example, be anonymous identifiers (IDs). These anonymous IDs cannot be associated with a user's identity, and each terminal device has a unique anonymous ID. When multiple terminal devices are close together, they share each other's anonymous IDs. Suppose that a user of terminal device A (terminal devices A, B, C, and D) is diagnosed with an infectious disease. The user of terminal device A will upload at least one random code generated by terminal device A to the server. Based on one random code, multiple (e.g., 144) anonymous IDs can be obtained. The remaining terminal devices B, C, or D can periodically download the list of random codes uploaded by infected patients (including the user of terminal device A) from the server. They then obtain a list of anonymous IDs using the random codes in the list of random codes and query and match them with the locally stored anonymous IDs. If a match is found, it indicates that the user has been in contact with an infected patient (e.g., the user of terminal device A).
[0149] It should be noted that in this scenario, the patient uploads a random code associated with the anonymous ID via the device to save communication overhead. Data queries are then performed based on the anonymous ID calculated from the random code and the anonymous ID stored on the terminal device (client). If communication overhead is disregarded, the patient can directly upload the anonymous ID via the device, allowing data queries to be performed based on the anonymous ID stored on the server and the anonymous ID stored on the client.
[0150] In addition, only patients with the disease will upload a random code or anonymous ID through the device. Normal, healthy users do not need to upload a random code or anonymous ID through the device. This is necessary for contact diagnosis.
[0151] Below, using Device A and Device B as examples, a detailed explanation of the data query process in this scenario will be provided. User A is a user of Device A and is a patient; User B is a user of Device B and has had contact with User A.
[0152] Figure 5 This is a schematic diagram of a method for data querying in a contact tracking scenario provided in an embodiment of this application.
[0153] In S510, device A periodically generates multiple anonymous IDs and broadcasts these multiple anonymous IDs via Bluetooth; correspondingly, device B scans for at least one anonymous ID of device A via Bluetooth and stores the at least one anonymous ID, wherein the at least one anonymous ID is some or all of the multiple anonymous IDs broadcast by device A.
[0154] Device B acts as a client. The anonymous IDs stored on Device B are the client's keywords. Multiple anonymous IDs form a keyword set A, which includes the anonymous IDs of Device A. It should be understood that if user B on Device B has also been in close contact with users on other devices, Device B will also store the anonymous IDs of the scanned other devices locally. Therefore, keyword set A includes not only the anonymous IDs of Device A but also the anonymous IDs of other devices.
[0155] It should be noted that user A of device A may come into contact with different users at different times. Therefore, device B near device A at different times may not be the same device. For example, device B1 may be near device A in time period 1, while device B2 may be near device A in time period 2. Thus, different devices B will obtain anonymous IDs from device A at different times. Therefore, at least one anonymous ID scanned and stored by device B is part or all of the multiple anonymous IDs generated by device A.
[0156] For example, device A can periodically generate at least one random code. Based on each random code, a certain number of anonymous IDs will be periodically generated according to a certain calculation formula. One anonymous ID is generated within one time period, and multiple anonymous IDs are generated over multiple time periods. The multiple anonymous IDs are all different. For example, assuming the duration of the time period is 10 minutes, then device A will generate one anonymous ID every 10 minutes, and 144 anonymous IDs will be generated in 24 hours.
[0157] Furthermore, in the case where device A periodically generates multiple random codes, each random code is different, and each random code sequentially generates a certain number of corresponding anonymous IDs in chronological order. For example, device A periodically generates 3 random codes, and in chronological order, random code 1, random code 2, and random code 3 periodically generate a certain number of corresponding anonymous IDs.
[0158] Of course, since User B has been in contact with User A, Device B will also periodically generate multiple anonymous IDs via Bluetooth broadcast so that they can be scanned by nearby devices.
[0159] In S520, user A is diagnosed as a patient and sends at least one random code to the server through device A.
[0160] Correspondingly, the server stores the at least one random code.
[0161] In this step, device A periodically generates at least one random code and periodically sends the random code to the server.
[0162] The random codes stored on the server can be server-side keywords. The server stores multiple random codes, which together form a keyword set B. Keyword set B includes the random codes of device A and other devices. It should be understood that the user of device A is only one patient, and the random codes of other patients' devices will also be sent to the server. Therefore, in addition to storing the random codes of device A, the server also stores the random codes of other devices.
[0163] It should be noted that, as mentioned earlier, if communication overhead is not considered, User A will send the anonymous ID generated in S510 to the server via Device A, and the server will store the received anonymous ID. In this case, the multiple anonymous IDs stored by the server constitute a key set B, which includes Device A's anonymous ID and anonymous IDs from other devices.
[0164] In S530, user B needs to perform contact diagnosis. Device B, as a client, downloads multiple random codes (keyword set B) from the server.
[0165] In S540, device B performs contact diagnosis based on multiple downloaded random codes and locally stored anonymous IDs to determine whether user B has been in contact with a sick person.
[0166] Device B calculates multiple anonymous IDs from multiple random codes on the server. Device B compares these anonymous IDs with locally stored anonymous IDs. If any of the anonymous IDs on the server matches a locally stored anonymous ID, it means that User B of Device B has been in contact with the patient.
[0167] Taking anonymous ID1 from device A as an example, device B stores anonymous ID1. Multiple random codes from the server include random code 1 from device A. Multiple IDs obtained based on these random codes include anonymous ID1. In the implementation, device B compares these multiple anonymous IDs with the locally stored anonymous ID1. If one of these anonymous IDs matches anonymous ID1 (i.e., anonymous ID1), it indicates that a user of device B has been in contact with a patient (user A from device A).
[0168] In this scenario, as time changes, the keywords on the client side become uncertain, as do the keywords on the server side, and the amount of data recorded on the server side may be very large.
[0169] Assume a country has an average of 50,000 confirmed cases per day. An anonymous ID is 16 bytes long, generated every 10 minutes. Each infected person uploads a 16-byte random code daily, generating 144 corresponding anonymous IDs. If a user has only been in contact with one other infected person, and each infected person uploads a 16-byte random code to the server within one day, then the amount of data for the keyword (anonymous ID) on the user's client side within one day would be 1 * 16 * 24 * 60 / 10 = 14 * 16 * 144 = 2304 bytes. The amount of data for the keyword (random code) on the server side would be 1 * 50000 * 16 = 80000 bytes. In this scenario, using a client-side query method, the server only needs to transmit approximately 2KB of data, resulting in low communication overhead. If each patient uploads 14 random codes of 16 bytes each to the server within 14 days, then the amount of data for the keyword (anonymous ID) on the user's client within 14 days will be 14 * 16 * 24 * 60 / 10 = 14 * 16 * 144 = 32256 bytes, and the amount of data for the keyword (random code) on the server will be 14 * 50000 * 16 = 11200000 bytes. In this case, if the client query method is continued, the server will need to transmit at least approximately 11 megabytes (MB) of data, resulting in high communication overhead.
[0170] In summary, it can be seen that since both client-side and server-side keywords are dynamically changing and uncertain, relying solely on either client-side or server-side query methods for data retrieval results in low flexibility. Furthermore, in certain scenarios, this can lead to significant communication overhead.
[0171] Based on this, this application proposes a method for data querying. By narrowing both client-side and server-side keywords to a specific time range, the amount of data to be transmitted when querying using both client-side and server-side methods is determined. The final target query method is then determined based on the amount of data to be transmitted, thus improving the flexibility of the data query process. Optionally, selecting the query method corresponding to the smaller amount of data to be transmitted as the final target query method can effectively reduce communication overhead.
[0172] The following will continue to use the keyword set A and keyword set B defined above, combined with... Figure 6 The present application provides a detailed description of the data query method for data in its embodiments.
[0173] In the data query method of this application, because a time range is added, the client records not only the keywords but also the time corresponding to the keywords. That is, the client stores multiple data records, each including a keyword and a corresponding time, which represents the time when each data record was recorded.
[0174] Table 2 is an example of a client-side data table provided in an embodiment of this application. Table 2 shows n data records, where n is an integer greater than 0. Each of the n data records includes n keywords, and each keyword corresponds to a time. It should be understood that each row of data in Table 2 represents one data record. Taking the first data record (the first row of data) as an example, this data record includes key-1 and the corresponding time t-1. Furthermore, the n keywords in Table 2 constitute a keyword set A.
[0175] Table 2
[0176] Keywords time key-1 t-1 key-2 t-2 … … <![CDATA[Key-k1]]> <![CDATA[t-k1]]> … … <![CDATA[key-k2]]> <![CDATA[t-k2]]> … … key-n tn
[0177] Similarly, the server also stores multiple data records. Each data record includes a keyword and a corresponding time, which indicates when the record was created. Optionally, each data record may also include data content corresponding to the keyword. For a detailed description of the data content, please refer to the relevant description above, which will not be repeated here.
[0178] Table 3 is an example of a server-side data table provided in an embodiment of this application. Table 3 shows m data records, where m is an integer greater than 0. Each of the m data records includes m keywords, and each keyword corresponds to a time. Furthermore, the m keywords in Table 3 constitute a keyword set B.
[0179] Table 3
[0180] Keywords time key-1 t-1 key-2 t-2 … … <![CDATA[key-k1]]> <![CDATA[t-k1]]> … … <![CDATA[key-k2]]> <![CDATA[t-k2]]> … … <![CDATA[key-k3]]> <![CDATA[t-k3]]> … … key-m tm
[0181] Table 4 is another example of a server-side data table provided in the embodiments of this application. Table 4 shows m data records, each data record including a keyword, the corresponding time, and the corresponding data content. That is to say, compared with Table 3, the data records in Table 4 not only include keywords and time, but also the data content corresponding to the keywords.
[0182] Table 4
[0183] Keywords time Data content key-1 t-1 data-1 key-2 t-2 data-2 … … … <![CDATA[key-k1]]> <![CDATA[t-k1]]> <![CDATA[data-k1]]> … … … <![CDATA[key-k2]]> <![CDATA[t-k2]]> <![CDATA[data-k2]]> … … … <![CDATA[key-k3]]> <![CDATA[t-k3]]> <![CDATA[data-k3]]> … … … key-m tm data-m
[0184] Figure 6 This is a schematic flowchart of a data query method 600 provided in an embodiment of this application.
[0185] In S610, the client sends a query request that includes time information indicating a time range.
[0186] Correspondingly, the server receives the query request.
[0187] The time range can be determined based on the user's query requirements and is a period of time, which can be represented by a start time and an end time. For example, if a user wants to query the data records of a lost device between October 1, 2020 and October 7, 2020, then the time range could be [2020 / 10 / 1, 2020 / 10 / 7].
[0188] The query request is used to determine the amount of data the client needs to transmit when querying data using a server-side query method, and also to determine the amount of data the server needs to transmit when querying data using a client-side query method. For ease of description, the data the client needs to transmit when querying data using a server-side query method is defined as the first data to be transmitted, and the amount of the first data to be transmitted is defined as the first data volume. The data the server needs to transmit when querying data using a client-side query method is defined as the second data to be transmitted, and the amount of the second data to be transmitted is defined as the second data volume. It should be understood that data volume represents the size of the data; for example, data volume can be represented using B, KB, MB, GB, etc.
[0189] For client-side queries, the server can determine the second data volume of the second data to be transmitted based on the time range in the query request and the server's keyword set B, which will be described in detail later.
[0190] Regarding the server-side query method, the server can determine the first data volume of the first data to be transmitted based on the query request. The first data to be transmitted is related to the keyword set A and the time range. Therefore, the query request not only includes time information to indicate the time range, but also content related to the keyword set A to determine the first data volume.
[0191] In some embodiments, the query request includes time information and a third set of keywords (i.e., keyword set A). Thus, the server can determine the first data to be transmitted based on keyword set A and the time range, thereby determining the first data volume, which will be explained in detail later.
[0192] In other embodiments, the query request includes time information and a keyword set A*, where keywords in keyword set A* are keywords in keyword set A whose times fall within a time range. In other words, the time corresponding to each keyword in keyword set A* belongs to that time range. Thus, the server can determine the first data to be transmitted based on keyword set A*, thereby determining the first data volume, which will be explained in detail later.
[0193] Taking the keyword set A consisting of n keywords as shown in Table 2 as an example, the keywords in Table 2 are recorded sequentially from top to bottom according to time. Assume the time range is [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7]. The time range from time t-1 to time t-k2 in Table 2 belongs to this time range, resulting in the keyword set A* as shown in Table 5. Keyword set A* = [key-1, ..., key-k2], including k2 keywords, each corresponding to a time range [t1, t2]. In this example, keyword set A* is a subset of the keywords in keyword set A.
[0194] Table 5
[0195] Keywords time key-1 t-1 … … <![CDATA[key-k1]]> <![CDATA[t-k1]]> … … <![CDATA[key-k2]]> <![CDATA[t-k2]]>
[0196] In other embodiments, the query request further includes at least one of the following: the time interval for generating keywords in the keyword set A*; or, the size of the keywords in the keyword set A*; or, seed data for generating keywords in the keyword set A*; or, the number of keywords included in the keyword set A*. Thus, the server can determine the data volume of the keyword set A* based on this at least one of the following, thereby determining the first data volume, which will be explained in detail later.
[0197] Here, the time interval represents the time interval between generating two adjacent keywords, denoted as time t, indicating that a keyword is generated at intervals of time t. The keyword size represents the size of each keyword in the keyword set A*. In some cases, the keyword sizes are the same, so the keyword sizes can be included in the query request. Seed data is used to generate multiple keywords in the keyword set A*. In other words, seed data can be understood as an initial keyword used to generate multiple keywords in the keyword set A*. For example, multiple keywords can be obtained based on the seed data according to a certain calculation method. For instance, the seed data can be the data used to generate multiple public keys mentioned above.
[0198] In S620, the server determines the target query method based on the query request. The target query method is either a server-side query method or a client-side query method. The target query method is obtained based on a first data volume and a second data volume. The first data volume is the data volume of the first data to be transmitted, and the second data volume is the data volume of the second data to be transmitted. The first data to be transmitted is the data that the client needs to transmit when querying data using the server-side query method. The first data to be transmitted includes a first set of keywords stored by the client, and the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that the server needs to transmit when querying data using the client-side query method. The second data to be transmitted includes a second set of keywords stored by the server, and the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0199] For example, in the implementation, the server can determine the first data volume of the first data to be transmitted and the second data volume of the second data to be transmitted based on the query request, and determine the target query method according to the first data volume and the second data volume. The process will be described in detail later.
[0200] Below, we will first explain the first set of keywords and the second set of keywords.
[0201] In some embodiments, the element attributes of the keywords in the first keyword set are the same as those of the keywords in the second keyword set. For example, the element attributes of both the keywords in the first keyword set and the keywords in the second keyword set are public keys or device identifiers; for instance, the device identifier can be an anonymous ID.
[0202] In other embodiments, the element attributes of the keywords in the first keyword set are different from those of the keywords in the second keyword set. In this embodiment, the keywords in the two keyword sets are converted into keywords with the same element attributes for matching to perform data querying.
[0203] For example, the element attribute of the keywords in the first keyword set is the device identifier, and the element attribute of the keywords in the second keyword set is the random code. The corresponding device identifier is obtained through the random code, and the device identifier is used for matching to perform data query.
[0204] To facilitate the description of the first and second keyword sets, we define the client's keyword set A*, the client's keyword set A', the server's keyword set B*, and the server's keyword set B'. First, we will describe these four keyword sets.
[0205] For a detailed description of keyword set A*, please refer to the relevant description above, which will not be repeated here. It is important to emphasize that keyword set A* is related to the time range and is unrelated to the content of elements in keyword set B. It can be some or all of the keywords in keyword set A.
[0206] Keyword set A' is some or all of the keywords in keyword set A, including at least one keyword. The keywords in keyword set A' are those in keyword set A that are related to keyword set B and fall within a specific time range. In other words, the keywords in keyword set A' are related to the time range, the element content of keyword set A and keyword set B, and are obtained by considering both the time and element dimensions. Or, the keywords in keyword set A' are the intersection of keyword set A and keyword set B in both the time and element dimensions.
[0207] Taking keyword set A (consisting of n keywords as shown in Table 2) and keyword set B (consisting of m keywords as shown in Table 3) as examples, the keywords are recorded sequentially from top to bottom according to time. Assume that the element attributes of keyword set A and keyword set B are the same, and that the keywords from key-1 to key-k1 in both sets are identical. The time range is [t1, t2]. The time range from time t-1 to time t-k2 in Table 2 and the time range from time t-1 to time t-k3 in Table 3 both fall within this time range. Therefore, we obtain keyword set A' as shown in Table 6, where keyword set A' = [key-1, ..., key-k1], including the keyword k1, because the keywords after key-k1 in the two sets are not identical.
[0208] Table 6
[0209] Keywords time key-1 t-1 … … <![CDATA[key-k1]]> <![CDATA[t-k1]]>
[0210] Keyword set B* consists of keywords in keyword set B whose times fall within the specified time range. It includes some or all of the keywords in keyword set B, containing at least one keyword, and each keyword's corresponding time falls within this time range. The keywords in keyword set B* are related to the time range but are unrelated to the content of elements in keyword set A.
[0211] Taking the m keywords shown in Table 3 as an example, the keywords in Table 3 are recorded sequentially from top to bottom according to time. Continuing to assume the time range is [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7], the time from time t-1 to time t-k3 in Table 3 belongs to this time range. Therefore, we obtain the keyword set B* as shown in Table 7, where keyword set B* = [key-1, ..., key-k3], including k3 keywords, and the time corresponding to each keyword belongs to the time range [t1, t2]. In this example, keyword set B* is a subset of the keywords in keyword set B.
[0212] Table 7
[0213]
[0214]
[0215] Keyword set B' is some or all of the keywords in keyword set B, including at least one keyword. The keywords in keyword set B' are those in keyword set B that are related to keyword set A and fall within a specific time range. In other words, the keywords in keyword set B' are related to the time range, the element content of keyword set A and keyword set B, and are obtained by considering both the time and element dimensions. Or, the keywords in keyword set B' are the intersection of keyword set A and keyword set B in both the time and element dimensions.
[0216] Continuing with the example of keyword set A (containing n keywords as shown in Table 2) and keyword set B (containing m keywords as shown in Table 3), the keywords are recorded sequentially from top to bottom according to time. Assume that keyword set A and keyword set B have the same element attributes, and that the keywords from key-1 to key-k1 in both sets are identical. The time range is [t1, t2]. The time range from t-1 to t-k2 in Table 2 and from t-1 to t-k3 in Table 3 both fall within this range. Therefore, keyword set B' = [key-1, ..., key-k1], as shown in Table 6 above. Since the keywords after key-k1 are not identical in both sets, it can be seen that if keyword set A and keyword set B have the same element attributes, then the keywords in keyword set B' and keyword set A' are completely identical.
[0217] In summary, in the first case, if the first keyword set and the second keyword set are related to the time range but not to the element content of keyword set A and keyword set B, then the first keyword set is keyword set A*, and the second keyword set is keyword set B*.
[0218] In the second case, if the first keyword set and the second keyword set are not only related to the time range, but also to the element content of keyword set A and keyword set B, then the first keyword set is keyword set A' and the second keyword set is keyword set B'.
[0219] In the second case, in one example, if the element attributes of keyword set A and keyword set B are the same, then the keywords in the first keyword set are the same as the keywords in the second keyword set. For example, the keywords in the first keyword set and the second keyword set are the keywords shown in Table 6 above.
[0220] In another example, if the element attributes of keyword set A and keyword set B are different, then the keywords in the first keyword set are related to the keywords in the second keyword set.
[0221] For example, the keywords in the first keyword set are derived from the keywords in the second keyword set. For instance, the element attribute of the first keyword set is anonymous ID (an example of a device identifier), and the element attribute of the second keyword set is random code. The first keyword set includes ID11, ID12, ID13, ID21, and ID22, and the second keyword set includes random code 1 and random code 2. 144 anonymous IDs can be derived unidirectionally from random code 1, including ID11, ID12, ID13, ..., ID1144. Similarly, 144 anonymous IDs can be derived unidirectionally from random code 2, including ID21, ID22, ID23, ..., ID2144. It can be seen that ID11, ID12, and ID13 in the first keyword set are derived from random code 1 in the second keyword set, and ID21 and ID22 in the first keyword set are derived from random code 2 in the second keyword set.
[0222] For example, the keywords in the second keyword set are obtained based on the keywords in the first keyword set. For instance, the element attribute of the second keyword set is M, the element attribute of the first keyword set is N, the second keyword set includes M11, M12, and M21, and the first keyword set includes N1 and N2. Through N1, we can obtain M11, M12, ..., M1n, and through N2, we can obtain M21, M22, ..., M2n. It can be seen that M11 and M12 in the second keyword set are obtained based on N1 in the first keyword set, and M21 in the second keyword set is obtained based on N2 in the first keyword set.
[0223] The first and second keyword sets have been described in detail above. Below, we will explain the various ways the server determines the first data volume of the first data to be transmitted and the second data volume of the second data to be transmitted based on different content of the query request.
[0224] Method 1
[0225] In this approach, the first set of keywords is keyword set A*, and the second set of keywords is keyword set B*.
[0226] The query request also includes at least one of the following: the time interval used to generate the keywords in the keyword set A*; or, the size of the keywords in the keyword set A*; or, seed data used to generate the keywords in the keyword set A*; or, the number of keywords included in the keyword set A*. Thus, the server can determine the data volume of the keyword set A* based on this at least one of the following, thereby determining the first data volume.
[0227] Determine the first data volume of the first data to be transmitted.
[0228] The first set of data to be transmitted includes a first set of keywords (keyword set A*).
[0229] In embodiments where the query request includes time information and a time interval, the keyword size and seed data can be pre-configured. The server can determine the data volume of keyword set A* based on the time information, the keyword size, the time interval, and the seed data, and use the data volume of keyword set A* as the first data volume. For example, the server can generate multiple keywords (e.g., keyword set A) according to the time interval based on the seed data. Based on the multiple keywords and the time range indicated by the time information, it obtains a keyword set A* whose time corresponds to that time range. Based on keyword set A* and the size of the keywords, it determines the data volume of keyword set A*, using keyword set A* as the first keyword set and its data volume as the first data volume. For example, this method can be applied to scenarios involving finding lost or offline devices.
[0230] In embodiments where the query request includes time information and keyword size, the time interval and seed data can be pre-configured. The server can determine the data volume of keyword set A* based on the time information, keyword size, time interval, and seed data, and use the data volume of keyword set A* as the first data volume. For a detailed description, please refer to the above description, which will not be repeated here. For example, this method can be applied to scenarios involving finding lost or offline devices.
[0231] In embodiments where the query request includes time information and seed data, the keyword size and time interval can be pre-configured. The server can determine the data volume of keyword set A* based on the time information, the keyword size, the time interval, and the seed data, and use the data volume of keyword set A* as the first data volume. For a detailed description, please refer to the above description, which will not be repeated here. For example, this method can be applied to scenarios involving the search for lost or offline devices.
[0232] In an embodiment where the query request includes time information and the number of keywords included in the keyword set A*, the size of the keywords can be pre-configured. The server can determine the data volume of the keyword set A* based on the number of keywords included in the keyword set A* and the size of the keywords, and use the data volume of the keyword set A* as the first data volume. The first data volume is obtained by multiplying the number of keywords and the size of the keywords. It should be understood that in this example, the server does not need to determine the specific content of the keywords in the keyword set A*; it can determine the first data volume based on the number and size of the keywords. For example, since the keywords (anonymous IDs) of the client in a contact tracing scenario are highly random, the method of determining the first data volume based on the data volume of keywords included in the query request can be well applied in contact tracing scenarios.
[0233] It should be understood that a query request may include various combinations of at least one of the above-mentioned contents, and combinations of various implementation methods in Reference Method 1 can all yield the first data volume.
[0234] Determine the second data volume of the second data to be transmitted.
[0235] In some embodiments, the second data to be transmitted includes a second set of keywords (keyword set B*).
[0236] The server determines the keyword set B* based on the keyword set B and the time range in the query request. It then determines the data volume of the keyword set B* based on the keyword set B* and the size of the keywords. The keyword set B* is used as the second set of data to be transmitted, and its data volume is used as the second data volume. For example, the keyword size can be pre-configured, and both the client and server know the keyword size. Taking the keyword set B in Table 3 and the time range [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7] as an example, the keyword set B* shown in Table 7 includes k3 keywords, each keyword is a bytes in size, and the second data volume = k3 * a.
[0237] In other embodiments, the second data to be transmitted includes a second keyword set (keyword set B*) and data content corresponding to each keyword in the second keyword set. The data content includes various aspects of the data entity corresponding to the keyword. The data entity represents an object possessing the keyword; for example, the data entity can be a user, a user's device, etc. Exemplarily, the data content may include the data entity's ID, name, geographical location, education level, and medical condition.
[0238] The server determines a keyword set B* based on the keyword set B and the time range in the query request. It then uses the data content corresponding to each keyword in keyword set B* and keyword set B* as the second set of data to be transmitted. The second data volume is determined based on the second set of data to be transmitted, the size of the keywords, and the size of the data content. For example, the size of the keywords and the size of the data content can be pre-configured and known to both the client and server.
[0239] For ease of description, the set of data content corresponding to each keyword in the keyword set B* is denoted as the data content set C*, and the data content in the data content set C* corresponds one-to-one with the keywords in the keyword set B*.
[0240] Taking the m keywords shown in Table 4 as an example to form a keyword set B, each keyword corresponds to one data content. Continuing to assume the time range is [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7], the keyword size is a bytes, and the data content size is b bytes. Based on the keyword set B and time range in Table 4, we obtain the keyword set B* shown in Table 8, the data content set C* = [data-1,…,data-k3], and the second data volume = k3*(a+b).
[0241] Table 8
[0242] Keywords time Data content key-1 t-1 data-1 key-2 t-2 data-2 … … … <![CDATA[key-k1]]> <![CDATA[t-k1]]> <![CDATA[data-k1]]> … … … <![CDATA[key-k2]]> <![CDATA[t-k2]]> <![CDATA[data-k2]]> … … … <![CDATA[key-k3]]> <![CDATA[t-k3]]> <![CDATA[data-k3]]>
[0243] Method 2
[0244] The query request includes time information and a keyword set A*.
[0245] Case 2-1: The first keyword set is keyword set A*, and the second keyword set is keyword set B*.
[0246] In other words, in scenario 2-1, the two types of data to be transmitted determined by the server are related to the time range, and the amount of data for each type of data to be transmitted is obtained.
[0247] Determine the first data volume of the first data to be transmitted.
[0248] The first set of data to be transmitted includes a first set of keywords (keyword set A*).
[0249] Based on the query request, the server determines the keyword set A*, and based on the size of the keywords and the keyword set A*, determines the data volume of the keyword set A*. The keyword set A* is then used as the first set of data to be transmitted, and its data volume is used as the first data volume. For example, the keyword size can be pre-configured, and both the client and server know the keyword size. Taking the keyword set A* in Table 5 as an example, if the keyword set A* includes k2 keywords and the size of each keyword is a bytes, then the first data volume = k2 * a.
[0250] Determine the second data volume of the second data to be transmitted.
[0251] In some embodiments, the second data to be transmitted includes a second set of keywords (keyword set B*).
[0252] In other embodiments, the second data to be transmitted includes a second set of keywords (keyword set B*) and the data content corresponding to each keyword in the second set of keywords. For a detailed description of how the server determines the amount of the second data, please refer to the relevant description in Method 1, which will not be repeated here.
[0253] Case 2-2: The first keyword set is keyword set A', and the second keyword set is keyword set B'.
[0254] In other words, in scenario 2-2, the two types of data to be transmitted determined by the server are not only related to the time range, but also to the element content of keyword set A and keyword set B. That is, the two types of data to be transmitted are determined from the time dimension and the element dimension, and the data volume of each type of data to be transmitted is obtained.
[0255] Determine the first data volume of the first data to be transmitted.
[0256] The first set of data to be transmitted includes a first set of keywords (keyword set A').
[0257] The server determines keyword set A* based on the query request, then determines keyword set A' based on keyword set A*, the time range, and keyword set B. Based on keyword set A' and the size of the keywords, the server determines the data volume of keyword set A', and uses keyword set A' as the first set of data to be transmitted, and the data volume of keyword set A' as the first data volume. For example, the keyword size can be pre-configured, and both the client and server know the keyword size. Taking the keyword set A* shown in Table 5, keyword set B shown in Table 3, and the time range [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7] to obtain keyword set A' as shown in Table 6, keyword set A' includes k1 keywords, and the size of each keyword is a bytes. Therefore, the first data volume = k1 * a.
[0258] Determine the second data volume of the second data to be transmitted.
[0259] In some embodiments, the second data to be transmitted includes a second set of keywords (keyword set B').
[0260] The server determines keyword set B' based on keyword set B, keyword set A*, and the time range in the query request. It then determines the data volume of keyword set B' based on the size of the keywords and uses keyword set B' as the second set of data to be transmitted, and the data volume of keyword set B' as the second data volume. For example, the keyword size can be pre-configured, and both the client and server know the keyword size. Continuing with the example of keyword set A* shown in Table 5, keyword set B shown in Table 3, and the time range [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7] to obtain keyword set B' (also keyword set A') shown in Table 6, keyword set B' includes k1 keywords, and the size of each keyword is a bytes. Therefore, the second data volume = k1 * a.
[0261] In other embodiments, the second data to be transmitted includes the data content corresponding to each keyword in the second keyword set (keyword set B').
[0262] The server determines a keyword set B' based on keyword set B, keyword set A*, and the time range in the query request. It then uses the data content corresponding to each keyword in keyword set B' and keyword set B' as the second set of data to be transmitted. The second data volume is determined based on the second set of data to be transmitted, the size of the keywords, and the size of the data content. For example, the size of the keywords and the size of the data content can be pre-configured and known to both the client and server.
[0263] For ease of description, the set of data content corresponding to each keyword in the keyword set B' is denoted as the data content set C', and the data content in the data content set C' corresponds one-to-one with the keywords in the keyword set B'.
[0264] Taking the keyword set A* shown in Table 5, the keyword set B shown in Table 4, and the time range [t1=2020 / 10 / 1,t2=2020 / 10 / 7] as an example, each keyword corresponds to a data content. The size of the keyword is a bytes, and the size of the data content is b bytes, resulting in the keyword set B' shown in Table 9, the data content set C'=[data-1,…,data–k1], and the second data volume=k1*(a+b).
[0265] Table 9
[0266] Keywords time Data content key-1 t-1 data-1 key-2 t-2 data-2 … … … <![CDATA[key-k1]]> <![CDATA[t-k1]]> <![CDATA[data-k1]]>
[0267] Comparing the data volume in case 2-2 with that in case 2-1, it can be seen that, since the elements of keyword set A and keyword set B are considered, the keywords in the first and second keyword sets are related, and effective data for data query can be obtained. Therefore, the data volume of the first and second data to be transmitted is less than or equal to the data volume in case 2-1, the estimation result is more accurate, and the communication overhead is smaller.
[0268] This method can be applied to different scenarios based on the actual situation. For example, it can be applied to scenarios such as finding lost or offline devices and contact tracking scenarios.
[0269] Method 3
[0270] The query request includes time information and a third set of keywords (i.e., keyword set A).
[0271] Case 3-1: The first keyword set is keyword set A*, and the second keyword set is keyword set B*.
[0272] Determine the first data volume of the first data to be transmitted.
[0273] The first set of data to be transmitted includes a first set of keywords (keyword set A*).
[0274] Based on the query request, the server determines keyword set A, then determines keyword set A* based on keyword set A and the time range indicated by the time information, and finally determines the data volume of keyword set A* based on keyword set A* and the size of the keywords. Keyword set A* is then used as the first data to be transmitted, and the data volume of keyword set A* is used as the first data volume. Continuing with the example of keyword set A in Table 2, keyword set A* in Table 5, and a time range of [t1, t2] to obtain keyword set A* as shown in Table 5, if the size of the keyword is a bytes, then the first data volume = k2 * a.
[0275] Determine the second data volume of the second data to be transmitted.
[0276] In some embodiments, the second data to be transmitted includes a second set of keywords (keyword set B*).
[0277] In other embodiments, the second data to be transmitted includes a second set of keywords (keyword set B*) and the data content corresponding to each keyword in the second set of keywords.
[0278] For a detailed description of how the server determines the second data volume, please refer to the relevant description in Method 1, which will not be repeated here.
[0279] Case 3-2: The first keyword set is keyword set A', and the second keyword set is keyword set B'.
[0280] Determine the first data volume of the first data to be transmitted.
[0281] The first set of data to be transmitted includes a first set of keywords (keyword set A').
[0282] The server determines keyword set A based on the query request, and then determines keyword set A' based on keyword set A, the time range, and keyword set B. Based on keyword set A' and the size of the keywords, the data volume of keyword set A' is determined. Keyword set A' is used as the first set of data to be transmitted, and its data volume is used as the first data volume. Continuing with the example of keyword set A shown in Table 2, keyword set B shown in Table 3, and the time range [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7] to obtain keyword set A' as shown in Table 6, keyword set A' includes k1 keywords, and the size of each keyword is a bytes. Therefore, the first data volume = k1 * a.
[0283] Determine the second data volume of the second data to be transmitted.
[0284] In some embodiments, the second data to be transmitted includes a second set of keywords (keyword set B').
[0285] The server determines keyword set B' based on keyword set B, keyword set A, and the time range in the query request. It then determines the data volume of keyword set B' based on the size of the keywords and uses keyword set B' as the second set of data to be transmitted. The data volume of keyword set B' is then used as the second data volume. For example, using keyword set A (shown in Table 2), keyword set B (shown in Table 3), and the time range [t1 = 2020 / 10 / 1, t2 = 2020 / 10 / 7] to obtain keyword set B' (also keyword set A') as shown in Table 6, keyword set B' includes k1 keywords, and the size of each keyword is a bytes. Therefore, the second data volume = k1 * a.
[0286] In other embodiments, the second data to be transmitted includes the data content corresponding to each keyword in the second keyword set (keyword set B').
[0287] The server determines keyword set B' based on keyword set B, keyword set A, and the time range in the query request. The data content corresponding to each keyword in keyword set B', along with keyword set B' itself, is used as the second data to be transmitted. The second data volume is determined based on the second data to be transmitted, the size of the keywords, and the size of the data content. For a specific example, refer to the keyword set B' shown in Table 9. The second data volume = k1*(a+b).
[0288] Comparing the data volume in case 3-2 with that in case 3-1, it can be seen that, since the elements of keyword set A and keyword set B are considered, the keywords in the first and second keyword sets are related, and effective data for data query can be obtained. Therefore, the data volume of the first and second data to be transmitted is less than or equal to the data volume in case 3-1, the estimation result is more accurate, and the communication overhead is smaller.
[0289] This method can be applied to different scenarios based on the actual situation. For example, it can be applied to scenarios such as finding lost or offline devices and contact tracking scenarios.
[0290] The server can determine the first data volume and the second data volume based on the above example and other methods not shown, and determine the target query method based on the first data volume and the second data volume.
[0291] In some embodiments, the server determines the query method corresponding to the smaller data volume of the first data volume and the second data volume to be transmitted as the target query method.
[0292] For example, if the first data volume is less than the second data volume, the target query method is a server-side query method; if the second data volume is less than the first data volume, the target query method is a client-side query method.
[0293] For example, consider a first set of keywords to be transmitted, and a second set of keywords to be transmitted, along with corresponding data content. The first set of keywords contains 140 keywords, and the second set of keywords contains 10 keywords. The keywords have the same element attributes, each keyword is 16 bytes in size, and the data content is also 16 bytes in size. Therefore, the first data volume of the first set of keywords to be transmitted is 16 * 140 = 2240 bytes, and the first data volume of the second set of keywords to be transmitted is (16 + 16) * 10 = 320 bytes. Since the second data volume is smaller than the first data volume, and the target query method is a client-side query method.
[0294] In other embodiments, if the difference between the first data volume and the second data volume is less than or equal to a threshold, the server determines either the client-side query method or the server-side query method as the target query method. For example, in a scenario of locating a lost or offline device, the target query method could be the server-side query method; in a contact tracing scenario, the target query method could be the client-side query method.
[0295] It should be understood that, under normal circumstances, this threshold value is very small. When the difference between the first and second data volumes is less than or equal to this threshold, the first and second data volumes can be approximately considered to be the same. In this case, either the client-side query method or the server-side query method can be used as the target query method.
[0296] In S630, the server sends a response message to the client, which includes first information indicating the target query method.
[0297] Correspondingly, based on the response information, the client determines the target query method and uses that method to communicate with the server to query the data.
[0298] For example, a marker can be used to indicate the target query method. The target query method is indicated by carrying the marker in the first information. For example, "0" indicates a client-side query method, and "1" indicates a server-side query method.
[0299] The following describes other implementation methods of the embodiments of this application when the target query method is a client query method or a server query method.
[0300] The target query method is the client-side query method.
[0301] In some embodiments, the response message further includes at least a portion of the second data to be transmitted. For ease of description, the overall response message for this situation is referred to as response message 1.
[0302] In other words, after determining that the target query method is a client-side query method, the server sends not only the first information indicating the target query method but also at least a portion of the second data to be transmitted through response message 1. Thus, when the target query method is a client-side query method, by indicating the target query method and carrying at least a portion of the second data to be transmitted in a single response message, the number of interactions between the client and server can be reduced, minimizing signaling overhead and lowering the complexity of the implementation process.
[0303] At least a portion of the second data to be transmitted is part or all of the second data to be transmitted. For example, if the amount of the second data to be transmitted exceeds the amount of data that can be contained in a single response message, then the server can reply with multiple responses, each carrying a portion of the second data to be transmitted. Therefore, in this example, response message 1 carries a portion of the second data to be transmitted. As another example, if the amount of the second data to be transmitted does not exceed the amount of data that can be contained in a single response message, then the server can reply with a single response, with response message 1 carrying all of the second data to be transmitted.
[0304] In other embodiments, after S630, the server sends another response message to the client, which includes at least a portion of the second data to be transmitted. For ease of description, this response message is referred to as response message 2.
[0305] In other words, the server's response to the query request can include first information indicating the target query method, but does not include the content related to the second data to be transmitted. Subsequently, the server can reply with response message 2, which carries at least a portion of the second data to be transmitted. Thus, when the target query method is a client-side query, by including the first information indicating the target query method and at least a portion of the second data to be transmitted in the two response messages respectively, the first information and at least a portion of the second data to be transmitted can be decoupled, improving system flexibility. In one example, after S630, the client can send another query request (denoted as query request 2), and the server replies with response message 2 to query request 2. Query request 2 is used to obtain data from the server so that the server can provide data feedback based on the query request. It should be understood that if the amount of the second data to be transmitted exceeds the amount of data that can be contained in one response message, the server can reply with multiple responses, each carrying a portion of the second data to be transmitted, until all the second data to be transmitted is sent.
[0306] In addition, the client can send multiple query requests 2, and the server will reply with a response message based on each query request 2 until the second data to be transmitted is sent.
[0307] Of course, after the client sends a query request including time information in S610, it is not necessary to send query request 2 again. The server can directly send multiple response messages until the second data to be transmitted is sent.
[0308] The target query method is a server-side query method.
[0309] In some embodiments, the response message further includes query result information, which includes query results corresponding to each keyword in at least a subset of the keywords of the first keyword set. For ease of description, the response message in this case is referred to as response message 3.
[0310] In other words, after determining that the target query method is a client-side query method, the server sends not only the first information indicating the target query method but also the query result information through response message 3. Thus, when the target query method is a server-side query method, by indicating the target query method and carrying the query result information in a single response message, the number of interactions between the client and server can be reduced, minimizing signaling overhead and lowering the complexity of the implementation process.
[0311] At least some keywords include at least one keyword, which is part or all of the keywords in the first keyword set, and the query result information includes at least one query result, with each of the at least one keyword corresponding to the at least one query result.
[0312] Considering the amount of data that can be contained in the response information, the query results information can include all or part of the query results. In the first case, if the total amount of data in the total query results is greater than the amount of data that can be contained in a single response message, the server can respond multiple times, with each response message carrying a portion of the query results. Therefore, in this example, the query results information in response message 3 carries a portion of the query results; naturally, this at least partial keyword is a subset of the keywords in the first keyword set. In the second case, if the total amount of data in the total query results is less than the amount of data that can be contained in a single response message, the server can respond once. The query results information in response message 3 carries the entire query results, where the at least partial keyword is a subset or all of the keywords in the first keyword set, specifically related to the query results.
[0313] Below, taking the example of a query result that includes all query results, we will explain the query results and at least some of the keywords in the first keyword set in conjunction with the scenario and the first keyword set.
[0314] In some scenarios, the query results only include those that satisfy the query request. These satisfying results correspond to keywords in the first keyword set that are related to keyword set B. In this scenario, at least some keywords in the first keyword set are keywords related to keyword set B, and these at least some keywords may be some or all of the keywords. The query results may include data content corresponding to the keywords that satisfy the query request. For example, in the scenario of searching for a lost or offline device, at least some keywords in the first keyword set are keywords (public keys) related to keyword set B, and the query results include data content corresponding to these keywords (e.g., location).
[0315] In an embodiment where the first keyword set is keyword set A*, since the keywords in the first keyword set are derived from keywords in keyword set A that fall within that time range, and the elements of keyword set B are not considered, some keywords in the first keyword set may be related to keywords in keyword set B, or all keywords in the first keyword set may be related to keywords in keyword set B. Therefore, at least some keywords in the first keyword set are all or some keywords. For example, in a scenario of searching for a lost or offline device, the first keyword set includes: public key 11, public key 12, public key 13, public key 14, ..., public key 198, public key 199, and keyword set B includes: public key 11, public key 12, public key 13. Therefore, the keywords in the first keyword set related to keyword set B include: public key 11, public key 12, and public key 13, which are some keywords in the first keyword set. The query result information includes: position 11 corresponding to public key 11, position 12 corresponding to public key 12, and position 13 corresponding to public key 13. For example, the first key set includes: public key 11, public key 12, public key 13, public key 14, ..., public key 198, public key 199. Key set B includes at least: public key 11, public key 12, public key 13, public key 14, ..., public key 198, public key 199. Therefore, the keys in the first key set that are related to key set B include: public key 11, public key 12, public key 13, public key 14, ..., public key 198, public key 199, which are all the keys in the first key set. The query results include the positions corresponding to all public keys.
[0316] In the embodiment where the first keyword set is A', since the keywords in the first keyword set are obtained based on the time range, the element content of keyword set A and keyword set B, it means that there must be keywords in keyword set B that are related to the keywords in the first keyword set. Therefore, at least some of the keywords in the first keyword set are all the keywords.
[0317] In other scenarios, query results may include results that satisfy the query request and results that do not satisfy the query request. Results that satisfy the query request correspond to keywords in the first keyword set that are related to keyword set B, while results that do not satisfy the query request correspond to keywords in the first keyword set that are not related to keyword set B. In this scenario, at least some keywords in the first keyword set are all keywords in the first keyword set. For example, results that satisfy the query request may include "yes" results, and results that do not satisfy the query request may include "no" results. It should be understood that "yes" and "no" have different meanings in different scenarios. For example, in a contact tracing scenario, "yes" indicates that the client user has been in contact with a patient, while "no" indicates that the client user has not been in contact with a patient.
[0318] In an embodiment where the first keyword set is keyword set A*, since the keywords in the first keyword set are derived from keywords in keyword set A whose time falls within that time range, and the element content of keyword set B is not considered, the query result information based on the comparison result between the first keyword set and keyword set B can include either "yes" or "no" query results. For example, the first keyword set includes ID11, ID12, ID13, ID21, and ID22, and keyword set B includes random code 1, random code 3, and random code 4. 144 IDs can be unidirectionally derived from random code 1, including ID11, ID12, ID13, ..., ID1144. The remaining random codes are unrelated to ID21 and ID22. Therefore, ID11, ID12, and ID13 in the first keyword set are related to random code 1, and the query results for ID11, ID12, and ID13 include "yes" results, while the query results for ID21 include "no" results.
[0319] In the embodiment where the first keyword set is keyword set A', since the keywords in the first keyword set are obtained based on the time range, the element content of keyword set A and keyword set B, it means that there must be keywords in keyword set B that are related to the keywords in the first keyword set. Therefore, the query results for each keyword include "yes" results.
[0320] For example, when the query results include "yes", the query results may also include data content corresponding to the keywords. Continuing with the contact tracing scenario, the query results may include information about the patient's condition, where the information about the condition is the data content corresponding to the keywords.
[0321] In other embodiments, after S630, the server sends another response message to the client, which includes query result information, comprising the query results corresponding to each keyword in at least a portion of the keywords of the first keyword set. For ease of description, this response message is referred to as response message 4.
[0322] In other words, the server's response to the query request may include first information indicating the target query method, but not the query result information. Subsequently, the server may respond with response information 4, which carries the query result information. For a detailed description of the query result information, please refer to the relevant description above; it will not be repeated here.
[0323] In this way, when the target query method is a server-side query method, by including the first information indicating the target query method and the query result information in the two response messages respectively, the first information and the query result information can be decoupled, thereby improving the system flexibility.
[0324] In one example, after S630, the client can send another query request (denoted as query request 3), and the server responds with response information 4 to query request 3. Exemplarily, query request 3 may include at least some keywords from the first keyword set, and the query result information in response information 4 is the query result for the keywords in query request 3. It should be understood that if the total amount of query results exceeds the amount of data that can be contained in a single response message, the server can respond multiple times, with each response message carrying a portion of the query results, until all query results have been sent.
[0325] In addition, the client can send multiple query requests 3, each query request 3 including a portion of the keywords in the first keyword set. The server replies with a response message based on each query request 3 until all query results have been sent.
[0326] Of course, in S610, after the client sends a query request including time information, it is not necessary to send query request 3 again. The server can directly send multiple response messages until all query results are sent.
[0327] In the data query method of this application embodiment, the server and the client can execute the various steps or processes of the data query method 600 described above once or multiple times.
[0328] In some embodiments, the server and client execute the above method 600 once, and use the determined target query method as the default query method for subsequent queries.
[0329] In other embodiments, the server and client may execute the above method 600 multiple times to determine the target query method applicable to the current time period at different times, so as to minimize communication overhead.
[0330] For example, the server and client can periodically execute the above method 600, performing data queries using the target query method determined for the current period in each period. For instance, if the period is 10 days, the target query method is determined every 10 days. The target query method determined in the first period is the client query method, and the target query method is redefined in the second period after 10 days, resulting in the server query method. In the second period, the target query method is switched from the client query method to the server query method.
[0331] For example, each time the client needs to query data, it executes the above method 600 to determine the query method that should be used in each data query process.
[0332] The data query method provided in this application includes time information indicating a time range in the query request. Based on this time range, both the first data to be transmitted when querying data using a server-side query method and the second data to be transmitted when querying data using a client-side query method are limited to this time range. Specifically, the time corresponding to the keywords in the first set of keywords in the first data to be transmitted belongs to this time range, and the time corresponding to the keywords in the second set of keywords in the second data to be transmitted belongs to this time range. The server determines the target query method based on the data volume of the two data to be transmitted and instructs the client on the target query method through response information. In scenarios where the keywords on the client and server sides change dynamically over time, compared to the prior art where only one query method is used by default, associating the time range with both server-side and client-side keywords narrows the keyword query scope. This allows for a more accurate determination of the data volume corresponding to each of the two query methods, and further, the determination of the target query method based on the data volume of the two data to be transmitted effectively improves the flexibility of the data query process.
[0333] When the first data volume and the second data volume to be transmitted are different, the server uses the query method corresponding to the data volume with the smaller data volume as the target query method. This can effectively reduce the amount of data to be transmitted during the transmission process, thereby reducing communication overhead.
[0334] Continuing with the example of finding lost or offline devices mentioned above, the time interval for generating periodic public keys is 10 minutes, each public key is 32 bytes long, and the encrypted location is also 32 bytes long. The user needs to view the location details of device A over the past 90 days. The server stores only 100 data records. Therefore, over 90 days, the amount of data for keywords on the client side = 90 * 32 * 24 * 60 / 10 = 414720 bytes, and the amount of data for keywords and data content stored on the server side = (32 + 32) * 100 = 6400 bytes. If the existing server-side query method is used, the client needs to transmit at least approximately 400KB of data. However, based on the embodiment of this application, a client-side query method is used, and the server only needs to transmit approximately 6KB of data, greatly reducing the amount of data to be transmitted during the transmission process and effectively reducing communication overhead.
[0335] Continuing with the example data from the contact tracing scenario above, a country has an average of 50,000 confirmed cases per day. An anonymous ID is 16 bytes long, generated every 10 minutes. Each infected patient uploads a 16-byte random code daily. Over 14 days, each patient uploads 14 16-byte random codes to the server, each generating 144 corresponding anonymous IDs. A user has only been in contact with one other user (also the confirmed user). Therefore, over 14 days, the amount of keyword data on the user's client side would be 14 * 16 * 24 * 60 / 10 = 14 * 16 * 144 = 32256 bytes, and the amount of keyword data on the server side would be 14 * 50000 * 16 = 11,200,000 bytes. Using existing client-side query methods, the server would need to transmit at least 11MB of data. However, based on this embodiment, a server-side query method is used, requiring the client to transmit only about 32KB of data, significantly reducing the amount of data to be transmitted and effectively reducing communication overhead.
[0336] The above, combined with Figures 1 to 6 This application provides a detailed description of the data query method provided in its embodiments. The following will combine... Figures 7 to 8 This application provides a detailed description of the apparatus for data querying provided according to embodiments thereof.
[0337] Figure 7 An apparatus 700 for data querying, provided in an embodiment of this application, is illustrated. The apparatus 700 can be a client or a server, or a chip within either the client or server. The apparatus 700 includes a communication unit 710 and a processing unit 720.
[0338] In one possible implementation, the device 700 is used to execute the various processes and steps corresponding to the server in the method 600 described above.
[0339] The communication unit 710 is used to receive a query request sent by a client, the query request including time information for indicating a time range;
[0340] The processing unit 720 is configured to determine a target query method based on the query request, wherein the target query method is a server-side query method or a client-side query method, and the target query method is obtained based on a first data volume and a second data volume. The first data volume is the data volume of a first data to be transmitted, and the second data volume is the data volume of a second data to be transmitted. The first data to be transmitted is the data that the client needs to transmit when performing a data query using the server-side query method, and the first data to be transmitted includes a first set of keywords stored by the client, wherein the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that the device needs to transmit when performing a data query using the client-side query method, and the second data to be transmitted includes a second set of keywords stored by the device, wherein the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0341] The communication unit 710 is further configured to send a response message to the client, the response message including first information indicating the target query method.
[0342] The communication unit 710 can be used to execute the processes and steps corresponding to the server in steps S610 and S630 of method 600, and the processing unit 720 can be used to execute the processes and steps corresponding to the server in step S620 of method 600.
[0343] In another possible implementation, the device 700 is used to execute the various processes and steps corresponding to the client in the method 600 described above.
[0344] The communication unit 710 is used to send a query request to the server, the query request including time information for indicating a time range;
[0345] The communication unit 710 is further configured to receive a response message sent by the server, the response message including first information indicating a target query method, wherein the target query method is a server-side query method or a client-side query method, the target query method is obtained based on a first data volume and a second data volume, the first data volume is the data volume of a first data to be transmitted, the second data volume is the data volume of a second data to be transmitted, the first data to be transmitted is the data that needs to be transmitted by the device when performing a data query using the server-side query method, the first data to be transmitted includes a first set of keywords stored by the device, the time corresponding to the keywords in the first set of keywords belongs to the time range, the second data to be transmitted is the data that needs to be transmitted by the server when performing a data query using the client-side query method, the second data to be transmitted includes a second set of keywords stored by the server, the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0346] The communication unit 710 can be used to execute the processes and steps corresponding to the client in steps S610 and S630 of method 600.
[0347] It should be understood that the specific process of each unit performing the corresponding steps in the above methods has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.
[0348] It should be understood that the device 700 here is embodied in the form of a functional unit. The term "unit" here may refer to application-specific integrated circuits (ASICs), electronic circuits, processors (e.g., shared processors, proprietary processors, or group processors) and memories for executing one or more software or firmware programs, combined logic circuits, and / or other suitable components that support the described functions.
[0349] The apparatus 700 of each of the above-described schemes has the function of implementing the corresponding steps performed by the access network device or core network device in the above-described methods; the function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions; for example, the communication unit can be replaced by a transmitter and a receiver, and other units, such as processing units, can be replaced by a processor, respectively executing the transmission and reception operations and related processing operations in each method embodiment. In addition, the communication unit in apparatus 700 can also be composed of a transmitting unit and a receiving unit. For performing operations related to receiving, the function of the communication unit can be understood as the receiving operation performed by the receiving unit; for performing operations related to transmitting, the function of the communication unit can be understood as the transmitting operation performed by the transmitting unit. In the embodiments of this application, Figure 7The device mentioned can also be a chip or a chip system, such as a system on chip (SoC). Correspondingly, the transceiver unit can be the transceiver circuit of the chip, and there is no limitation here.
[0350] Figure 8 Another device 800 for data querying provided in an embodiment of this application is illustrated. It should be understood that device 800 may specifically be a client or server as described in the above embodiments, and may be used to execute the various steps and / or processes corresponding to the client or server in the above method embodiments.
[0351] Device 800 includes a processor 810, a transceiver 820, and a memory 830. The processor 810, transceiver 820, and memory 830 communicate with each other via internal interconnection. The processor 810 can perform the functions of the processing unit 420 in various possible implementations of device 700, and the transceiver 820 can perform the functions of the communication unit 710 in various possible implementations of device 700. The memory 830 is used to store instructions, and the processor 810 is used to execute the instructions stored in the memory 830. In other words, the processor 810 can call these stored instructions to implement the functions of the processor 820 in device 700, thereby controlling the transceiver 820 to send and / or receive signals.
[0352] Optionally, the memory 830 may include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information. The processor 810 may be used to execute instructions stored in the memory, and when the processor 810 executes instructions stored in the memory, the processor 810 is used to perform the various steps and / or processes of the method embodiments corresponding to the access network device or core network device described above.
[0353] In one possible implementation, the device 800 is used to execute the various processes and steps corresponding to the server in the method 600 described above.
[0354] The transceiver 820 is used to receive a query request sent by a client, the query request including time information for indicating a time range;
[0355] The processor 810 is configured to determine a target query method based on the query request, wherein the target query method is a server-side query method or a client-side query method, and the target query method is obtained based on a first data volume and a second data volume. The first data volume is the data volume of a first data to be transmitted, and the second data volume is the data volume of a second data to be transmitted. The first data to be transmitted is the data that the client needs to transmit when performing a data query using the server-side query method, and the first data to be transmitted includes a first set of keywords stored by the client, wherein the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that the server needs to transmit when performing a data query using the client-side query method, and the second data to be transmitted includes a second set of keywords stored by the server, wherein the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0356] The transceiver 820 is configured to send a response message to the client, the response message including first information indicating the target query method.
[0357] The transceiver 820 can be used to execute the processes and steps corresponding to the server in steps S610 and S630 of method 600, and the processor 810 can be used to execute the processes and steps corresponding to the server in step S620 of method 600.
[0358] In another possible implementation, the device 800 is used to execute the various processes and steps corresponding to the client in the method 600 described above.
[0359] Processor 810 controls transceiver 820 to perform the following steps:
[0360] Send a query request to the server, the query request including time information for indicating a time range;
[0361] The system receives a response message sent by the server. The response message includes first information indicating the target query method, wherein the target query method is either a server-side query method or a client-side query method. The target query method is derived based on a first data volume and a second data volume. The first data volume is the data volume of a first set of data to be transmitted, and the second data volume is the data volume of a second set of data to be transmitted. The first data to be transmitted is the data that needs to be transmitted by the client when performing a data query using the server-side query method. The first data to be transmitted includes a first set of keywords stored by the client, and the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that needs to be transmitted by the server when performing a data query using the client-side query method. The second data to be transmitted includes a second set of keywords stored by the server, and the time corresponding to the keywords in the second set of keywords belongs to the time range.
[0362] The transceiver 820 can be used to execute the processes and steps corresponding to the client in steps S610 and S630 of method 600.
[0363] It should be understood that the specific process of each device performing the corresponding steps in the above methods has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.
[0364] It should also be understood that, in the embodiments of this application, the processor of the above-described device can be a central processing unit (CPU), which can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0365] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software units within the processor. The software units can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor executes the instructions in the memory, combining them with its hardware to complete the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0366] It should be noted that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Features specified as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0367] In the embodiments of this application, "at least one" means one or more, and "more" means two or more. "At least a part of an element" means part or all of an element. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, or B exists alone, where A and B can be singular or plural.
[0368] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0369] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0370] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0371] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0372] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0373] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0374] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for data querying, characterized in that, include: Receive a query request sent by a client, the query request including time information for indicating a time range; Based on the query request, a target query method is determined, wherein the target query method is either a server-side query method or a client-side query method. The target query method is obtained based on a first data volume and a second data volume. The first data volume is the data volume of a first set of data to be transmitted, and the second data volume is the data volume of a second set of data to be transmitted. The first data to be transmitted is the data that the client needs to transmit when performing a data query using the server-side query method. The first data to be transmitted includes a first set of keywords stored by the client, and the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that the server needs to transmit when performing a data query using the client-side query method. The second data to be transmitted includes a second set of keywords stored by the server, and the time corresponding to the keywords in the second set of keywords belongs to the time range. A response message is sent to the client, the response message including first information indicating the target query method.
2. The method according to claim 1, characterized in that, The target query method is the query method corresponding to the data to be transmitted that has the smaller data volume between the first data volume and the second data volume.
3. The method according to claim 1 or 2, characterized in that, The keywords in the first keyword set are the same as the keywords in the second keyword set; or, The keywords in the first keyword set are obtained based on the keywords in the second keyword set; or, The keywords in the second keyword set are obtained based on the keywords in the first keyword set.
4. The method according to claim 1 or 2, characterized in that, The query request also includes at least one of the following: The time interval used to generate the keywords in the first keyword set; or, The size of the keywords in the first keyword set; or, Seed data used to generate keywords in the first keyword set; or, The number of keywords included in the first keyword set.
5. The method according to claim 1 or 2, characterized in that, The query request also includes the first set of keywords; or, The query request also includes a third set of keywords, which includes the first set of keywords.
6. The method according to claim 1 or 2, characterized in that, The second data to be transmitted also includes the data content corresponding to each keyword in the second keyword set.
7. The method according to claim 1 or 2, characterized in that, The target query method is the client query method; and, The response message also includes at least a portion of the data in the second data to be transmitted.
8. The method according to claim 1 or 2, characterized in that, The target query method is the server-side query method; and... The response message also includes query result information, which includes query results corresponding to each keyword in at least a portion of the keywords in the first keyword set.
9. A method for data querying, characterized in that, include: Send a query request to the server, the query request including time information for indicating a time range; The system receives a response message sent by the server. The response message includes first information indicating the target query method, wherein the target query method is either a server-side query method or a client-side query method. The target query method is derived based on a first data volume and a second data volume. The first data volume is the data volume of a first set of data to be transmitted, and the second data volume is the data volume of a second set of data to be transmitted. The first data to be transmitted is the data that needs to be transmitted by the client when performing a data query using the server-side query method. The first data to be transmitted includes a first set of keywords stored by the client, and the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that needs to be transmitted by the server when performing a data query using the client-side query method. The second data to be transmitted includes a second set of keywords stored by the server, and the time corresponding to the keywords in the second set of keywords belongs to the time range.
10. The method according to claim 9, characterized in that, The target query method is the query method corresponding to the data to be transmitted that has the smaller data volume between the first data volume and the second data volume.
11. The method according to claim 9 or 10, characterized in that, The keywords in the first keyword set are the same as the keywords in the second keyword set; or, The keywords in the first keyword set are obtained based on the keywords in the second keyword set; or, The keywords in the second keyword set are obtained based on the keywords in the first keyword set.
12. The method according to claim 9 or 10, characterized in that, The query request also includes at least one of the following: The time interval used to generate the keywords in the first keyword set; or, The size of the keywords in the first keyword set; or, Seed data used to generate keywords in the first keyword set; or, The number of keywords included in the first keyword set.
13. The method according to claim 9 or 10, characterized in that, The query request also includes the first set of keywords; or, The query request also includes a third set of keywords, which includes the first set of keywords.
14. The method according to claim 9 or 10, characterized in that, The second data to be transmitted also includes the data content corresponding to each keyword in the second keyword set.
15. The method according to claim 9 or 10, characterized in that, The target query method is the client query method; and, The response message also includes at least a portion of the data in the second data to be transmitted.
16. The method according to claim 9 or 10, characterized in that, The target query method is the server-side query method; and... The response message also includes query result information, which includes query results corresponding to each keyword in at least a portion of the keywords in the first keyword set.
17. An apparatus for data querying, characterized in that, include: A communication unit is used to receive a query request sent by a client, the query request including time information indicating a time range; The processing unit is configured to determine a target query method based on the query request, wherein the target query method is either a server-side query method or a client-side query method, and the target query method is obtained based on a first data volume and a second data volume. The first data volume is the data volume of a first set of data to be transmitted, and the second data volume is the data volume of a second set of data to be transmitted. The first data to be transmitted is the data that the client needs to transmit when performing a data query using the server-side query method, and the first data to be transmitted includes a first set of keywords stored by the client, wherein the time corresponding to the keywords in the first set of keywords belongs to the time range. The second data to be transmitted is the data that the device needs to transmit when performing a data query using the client-side query method, and the second data to be transmitted includes a second set of keywords stored by the device, wherein the time corresponding to the keywords in the second set of keywords belongs to the time range. The communication unit is further configured to send a response message to the client, the response message including first information indicating the target query method.
18. An apparatus for data querying, characterized in that, include: A communication unit is used to send a query request to the server, the query request including time information indicating a time range; The communication unit is further configured to receive a response message sent by the server, the response message including first information indicating a target query method, wherein the target query method is a server-side query method or a client-side query method, the target query method is obtained based on a first data volume and a second data volume, the first data volume is the data volume of a first data to be transmitted, the second data volume is the data volume of a second data to be transmitted, the first data to be transmitted is the data that needs to be transmitted by the device when performing a data query using the server-side query method, the first data to be transmitted includes a first set of keywords stored by the device, the time corresponding to the keywords in the first set of keywords belongs to the time range, the second data to be transmitted is the data that needs to be transmitted by the server when performing a data query using the client-side query method, the second data to be transmitted includes a second set of keywords stored by the server, the time corresponding to the keywords in the second set of keywords belongs to the time range.
19. An apparatus for data querying, characterized in that, include: Memory, used to store computer instructions; A processor is configured to invoke computer instructions stored in the memory to perform the method as described in any one of claims 1 to 8, or to perform the method as described in any one of claims 9 to 16.
20. A system for data querying, characterized in that, include: The server is configured to execute the method as described in any one of claims 1 to 8; A client for performing the method as described in any one of claims 9 to 16.
21. A computer-readable storage medium, characterized in that, Used to store computer instructions for implementing the method as described in any one of claims 1 to 8, or for implementing the method as described in any one of claims 9 to 16.
22. A computer program product, characterized in that, Includes computer instructions for implementing the method as described in any one of claims 1 to 8, or for implementing the method as described in any one of claims 9 to 16.
23. A chip, characterized in that, The chip includes: Memory: Used to store instructions; A processor is configured to retrieve and execute the instructions from the memory, causing a communication device on which the chip is mounted to perform the method as described in any one of claims 1 to 8, or to perform the method as described in any one of claims 9 to 16.
Citation Information
Patent Citations
Method for transmitting data to client
CN102075531A
Information query method for terminal and the terminal
CN110598085A