A data query method and device, electronic equipment and storage medium

By pre-establishing the correspondence between query items and object identifiers, the problem of wasted storage space in existing technologies is solved, achieving efficient querying and saving storage space.

CN117743403BActive Publication Date: 2026-11-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311823461.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-27
Publication Date
2026-11-03
Estimated Expiration
2043-12-27

AI Technical Summary

Technical Problem

Existing technologies require establishing a new mapping between query items and moving data when processing object movement data, resulting in wasted storage space.

Method used

By pre-establishing the correspondence between query items and object identifiers, and using index information to determine the object identifier when a query request is received, the moving data can be retrieved from the memory, avoiding duplicate recording of moving data and saving storage space.

Benefits of technology

This eliminates the need to establish a new mapping between query items and moving data during the query process, avoiding wasted storage space and improving query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117743403B_ABST
    Figure CN117743403B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data query method and device, electronic equipment and storage medium, relating to the technical field of big data processing, the method comprising: receiving a query request carrying a specified query parameter; finding index information containing a query item to which the specified query parameter belongs from at least one first index information pre-stored in a storage, as second index information; any first index information representing the correspondence between an object identifier and at least one type of query item; determining the object identifier corresponding to the specified query parameter based on the second index information, as a to-be-queried object identifier; obtaining a query result based on the mobile data corresponding to the to-be-queried object identifier pre-stored; and the mobile data corresponding to any object identifier including the position information of the object represented by the object identifier pre-collected. In this way, it is not necessary to establish a new correspondence between a query item and mobile data, and it is not necessary to record multiple copies of mobile data, thereby saving storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data processing technology, and in particular to a data query method, apparatus, electronic device and storage medium. Background Technology

[0002] With the continuous development of positioning and big data technologies, the application of object movement data (also known as spatiotemporal data) is becoming increasingly widespread. For example, smart devices can collect and record the movement data (e.g., latitude and longitude) of a specified object at different times. The specified object could be a vehicle or an animal.

[0003] In practical applications, large amounts of mobile data are often recorded. To retrieve this mobile data, related technologies establish a mapping between query terms and mobile data. Then, when query parameters containing the relevant query terms are received, the corresponding mobile data can be found based on this mapping. However, when new query requirements arise, such as when a query needs to be performed based on a new query term, a new mapping between the query term and mobile data needs to be established. This necessitates recording multiple sets of mobile data, resulting in wasted storage space. Summary of the Invention

[0004] The purpose of this application is to provide a data query method, apparatus, electronic device, and storage medium to avoid wasting storage space and save storage space. The specific technical solution is as follows:

[0005] A first aspect of this application provides a data query method, the method comprising:

[0006] Receive query requests carrying specified query parameters;

[0007] From at least one first index information pre-stored in the memory, find the index information containing the query item to which the specified query parameter belongs, and use it as the second index information; wherein, any first index information represents: the correspondence between an object identifier and at least one type of query item;

[0008] Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried;

[0009] Based on the pre-stored movement data corresponding to the object identifier to be queried, the query result is obtained; wherein, the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance.

[0010] Optionally, the second index information includes: a time query item representing a unit time period, and a latitude and longitude query item representing the encoded value of latitude and longitude; the specified query parameters include a specified latitude and longitude range and a specified time range;

[0011] The mobile data corresponding to any object identifier includes at least one mobile dataset; any mobile dataset includes: latitude and longitude information representing the latitude and longitude of the object represented by the object identifier collected within a historical unit time period, and the historical unit time period;

[0012] The query results obtained based on the pre-stored movement data corresponding to the identifier of the object to be queried include:

[0013] A first mobile dataset is determined from the mobile data corresponding to the object identifier to be queried; wherein, the historical time unit in any first mobile dataset belongs to the specified time range;

[0014] Based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range, the query results are obtained.

[0015] Optionally, any mobile dataset may further include: a range of latitude and longitude to be matched; the range of latitude and longitude to be matched represents: the latitude and longitude of the smallest bounding polygon region containing the latitude and longitude of the object collected within the historical unit time period;

[0016] The query results obtained based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range include:

[0017] Based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset, the query results are obtained; wherein, the latitude and longitude range to be matched in any second mobile dataset intersects with the specified latitude and longitude range.

[0018] Optionally, any mobile dataset may further include: a region identifier for each sub-region within the minimum bounding polygon region; any region identifier indicates whether the route formed by the latitude and longitude information passes through the sub-region represented by the region identifier;

[0019] The query results obtained based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset include:

[0020] For each second mobile dataset determined from the first mobile dataset, if there is a target sub-region that intersects with the specified latitude and longitude range among the sub-regions included in the latitude and longitude range to be matched in the second mobile dataset, then a query result is obtained based on the latitude and longitude information recorded in the second mobile dataset; wherein, the region identifier of the target sub-region indicates that the route formed by the latitude and longitude information passes through the target sub-region.

[0021] Optionally, the latitude and longitude information in any mobile dataset is obtained by processing the historical latitude and longitude values ​​collected within a historical unit time period using a preset time-series compression algorithm.

[0022] Optionally, the storage is a disk, and the second index information includes: a first correspondence and at least one second correspondence; the first correspondence represents the correspondence between query parameters and the storage addresses of the corresponding object identifiers in the disk; the first correspondences to which each query parameter belongs are stored in the disk in order of the size relationship of the corresponding query parameters;

[0023] Any second correspondence represents a correspondence between a range of query parameters and a range of storage addresses; the storage address range represents the storage address on the disk of the first correspondence to which the query parameters belonging to the range of query parameters belong.

[0024] Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried, including:

[0025] The range of query parameters to which the specified query parameter belongs is determined from at least one second correspondence, and is used as the target query parameter range;

[0026] A query is performed within the storage address range recorded in the second correspondence to which the target query parameter range belongs in the disk to obtain the first correspondence to which the specified query parameter belongs;

[0027] Obtain the object identifier recorded at the storage address in the first correspondence queried in the disk, and use it as the object identifier to be queried.

[0028] Optionally, the process of constructing the first index information in the disk includes:

[0029] Obtain the third correspondence between each query parameter recorded in memory and each object identifier;

[0030] Write the object identifiers in the third correspondence to the disk;

[0031] According to the size relationship of each query parameter, the first correspondence relationship of each query parameter is stored sequentially in the disk.

[0032] Group each query parameter according to a preset size to determine the query parameter range to which each query parameter belongs;

[0033] For each range of query parameters, determine the storage address range of the first correspondence to which the query parameters belong in the range on the disk, obtain the second correspondence to which the query parameter range belongs, and write it to the disk.

[0034] Optionally, the storage is memory, and any first index information is: the correspondence between object identifiers stored in the memory and at least one type of query item;

[0035] Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried, including:

[0036] From the second index information, find the object identifier corresponding to the specified query parameter, and use it as the object identifier to be queried.

[0037] A second aspect of this application also provides a data query device, the device comprising:

[0038] The query request receiving module is used to receive query requests carrying specified query parameters;

[0039] The correspondence determination module is used to search for index information containing the query item to which the specified query parameter belongs from at least one first index information pre-stored in the memory, and use it as the second index information; wherein, any first index information represents: the correspondence between an object identifier and at least one type of query item;

[0040] The identifier determination module is used to determine the object identifier corresponding to the specified query parameter based on the second index information, and use it as the identifier of the object to be queried;

[0041] The query result determination module is used to obtain query results based on the pre-stored movement data corresponding to the object identifier to be queried; wherein, the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance.

[0042] Optionally, the second index information includes: a time query item representing a unit time period, and a latitude and longitude query item representing the encoded value of latitude and longitude; the specified query parameters include a specified latitude and longitude range and a specified time range;

[0043] The mobile data corresponding to any object identifier includes at least one mobile dataset; any mobile dataset includes: latitude and longitude information representing the latitude and longitude of the object represented by the object identifier collected within a historical unit time period, and the historical unit time period;

[0044] The query result determination module includes:

[0045] The first mobile dataset determination submodule is used to determine the first mobile dataset from the mobile data corresponding to the object identifier to be queried; wherein, the historical unit time period in any first mobile dataset belongs to the specified time range;

[0046] The query result determination submodule is used to obtain query results based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range.

[0047] Optionally, any mobile dataset may further include: a range of latitude and longitude to be matched; the range of latitude and longitude to be matched represents: the latitude and longitude of the smallest bounding polygon region containing the latitude and longitude of the object collected within the historical unit time period;

[0048] The query result determination submodule includes:

[0049] The query result determination unit is used to obtain query results based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset; wherein, the latitude and longitude range to be matched in any second mobile dataset intersects with the specified latitude and longitude range.

[0050] Optionally, any mobile dataset may further include: a region identifier for each sub-region within the minimum bounding polygon region; any region identifier indicates whether the route formed by the latitude and longitude information passes through the sub-region represented by the region identifier;

[0051] The query result determination unit is specifically used to determine a query result for each second mobile dataset determined from the first mobile dataset if there is a target sub-region that intersects with the specified latitude and longitude range in each sub-region of the latitude and longitude range to be matched in the second mobile dataset; wherein, the region identifier of the target sub-region indicates that the route formed by the latitude and longitude information passes through the target sub-region.

[0052] Optionally, the latitude and longitude information in any mobile dataset is obtained by processing the historical latitude and longitude values ​​collected within a historical unit time period using a preset time-series compression algorithm.

[0053] Optionally, the storage is a disk, and the second index information includes: a first correspondence and at least one second correspondence; the first correspondence represents the correspondence between query parameters and the storage addresses of the corresponding object identifiers in the disk; the first correspondences to which each query parameter belongs are stored in the disk in order of the size relationship of the corresponding query parameters;

[0054] Any second correspondence represents a correspondence between a range of query parameters and a range of storage addresses; the storage address range represents the storage address on the disk of the first correspondence to which the query parameters belonging to the range of query parameters belong.

[0055] The identifier determination module is specifically used to determine the range of query parameters to which the specified query parameter belongs from at least one second correspondence, as the target query parameter range; to perform a query within the storage address range recorded in the second correspondence to which the target query parameter range belongs in the disk, to obtain the first correspondence to which the specified query parameter belongs; and to obtain the object identifier recorded at the storage address recorded in the first correspondence queried in the disk, as the identifier of the object to be queried.

[0056] Optionally, the device further includes:

[0057] The first index information construction module is used to obtain the third correspondence between each query parameter and each object identifier recorded in memory; write each object identifier in the third correspondence to the disk; sequentially store the first correspondence to which each query parameter belongs in the disk according to the size relationship of each query parameter; group each query parameter according to a preset size to determine the query parameter range to which each query parameter belongs; for each query parameter range, determine the storage address range of the first correspondence to which the query parameter belongs in the disk, obtain the second correspondence to which the query parameter range belongs, and write it to the disk.

[0058] Optionally, the storage is memory, and any first index information is: the correspondence between object identifiers stored in the memory and at least one type of query item;

[0059] The identifier determination module is specifically used to find the object identifier corresponding to the specified query parameter from the second index information, and use it as the identifier of the object to be queried.

[0060] A third aspect of this application also provides an electronic device, comprising:

[0061] Memory, used to store computer programs;

[0062] The processor, when executing a program stored in memory, implements any of the data query methods described above.

[0063] Another aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the data query methods described above.

[0064] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the data query methods described above.

[0065] This application provides a data query method that can receive a query request carrying specified query parameters; search for index information containing the query item to which the specified query parameters belong from at least one first index information pre-stored in a memory, and use it as second index information; wherein any first index information represents the correspondence between an object identifier and at least one type of query item; based on the second index information, determine the object identifier corresponding to the specified query parameters, and use it as the object identifier to be queried; and obtain the query result based on the pre-stored movement data corresponding to the object identifier to be queried; wherein the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance.

[0066] Based on the above processing, a correspondence between query items and object identifiers (i.e., first index information) can be pre-established and stored in memory. Upon receiving a query request, the query item to which the specified query parameters carried in the query request belong can be determined, and the first index information containing the determined query item (i.e., second index information) can be determined from the pre-stored first index information. Based on the second index information, the object identifier corresponding to the specified query parameters (i.e., the identifier of the object to be queried) can be determined.

[0067] The movement data corresponding to any object identifier can include: pre-collected location information of the object represented by that object identifier. The query result can be determined based on the pre-collected and stored movement data corresponding to the object identifier to be queried. Correspondingly, when a query is needed based on a new query item, a new mapping between the query item and the object identifier can be established to perform the query, without needing to establish a new mapping between the query item and the movement data. This eliminates the need to record multiple sets of movement data, avoiding wasted storage space and saving storage space.

[0068] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0069] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0070] Figure 1 This is a schematic diagram of a first type of data query method provided in an embodiment of this application;

[0071] Figure 2 This is a second flowchart illustrating the data query method provided in the embodiments of this application;

[0072] Figure 3 This is a schematic diagram of a storage structure for mobile data corresponding to an object identifier, provided in an embodiment of this application.

[0073] Figure 4 This is a schematic diagram of a storage structure for a mobile dataset provided in an embodiment of this application;

[0074] Figure 5 This is a schematic diagram of a third type of data query method provided in the embodiments of this application;

[0075] Figure 6a This is a schematic diagram of a data storage structure provided in an embodiment of this application;

[0076] Figure 6b This is a schematic diagram of a storage structure for second index information provided in an embodiment of this application;

[0077] Figure 7 This is a schematic diagram of the structure of a data query device provided in an embodiment of this application;

[0078] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0079] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

[0080] With the continuous development of positioning and big data technologies, the application of object movement data (also known as spatiotemporal data) is becoming increasingly widespread. For example, smart devices can collect and record the movement data of a specified object at different times. The specified object could be a vehicle or an animal. Movement data can include the object's location information, which could be the object's latitude and longitude, and / or information about the road the object is located on (e.g., the intersection it is at).

[0081] In practical applications, large amounts of mobile data are often recorded. To retrieve this mobile data, related technologies establish a mapping between query terms and mobile data. Then, when query parameters containing the relevant query terms are received, the corresponding mobile data can be found based on this mapping. However, when new query requirements arise, such as when a query needs to be performed based on a new query term, a new mapping between the query term and mobile data needs to be established. This necessitates recording multiple sets of mobile data, resulting in wasted storage space.

[0082] To avoid wasting storage space and to save storage space, this application provides a data query method, see [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic diagram of the first type of data query method provided in the embodiments of this application.

[0083] Step S101: Receive a query request carrying specified query parameters.

[0084] Step S102: From at least one first index information pre-stored in the memory, find the index information containing the query item to which the specified query parameter belongs, and use it as the second index information.

[0085] Wherein, any of the first index information represents: the correspondence between an object identifier and at least one type of query item;

[0086] Step S103: Based on the second index information, determine the object identifier corresponding to the specified query parameter, and use it as the object identifier to be queried.

[0087] Step S104: Obtain the query result based on the pre-stored mobile data corresponding to the identifier of the object to be queried.

[0088] The movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier, which was collected in advance.

[0089] Based on the above processing, a correspondence between query items and object identifiers (i.e., first index information) can be pre-established and stored in memory. Upon receiving a query request, the query item to which the specified query parameters carried in the query request belong can be determined, and the first index information containing the determined query item (i.e., second index information) can be determined from the pre-stored first index information. Based on the second index information, the object identifier corresponding to the specified query parameters (i.e., the identifier of the object to be queried) can be determined.

[0090] The movement data corresponding to any object identifier can include: pre-collected location information of the object represented by that object identifier. The query result can be determined based on the pre-collected and stored movement data corresponding to the object identifier to be queried. Correspondingly, when a query is needed based on a new query item, a new mapping between the query item and the object identifier can be established to perform the query, without needing to establish a new mapping between the query item and the movement data. This eliminates the need to record multiple sets of movement data, avoiding wasted storage space and saving storage space.

[0091] For steps S101 and S102, a correspondence between query items and object identifiers (i.e., first index information) can be pre-established and stored in memory. The memory can be RAM or a disk. An object identifier can be pre-generated based on the object's attribute tags. For example, when the object is a vehicle, the attribute tags can include the vehicle's brand and license plate number.

[0092] The query items set in the first index information can be determined based on the current query business requirements. A query item can represent a query condition; that is, specifying query parameters can represent specifying query conditions. According to the data query method provided in the embodiments of this application, mobile data that meets the specified query conditions can be determined, and query results can be obtained based on the mobile data that meets the specified query conditions.

[0093] For example, when querying the movement data of a specified object (such as a specified vehicle), the query conditions include the license plate number of the specified vehicle, and the corresponding query items can include license plate number query items; when querying the movement data of objects that pass through a specified area within a specified time range, the query conditions include the specified time range and the latitude and longitude range of the specified area, and the corresponding query items can include time query items and latitude and longitude query items.

[0094] There can be one or more first index information. For any given first index information, it can represent the correspondence between one or more query terms and object identifiers. For example, a first index information can represent the correspondence between a time query term and an object identifier; or, a first index information can also represent the correspondence between a license plate number query term and an object identifier; or, a first index information can also represent the correspondence between a time query term, a latitude and longitude query term, and an object identifier.

[0095] Upon receiving a query request, the query terms to which the specified query parameters carried in the query request belong can be determined. The specified query parameters can belong to one or more query terms. Furthermore, from the pre-established first index information, first index information containing the query terms to which the specified query parameters belong (i.e., second index information) can be determined. The query terms to which the specified query parameters belong can be some of the query terms contained in the second index information, or it can be all of the query terms contained in the second index information.

[0096] Regarding steps S103 and S104, the second index information can represent the correspondence between the query item to which the specified query parameter belongs and the object identifier. Accordingly, the object identifier corresponding to the specified query parameter (i.e., the object identifier to be queried) can be determined based on the second index information. It is understood that, due to the influence of the accuracy of the collected mobile data, and the significant difference between the accuracy of the specified query parameter and the accuracy of the mobile data, the mobile data of the object represented by the object identifier to be queried determined based on the above method may not necessarily include mobile data that meets the specified query conditions. Therefore, based on the pre-collected and stored mobile data of the object identifier to be queried, the mobile data that meets the specified query conditions can be further determined to obtain the query result.

[0097] The system can pre-collect movement data of objects at different times, and collect the movement data of any object and the object identifier used to represent that object in the storage corresponding to the specified storage space. For example, the specified storage space can be a disk. The movement data can include the object's location information, such as the object's latitude and longitude, and / or information about the road where the object is located (e.g., the intersection where it is located).

[0098] The query results are determined based on the specific type of the query request. For example, a query request might indicate a need to retrieve the latitude and longitude of all objects passing through a specified area. Correspondingly, the specified query parameters could represent the latitude and longitude range of the specified area, and the query item to which the specified query parameters belong would be a latitude and longitude query item. Secondary index information containing the latitude and longitude query item can be found, and based on this secondary index information, the object identifier corresponding to the specified query parameter can be determined as the object identifier to be queried. The movement data of the object represented by the object identifier to be queried may contain data belonging to the latitude and longitude range of the specified area; that is, the object represented by the object identifier to be queried may have passed through the specified area. Subsequently, based on the pre-collected and stored movement data of the object identifier to be queried, it can be further confirmed whether the object represented by the object identifier to be queried has passed through the specified area, thus identifying all objects that have passed through the specified area. Furthermore, the latitude and longitude of all identified objects that have passed through the specified area can be obtained from the pre-stored movement data corresponding to the object identifier to be queried, serving as the query results.

[0099] Alternatively, if the query request indicates that the number of objects passing through a specified area is required, then the movement data of the object identifier to be queried can be used to further confirm whether the object represented by the object identifier to be queried has passed through the specified area. After determining all objects that have passed through the specified area, the number of the determined objects that have passed through the specified area can be counted as the query result.

[0100] In one embodiment, see Figure 2 , Figure 2 This is a schematic diagram of a second flowchart of the data query method provided in this application embodiment. The data query method provided in this application embodiment can be applied to spatiotemporal query scenarios. The second index information includes: a time query item representing a unit time period, and a latitude and longitude query item representing the encoded value of latitude and longitude; the specified query parameters include a specified latitude and longitude range and a specified time range.

[0101] The mobile data corresponding to any object identifier includes at least one mobile dataset; any mobile dataset includes: latitude and longitude information representing the latitude and longitude of the object represented by the object identifier collected within a historical unit time period, and the historical unit time period. Step S104 includes:

[0102] Step S1041: Determine the first mobile dataset from the mobile data corresponding to the object identifier to be queried.

[0103] In this context, the historical time unit in any of the first mobile datasets belongs to the specified time range.

[0104] Step S1042: Based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range, obtain the query results.

[0105] In this embodiment, the second index information may include time query items representing a unit time period. For example, the unit time period may be one hour or one day, and each time query item may be represented according to a preset format, such as YYYYMMDDHH, where Y, M, D, and H represent year, month, day, and hour, respectively. Correspondingly, 2023-06-05-10:00:00 may be represented as 2023060510 according to the preset format. The second index information may also include latitude and longitude query items representing the encoded values ​​of latitude and longitude. For example, latitude and longitude may be encoded using Z-ordering (a space-filling curve encoding method, also known as Z2 encoding) to obtain latitude and longitude query items. For example, if the latitude and longitude are (122.148, 30.048), the encoded value may be 58414972673.

[0106] As shown in Table 1, the data in Table 1 is mobile data collected in a transportation project provided in this application embodiment. The mobile data may include the vehicle's latitude and longitude, the time of collection of latitude and longitude, the vehicle's speed, and direction. Taking the first row in Table 1 as an example, this row of data indicates that the vehicle with license plate number QA11111 had a latitude and longitude of (122.148, 30.048) at 00:00:00 on 2023-06-05, a speed of 60, and a direction of 1. Q can represent the abbreviation of any province. A direction of 1 can indicate traveling north or south, and can be set according to business needs without specific limitations.

[0107] Table 1

[0108] license plate number longitude latitude time speed direction QA11111 122.148 30.048 2023-06-05-00:00:00 60 1 QA22222 122.148 30.048 2023-06-05-00:00:00 60 1 QA33333 122.103 30.025 2023-06-05-00:00:00 80 0 QA11111 122.148 30.048 2023-06-05-00:00:10 60 1 QA22222 122.148 30.048 2023-06-05-00:00:10 60 1 QA33333 122.103 30.025 2023-06-05-00:00:10 80 0 …… …… …… …… …… ……

[0109] The second index information can be represented in key-value pairs. As shown in Table 2, Table 2 can represent the second index information obtained based on the movement data in Table 1. In Table 2, Key represents the query item, YYYYMMDDHH represents the time query item, and Z2(X, Y) represents the latitude and longitude query item. The time query item and the latitude and longitude query item can be byte-wrapped; correspondingly, the time query item can be 4 bytes, and the latitude and longitude query item can be 8 bytes. In Value, Set(ID) represents the object identifier.

[0110] 2023060500 represents the hour from 2023-06-05-00:00:00 to 2023-06-05-00:59:59. 58414972673 can represent the coded value for latitude and longitude (122.148, 30.048), and 58414969258 can represent the coded value for latitude and longitude (122.103, 30.025). ID1 corresponds to vehicle license plate number QA11111, ID2 corresponds to vehicle license plate number QA22222, and ID3 corresponds to vehicle license plate number QA33333. Vehicles passing through latitude and longitude (122.148, 30.048) between 00:00:00 and 00:59:59 on June 5, 2023 include QA11111 and QA22222. Correspondingly, in Table 2, 2023060500 and 58414972673 correspond to (ID1, ID2). Vehicles passing through latitude and longitude (122.103, 30.025) between 00:00:00 and 00:59:59 on June 5, 2023 include QA33333. Correspondingly, in Table 2, 2023060500 and 58414969258 correspond to ID3.

[0111] Table 2

[0112]

[0113] Accordingly, the specified query parameters can include a specified latitude and longitude range and a specified time range. For example, the specified latitude and longitude range can be (121.100, 30.000) to (122.100, 30.100), and the specified time range can be 2023-06-05-10:00:00 to 2023-06-06-10:00:00. The specified query parameters can be: the encoded value of the specified latitude and longitude range, and the specified time range represented according to a preset format. The encoding method of the specified latitude and longitude range is the same as the encoding method of the latitude and longitude query item, and the preset format is the same as the preset format for the time query item mentioned above.

[0114] For each object identifier, the latitude and longitude of the object represented by that identifier are pre-collected and recorded. The latitude and longitude collected within a historical time unit (i.e., historical latitude and longitude) can be processed to obtain the latitude and longitude information for that historical time unit. Thus, a mobile dataset containing that historical time unit and its latitude and longitude information can be obtained; that is, one or more mobile datasets corresponding to that object identifier can be obtained, which are the mobile data corresponding to that object identifier. The duration of a historical time unit is the same as the duration of the aforementioned time unit.

[0115] In one implementation, the latitude and longitude information in any mobile dataset is: the historical latitude and longitude collected within a historical unit time period.

[0116] In another implementation, the latitude and longitude information in any mobile dataset is obtained by processing the historical latitude and longitude values ​​collected within a historical unit time period using a preset time-series compression algorithm.

[0117] In this compression process, since the location of a specified object often doesn't change much in adjacent time periods (i.e., the latitude and longitude values ​​collected in adjacent time periods don't change much), for the same object, the historical latitude and longitude values ​​collected within a historical unit time period can be compressed using a preset time-series compression algorithm to obtain the latitude and longitude information in the mobile dataset containing that historical unit time period. For example, the preset time-series compression algorithm could be the ZigZag algorithm (a data compression algorithm) or the Gorilla algorithm (an algorithm for compressing time-series data).

[0118] Based on the above processing, since the location of a specified object does not change much in adjacent time periods, a preset time-series compression algorithm can be used to compress each historical latitude and longitude, which can reduce the size of the data stored in the mobile dataset. In other words, it can reduce the storage space occupied by the mobile data corresponding to each object identifier, and further save storage space.

[0119] Furthermore, from at least one mobile data set corresponding to the mobile data of the object to be queried, the mobile data set containing historical time periods belonging to a specified time range can be identified as the first mobile data set. Since the specified time range can contain one or more historical time periods, or the specified time range can also belong to a single historical time period, the identified first mobile data set can be one or more. Subsequently, the latitude and longitude information belonging to a specified latitude and longitude range within the first mobile data set can be determined, and the query results can be obtained based on the determined latitude and longitude information.

[0120] This allows for queries based on time and latitude / longitude coordinates, enabling searches for mobile data falling within a specified latitude / longitude range and time period. Furthermore, when a new query is needed, a new mapping between the query and the object identifier can be established to achieve spatiotemporal queries without needing to create a new mapping between the query and the mobile data. This eliminates the need to record multiple copies of the mobile data, avoiding wasted storage space and saving storage capacity.

[0121] In one embodiment, any mobile dataset containing the mobile data corresponding to any object identifier may further include at least one of time information, speed information, and direction information. Time information indicates the time (i.e., the time of acquisition) when the latitude and longitude of the object represented by the object identifier was collected within a historical unit time period. Speed ​​information indicates the speed of the object when each historical latitude and longitude was acquired. Direction information indicates the direction of the object when each historical latitude and longitude was acquired. One historical latitude and longitude corresponds to one time, speed, and direction.

[0122] Since the latitude and longitude of an object collected within adjacent time intervals do not change significantly, nor do the speed, direction, and collection time, the collected speed, direction, and collection time for the same object can be processed using a preset time-series compression algorithm to obtain speed, direction, and time information. Alternatively, the collected speed, direction, and collection time can be directly used as speed, direction, and time information.

[0123] In this application, any mobile dataset contains at least one type of mobile data. For example, the mobile data may be a historical time period, latitude and longitude information, time information, speed information, and direction information as described in the above embodiments.

[0124] In one embodiment, any mobile dataset further includes: a range of latitude and longitude to be matched; the range of latitude and longitude to be matched represents: the latitude and longitude of the smallest bounding polygon region containing the latitude and longitude of the object collected within the historical unit time period.

[0125] Step S1042 includes:

[0126] Step 1: Obtain the query results based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset.

[0127] In this case, the latitude and longitude range to be matched in any second mobile dataset intersects with the specified latitude and longitude range.

[0128] In this embodiment, for any mobile dataset contained in the mobile data corresponding to an object identifier, the minimum bounding polygon region containing each historical latitude and longitude collected within a historical time period contained in the mobile dataset can be determined. The latitude and longitude range representing the minimum bounding polygon region (i.e., the latitude and longitude range to be matched) can be recorded in the mobile dataset. For example, the latitude and longitude of the boundary points of the minimum bounding polygon region can be recorded as the latitude and longitude range to be matched. If the minimum bounding polygon region can be a minimum bounding rectangle region, the latitude and longitude of the four vertices of the minimum bounding rectangle region can be recorded as the latitude and longitude range to be matched.

[0129] For each first mobile dataset, it can be determined whether the latitude and longitude range to be matched in the first mobile dataset intersects with the specified latitude and longitude range. If the latitude and longitude range to be matched in the first mobile dataset intersects with the specified latitude and longitude range, it indicates that the latitude and longitude information contained in the first mobile dataset may belong to the specified latitude and longitude range, and thus the first mobile dataset can be identified as the second mobile dataset. For example, the latitude and longitude represented by all the latitude and longitude information recorded in the first mobile dataset can be compared with the specified latitude and longitude range to determine the latitude and longitude belonging to the specified latitude and longitude range, and the query results can be obtained based on the determined latitude and longitude belonging to the specified latitude and longitude range.

[0130] If the latitude and longitude range to be matched in the first mobile dataset does not intersect with the specified latitude and longitude range, it means that the latitude and longitude represented by all the latitude and longitude information recorded in the first mobile dataset does not belong to the specified latitude and longitude range, and therefore there is no need to determine the query result based on the latitude and longitude information recorded in the first mobile dataset.

[0131] Furthermore, query results can be obtained based on the latitude and longitude information recorded in the determined second mobile dataset. In this way, the first mobile dataset can be initially filtered based on the range of latitude and longitude to be matched, thus determining the second mobile dataset, and query results can be obtained based on the latitude and longitude information recorded in the second mobile dataset. This eliminates the need to obtain query results based on the latitude and longitude information recorded in all the first mobile datasets. Therefore, the efficiency of obtaining query results can be improved, i.e., query efficiency can be increased.

[0132] In one embodiment, any mobile dataset further includes: a region identifier for each sub-region within the minimum bounding polygon region; any region identifier indicates whether the route formed by latitude and longitude information passes through the sub-region represented by the region identifier.

[0133] Step 1 includes:

[0134] For each second mobile dataset determined from the first mobile dataset, if there is a target sub-region that intersects with the specified latitude and longitude range within each sub-region of the latitude and longitude range to be matched in the second mobile dataset, then the query result is obtained based on the latitude and longitude information recorded in the second mobile dataset.

[0135] The area identifier of the target sub-region indicates that the route composed of latitude and longitude information passes through the target sub-region.

[0136] In this embodiment, for any mobile dataset contained in the mobile data corresponding to an object identifier, after determining the minimum bounding polygon region corresponding to the mobile dataset, the minimum bounding polygon region can be divided into multiple sub-regions. For example, if the minimum bounding polygon region is a rectangular region, it can be divided into multiple rectangular sub-regions of equal size. For example, the number of sub-regions obtained can be 16 or 25.

[0137] For each sub-region, the region identifier of the sub-region can be determined based on whether the route formed by the latitude and longitude information contained in the mobile dataset passes through the sub-region, and the region identifier of each sub-region is recorded in the mobile dataset. For example, the latitude and longitude range of each sub-region can be determined based on the latitude and longitude of the smallest bounding polygon region and the sub-region division method. Furthermore, for each sub-region, if the route formed by the latitude and longitude information intersects with the latitude and longitude range of the sub-region, it means that the route formed by the latitude and longitude information passes through the sub-region; if the route formed by the latitude and longitude information does not intersect with the latitude and longitude range of the sub-region, it means that the route formed by the latitude and longitude information does not pass through the sub-region. That is, it is possible to determine whether the route formed by the latitude and longitude information contained in the mobile dataset passes through each sub-region and obtain the region identifier of each sub-region.

[0138] For each second mobile dataset determined from the first mobile dataset, the latitude and longitude information contained in the second mobile dataset may contain latitude and longitude within a specified latitude and longitude range. Therefore, it is possible to further determine the sub-regions (which can be called candidate sub-regions) within each sub-region of the latitude and longitude range to be matched in the second mobile dataset that intersect with the specified latitude and longitude range. For each candidate sub-region, if the region identifier of the candidate sub-region indicates that the route formed by the latitude and longitude information passes through the candidate sub-region, then the candidate sub-region is the target sub-region.

[0139] If the target sub-region exists within each sub-region of the latitude and longitude range to be matched in the second mobile dataset, it indicates that the latitude and longitude information contained in the second mobile dataset belongs to the specified latitude and longitude range. Therefore, query results can be obtained based on the latitude and longitude information recorded in the second mobile dataset. For example, the latitude and longitude information representing the target sub-region recorded in the second mobile dataset can be compared with the specified latitude and longitude range to determine the latitude and longitude belonging to the specified range. Query results can then be obtained based on the mobile data to which the determined latitude and longitude belonging to the specified range belong.

[0140] If the target sub-region does not exist in any of the sub-regions included in the latitude and longitude range to be matched in the second mobile dataset, it means that the latitude and longitude represented by all the latitude and longitude information recorded in the second mobile dataset does not belong to the specified latitude and longitude range, and therefore there is no need to determine the query result based on the latitude and longitude information recorded in the second mobile dataset.

[0141] Based on the above processing, after initially filtering the first mobile dataset according to the latitude and longitude range to be matched and determining the second mobile dataset, further filtering can be performed by determining whether a target sub-region exists within each sub-region of the latitude and longitude range to be matched in the second mobile dataset. Thus, if the latitude and longitude range to be matched in a second mobile dataset intersects with the specified latitude and longitude range, but the route formed by the latitude and longitude information in the second mobile dataset does not intersect with the specified latitude and longitude range, the latitude and longitude information recorded in the second mobile dataset will not be retrieved for obtaining query results. This further reduces the amount of data processed and improves the efficiency of obtaining query results, i.e., further improves query efficiency.

[0142] In one embodiment, see Figure 3 , Figure 3This is a schematic diagram of a storage structure for mobile data corresponding to an object identifier, provided in an embodiment of this application. For any object identifier, the data block (which can be represented as ChunkID) corresponding to the object identifier includes a header (which can be represented as ChunkHeader) and a data portion (which can be represented as ChunkData), and the data portion stores the mobile data corresponding to the object identifier on a page-by-page basis.

[0143] The header records: the object identifier (which can be represented as ID), the size of the data block corresponding to the object identifier (which can be represented as ChunkSize), the number of pages in the data block corresponding to the object identifier (which can be represented as NumOfPages), and the offset address of the header of each page (which can be represented as a List). <offsetofpageheader>), and the size of the header of each page (which can be represented as a List). <pageheadersize>The data section includes the header of each page (which can be represented as PageHeader1 and PageHeader2) and the data section of each page (which can be represented as PageData1 and PageData2).

[0144] For any given page, the header records: the size of any mobile dataset corresponding to the object identifier before compression using the preset temporal compression algorithm (represented as UncompressedSize), the size of the mobile dataset after compression using the preset temporal compression algorithm (represented as CompressedSize), the statistical values ​​of the mobile dataset (represented as Statistics), and the offset address of the data portion of the page (represented as OffsetOfPageData). The statistical values ​​of a mobile dataset include: the start time (represented as StartTime) and end time (represented as EndTime) of a historical time period, the latitude and longitude range to be matched (represented as MBR), the region identifier of each sub-region within the minimum bounding polygon region (represented as TrajectorySignature), and FieldStatistics (represented as on-site statistical values). For any type of mobile data recorded in a mobile dataset, FieldStatistics can record the on-site statistical values ​​for that type of mobile data. For example, the on-site statistical value for that type of mobile data can be the average value of that type of mobile data collected within that historical time period. For example, the on-site statistical value of speed information can be the average value of speed data collected within the historical time period, or it can represent the average speed of the object represented by the object identifier within the historical time period.

[0145] The data section of this page records: timestamps (which can be represented as Timestamps), and movement data collected within this historical time unit (which can be represented as FieldValues). Movement data may include: the latitude and longitude of the object represented by the object identifier, the speed of the object represented by the object identifier when collecting each latitude and longitude, and the time of collection for each latitude and longitude.

[0146] See Figure 4 , Figure 4 This is a schematic diagram of the storage structure of a mobile dataset provided in an embodiment of this application. The object identifier corresponding to this mobile dataset is ID1. The mobile dataset records a historical unit time period, the latitude and longitude range to be matched, and the region identifier of each sub-region within the smallest bounding polygon region. The start time of the historical unit time period is 2023-06-05-00:00:00, and the end time is 2023-06-05-00:59:50.

[0147] The subregions within the smallest bounding polygon region can be numbered in order from left to right and from bottom to top, such as... Figure 4 The rectangle on the right shows 16 small regions numbered 0-15. The curve represents the route formed by the latitude and longitude information recorded in this mobile dataset. The route formed by latitude and longitude information (i.e....) Figure 4 In the expression `tr`, the region identifier of the sub-region traversed can be recorded as 1, and the region identifier of the sub-region not traversed can be recorded as 0. The sub-regions traversed by `tr` are the sub-regions numbered 0, 1, 2, 4, 7, 11, and 15. Correspondingly, the region identifiers of each sub-region, in descending order of their numbering, can be recorded as 1000100010010111. For example, the region identifiers of each sub-region can be recorded as Sig(tr) = (1000 1000 10010111). bin Sig(tr) can be called a route signature, and bin represents binary.

[0148] The movement data of the object represented by ID1 collected within this historical time unit can be shown in Table 3. X, Y, and Time represent the longitude and latitude of the object represented by ID1, and the time of collection for each longitude and latitude, respectively.

[0149] Table 3

[0150] X Y Time 121.111 78.311 2023-06-05-00:00:00 121.111 78.312 2023-06-05-00:59:10 … … … 121.111 79.311 2023-06-05-00:59:50

[0151] In one embodiment, the storage device for storing the first index information can be memory, and any first index information is: the correspondence between object identifiers stored in memory and at least one type of query item. Step S103 includes: finding the object identifier corresponding to the specified query parameter from the second index information, and using it as the object identifier to be queried.

[0152] In this embodiment, the first index information can be stored in memory. Accordingly, any first index information represents the correspondence between object identifiers stored in memory and at least one type of query item. For example, any first index information can record object identifiers and at least one type of query item in the manner shown in Table 2 of the above embodiments.

[0153] The index information containing the query term to which the specified query parameter belongs can be found from each of the first index information and used as the second index information. Since the second index information is determined from each of the first index information, the second index information can be a correspondence between object identifiers and query terms containing the specified query parameter. Furthermore, the object identifier (i.e., the object identifier to be queried) corresponding to the specified query parameter can be found from the second index information.

[0154] In this way, based on the correspondence between object identifiers stored in memory and at least one type of query item, as well as the pre-collected and stored movement data of objects represented by each object identifier, the movement data that meets the specified query conditions can be determined, and the query results can be obtained. Since the data processing speed in memory is relatively fast, the speed of directly looking up the object identifier corresponding to the specified query parameter from the second index information recorded in memory is also relatively fast.

[0155] In one embodiment, see Figure 5 , Figure 5 This is a schematic diagram of a third flow of the data query method provided in an embodiment of this application. The storage device for storing the first index information can be a disk, and the second index information includes: a first correspondence and at least one second correspondence; the first correspondence represents the correspondence between query parameters and the storage addresses of the corresponding object identifiers in the disk; the first correspondence to which each query parameter belongs is stored in the disk in order of the size relationship of the corresponding query parameters.

[0156] Any second correspondence represents a correspondence between a range of query parameters and a range of storage addresses; the storage address range represents the storage address on disk of the first correspondence to which the query parameters belonging to the range of query parameters belong.

[0157] Step S103 includes:

[0158] Step S1031: Determine the range of query parameters to which the specified query parameter belongs from at least one second correspondence, and use it as the target query parameter range.

[0159] Step S1032: Perform a query within the storage address range of the second correspondence record to which the target query parameter range belongs in the disk to obtain the first correspondence to which the specified query parameter belongs.

[0160] Step S1033: Obtain the object identifier recorded at the storage address in the first correspondence queried in the disk, and use it as the identifier of the object to be queried.

[0161] In this embodiment, because disk data processing speed is slow, directly storing the correspondence between object identifiers and at least one type of query item on the disk would result in a slow search for the object identifier from the correspondence recorded on the disk containing the query items to which the specified query parameters belong, thus reducing query efficiency. Therefore, the efficiency of finding the object identifier can be improved by using a first correspondence and a second correspondence.

[0162] A pre-established mapping between each query parameter and its corresponding object identifier's storage address can be created, yielding a first mapping. This mapping can then be stored on disk in order of the query parameters' size. For example, the first mappings for each query parameter can be stored sequentially on disk, either in ascending or descending order of the included query parameters. Furthermore, each query parameter can be divided into at least one range, with each range being adjacent to the others. Adjacent ranges indicate that there is no overlap between them.

[0163] In the second index information, for any range of query parameters, the storage address range on disk of the first correspondence to which the query parameters belonging to that range belong can be determined. This query parameter range, along with the determined storage address range, can then be used as a second correspondence.

[0164] Since the ranges of each query parameter are adjacent, and the first correspondence of each query parameter in the second index information is stored on the disk in the order of the size relationship of each query parameter, it can be guaranteed that for each range of query parameters, the storage address within the storage address range corresponding to that range of query parameters is the storage address of the first correspondence of the query parameter belonging to that range of query parameters.

[0165] Furthermore, the range of query parameters to which the specified query parameter belongs (i.e., the target query parameter range) can be determined from the second correspondence, and a query can be performed within the storage address range recorded in the second correspondence to which the target query parameter range belongs, to obtain the first correspondence to which the specified query parameter belongs. This also allows determination of the storage address recorded in the first correspondence to which the specified query parameter belongs, and the object identifier (i.e., the identifier of the object to be queried) stored at the determined storage address can be obtained.

[0166] In the above recording method, the second correspondence records the storage address of the first correspondence, and correspondingly, the first correspondence records the storage address of the corresponding object identifier. That is, this recording method can be called the two-level index recording method.

[0167] Understandably, if a non-secondary index recording method is used, for example, the mapping between query parameters and object identifiers is recorded on disk; the second mapping directly records the range of query parameters, and the storage address range of object identifiers corresponding to query parameters within that range, as found in the second index information. In this way, during a query, the object identifier corresponding to the specified query parameter can be determined from the object identifiers within a certain storage address range based on the second mapping. That is, the mapping between object identifiers and query parameters within a certain storage address range needs to be loaded into memory for processing. Since the amount of object identifier data is large, this method requires a significant amount of memory space, and consequently, reduces query efficiency.

[0168] Based on the aforementioned two-level index record method, the first correspondence within a certain storage address range can be queried based on the second correspondence. Then, the corresponding object identifier (i.e., the object identifier to be queried) can be retrieved directly from the storage address recorded in the queried first correspondence. In the above process, only the first correspondence within a certain storage address range needs to be loaded into memory for processing. Compared to the correspondence between object identifiers and query parameters in the non-two-level index record method, the amount of data recording the correspondence between query parameters and storage addresses in the first correspondence is smaller. This reduces memory space usage and correspondingly improves query efficiency.

[0169] Based on the above processing, the storage address of the object identifier corresponding to a specified query parameter can be obtained by referring to the pre-recorded correspondence between each query parameter and its corresponding storage address, as well as the storage address of the first correspondence between each query parameter range and the query parameters belonging to each query parameter range. Thus, the object identifier to be queried can be obtained from the obtained storage address. In this way, the object identifier to be queried can be obtained, ensuring that the query of mobile data can be performed.

[0170] In one embodiment, the process of constructing the first index information on the disk includes:

[0171] Step 1: Obtain the third correspondence between each query parameter recorded in memory and each object identifier.

[0172] Step 2: Write the identifiers of each object in the third correspondence to the disk.

[0173] Step 3: Store the first correspondence of each query parameter in the disk according to the size relationship of each query parameter.

[0174] Step 4: Group each query parameter according to the preset size and determine the query parameter range to which each query parameter belongs.

[0175] Step 5: For each range of query parameters, determine the storage address range on the disk of the first correspondence to which the query parameters belong to that range, obtain the second correspondence to which the query parameter range belongs, and write it to the disk.

[0176] In this embodiment, the correspondence between each query parameter and each object identifier recorded in memory (i.e., the third correspondence) can be obtained. For example, the third correspondence recorded in memory can be Table 2 above. The third correspondence recorded in memory within a period can be obtained periodically. For example, when a preset write period is reached, the third correspondence recorded in memory in the previous write period can be obtained. For example, the preset write period can be 1 day or 12 hours. Then, each object identifier in the obtained third correspondence can be written to the disk. In addition, when writing an object identifier in the third correspondence to the disk, the query parameter corresponding to that object identifier can also be written to the disk accordingly.

[0177] For each query parameter, the correspondence between that query parameter and the corresponding object identifier's storage address on disk can be determined (i.e., the first correspondence). Furthermore, the first correspondences for each query parameter can be stored sequentially on disk according to their relative sizes.

[0178] The query parameters are grouped according to a preset size to determine the query parameter range to which each parameter belongs. For example, the query parameters can be sorted from largest to smallest or smallest to largest, and the first 1000, the 1001st to 2000th, ..., the 1+1000*M-1000*(M+1)th query parameters can each be defined as a query parameter range, where M can be determined based on the number of query parameters. That is, each query parameter range can contain 1000 query parameters.

[0179] For each range of query parameters, determine the storage address range on disk for the first correspondence belonging to that range of query parameters. This storage address range may include: the storage address on disk for the first correspondence belonging to the first query parameter within that range, and the storage space occupied on disk for the first correspondences belonging to each query parameter within that range. This allows us to obtain the correspondence between the query parameter range and the storage address range (i.e., the second correspondence), which is then written to disk.

[0180] In this way, the two-level index record method described in the above embodiments can be implemented, which can reduce memory space usage and correspondingly improve query efficiency. Furthermore, after constructing the first index information based on the third correspondence recorded in memory, the third correspondence recorded in memory can be deleted, thus saving memory storage space.

[0181] In one embodiment, refer to Figure 6a , Figure 6a is a schematic diagram of a data storage structure provided by an embodiment of the present application. A Map (mapping) <Key0, SortedMap (sorted map)> is recorded in the memory. Key0 represents the date for recording the SortedMap (which may be expressed as Day). The SortedMap records Key and Value, that is, records the third correspondence in the above embodiment. The Key includes: YYYYMMDDHH, that is, the time query item in the above embodiment, which is Int (integer) data; and SF-Code (a coded value), that is, the latitude and longitude query item in the above embodiment, which is Long (long integer) data. The Value includes: Set(ID), that is, the object identifier in the above embodiment. All object identifiers included in the Value may form an ID set.

[0182] Every time one day passes, the data recorded in the memory for that day is stored to a disk, that is, periodic disk flushing is implemented. The data recorded in the disk is cold data. The above Key and Value are recorded in the disk in the structure of a B+ tree, where the Key is the key of the B+ tree, and the Value is the value of the B+ tree. That is, when a preset writing cycle is reached, the third correspondence recorded in the memory within the previous writing cycle is acquired. Each object identifier in the third correspondence is written to the disk. The preset writing cycle is 1 day.

[0183] Refer to Figure 6b , Figure 6b is a schematic diagram of a storage structure of second index information provided by an embodiment of the present application. The disk may record the second correspondence and the first correspondence in the above embodiments. Each query parameter may be sorted, and divided according to a preset range size to obtain each query parameter range. For example Figure 6b the LeafIndex (leaf index) 1.Key-LeafIndex1000.Key, LeafIndex1001.Key-LeafIndex2000.Key, ..., LeafIndex(1+1000*M).Key-LeafIndex1000*(M+1).Key in. Each block may represent one second correspondence in the above embodiment. Each Key represents one query parameter.

[0184] Taking LeafIndex1.Key-LeafIndex1000.Key as an example, LeafIndex1.Key-LeafIndex1000.Key can represent the second correspondence between the query parameter range Key1 to Key1000 and the storage address range of Key1 to Key1000 on disk. This part can record the values ​​of the first key (i.e., Key1) and the 1000th key (i.e., Key1000), that is, the query parameters represented by Key1 and Key1000, the storage address of the first correspondence to which Key1 belongs, and the size of the storage space occupied by each first correspondence to which Key1 to Key1000 belongs. LeafIndex1001.Key-LeafIndex2000.Key, ..., LeafIndex(1+1000*M).Key-LeafIndex1000*(M+1).Key is similar to LeafIndex1.Key-LeafIndex1000.Key.

[0185] For each range of query parameters, the storage address range of the first correspondence to which the query parameters belonging to that range belong, and the storage address of the first correspondence to which each query parameter belongs, can be recorded. That is, Figure 6b The Index section, taking LeafIndex1 as an example, represents the storage address of the first mapping relationship to which Key1 belongs, and the query parameters represented by Key1. Other data in the Index section is similar to LeafIndex1.

[0186] The first correspondence is... Figure 6b In the Data section, Key1 represents the query parameter represented by LeafIndex1.Key, and Value1 represents the object identifier corresponding to the query parameter represented by LeafIndex1.Key. Other Keys and Values ​​are similar. The Meta section records the storage address of LeafIndex1 on disk (which can be represented as offset) and the size of the entire Index section.

[0187] Based on the same inventive concept, embodiments of this application also provide a data query device. See also Figure 7 , Figure 7 This is a schematic diagram of a data query device provided in an embodiment of this application. The device includes:

[0188] The query request receiving module 701 is used to receive query requests carrying specified query parameters;

[0189] The correspondence determination module 702 is used to search for index information containing the query item to which the specified query parameter belongs from at least one first index information pre-stored in the memory, and use it as the second index information; wherein, any first index information represents: the correspondence between an object identifier and at least one type of query item;

[0190] The identifier determination module 703 is used to determine the object identifier corresponding to the specified query parameter based on the second index information, and use it as the identifier of the object to be queried;

[0191] The query result determination module 704 is used to obtain a query result based on the pre-stored movement data corresponding to the object identifier to be queried; wherein, the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance.

[0192] Based on the data query apparatus provided in this application embodiment, a correspondence between query items and object identifiers (i.e., first index information) can be pre-established and stored in a memory. Upon receiving a query request, the query item to which the specified query parameters carried in the query request belong can be determined, and first index information (i.e., second index information) containing the determined query item can be determined from the pre-stored first index information. Based on the second index information, the object identifier (i.e., the identifier of the object to be queried) corresponding to the specified query parameters can be determined.

[0193] The movement data corresponding to any object identifier can include: pre-collected location information of the object represented by that object identifier. The query result can be determined based on the pre-collected and stored movement data corresponding to the object identifier to be queried. Correspondingly, when a query is needed based on a new query item, a new mapping between the query item and the object identifier can be established to perform the query, without needing to establish a new mapping between the query item and the movement data. This eliminates the need to record multiple sets of movement data, avoiding wasted storage space and saving storage space.

[0194] In one embodiment, the second index information includes: a time query item representing a unit time period, and a latitude and longitude query item representing the coded value of latitude and longitude; the specified query parameters include a specified latitude and longitude range and a specified time range;

[0195] The mobile data corresponding to any object identifier includes at least one mobile dataset; any mobile dataset includes: latitude and longitude information representing the latitude and longitude of the object represented by the object identifier collected within a historical unit time period, and the historical unit time period;

[0196] The query result determination module 704 includes:

[0197] The first mobile dataset determination submodule is used to determine the first mobile dataset from the mobile data corresponding to the object identifier to be queried; wherein, the historical unit time period in any first mobile dataset belongs to the specified time range;

[0198] The query result determination submodule is used to obtain query results based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range.

[0199] In one embodiment, any mobile dataset further includes: a range of latitude and longitude to be matched; the range of latitude and longitude to be matched represents: the latitude and longitude of the smallest bounding polygon region containing the latitude and longitude of the object collected within the historical unit time period;

[0200] The query result determination submodule includes:

[0201] The query result determination unit is used to obtain query results based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset; wherein, the latitude and longitude range to be matched in any second mobile dataset intersects with the specified latitude and longitude range.

[0202] In one embodiment, any mobile dataset further includes: a region identifier for each sub-region within the minimum bounding polygon region; any region identifier indicates whether the route formed by the latitude and longitude information passes through the sub-region represented by the region identifier;

[0203] The query result determination unit is specifically used to determine a query result for each second mobile dataset determined from the first mobile dataset if there is a target sub-region that intersects with the specified latitude and longitude range in each sub-region of the latitude and longitude range to be matched in the second mobile dataset; wherein, the region identifier of the target sub-region indicates that the route formed by the latitude and longitude information passes through the target sub-region.

[0204] In one embodiment, the latitude and longitude information in any mobile dataset is obtained by processing each historical latitude and longitude collected within a historical unit time period using a preset time-series compression algorithm.

[0205] In one embodiment, the storage is a disk, and the second index information includes: a first correspondence and at least one second correspondence; the first correspondence represents the correspondence between query parameters and the storage addresses of the corresponding object identifiers in the disk; the first correspondences to which each query parameter belongs are stored in the disk in order of the size relationship of the corresponding query parameters;

[0206] Any second correspondence represents a correspondence between a range of query parameters and a range of storage addresses; the storage address range represents the storage address on the disk of the first correspondence to which the query parameters belonging to the range of query parameters belong.

[0207] The identifier determination module 703 is specifically used to determine the query parameter range to which the specified query parameter belongs from at least one second correspondence, as the target query parameter range; to perform a query within the storage address range recorded in the second correspondence to which the target query parameter range belongs in the disk, to obtain the first correspondence to which the specified query parameter belongs; and to obtain the object identifier recorded at the storage address recorded in the first correspondence queried in the disk, as the identifier of the object to be queried.

[0208] In one embodiment, the apparatus further includes:

[0209] The first index information construction module is used to obtain the third correspondence between each query parameter and each object identifier recorded in memory; write each object identifier in the third correspondence to the disk; sequentially store the first correspondence to which each query parameter belongs in the disk according to the size relationship of each query parameter; group each query parameter according to a preset size to determine the query parameter range to which each query parameter belongs; for each query parameter range, determine the storage address range of the first correspondence to which the query parameter belongs in the disk, obtain the second correspondence to which the query parameter range belongs, and write it to the disk.

[0210] In one embodiment, the storage is memory, and any first index information is: the correspondence between object identifiers stored in the memory and at least one type of query item;

[0211] The identifier determination module 703 is specifically used to find the object identifier corresponding to the specified query parameter from the second index information, and use it as the identifier of the object to be queried.

[0212] This application also provides an electronic device, such as... Figure 8 As shown, it includes:

[0213] Memory 801 is used to store computer programs;

[0214] When processor 802 executes a program stored in memory 801, it performs the following steps:

[0215] Receive query requests carrying specified query parameters;

[0216] From at least one first index information pre-stored in the memory, find the index information containing the query item to which the specified query parameter belongs, and use it as the second index information; wherein, any first index information represents: the correspondence between an object identifier and at least one type of query item;

[0217] Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried;

[0218] Based on the pre-stored movement data corresponding to the object identifier to be queried, the query result is obtained; wherein, the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance.

[0219] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 802, the communication interface, and the memory 801 communicating with each other via the communication bus.

[0220] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0221] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0222] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0223] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be 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, or discrete hardware components.

[0224] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described data query methods.

[0225] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the data query methods described in the above embodiments.

[0226] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.

[0227] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0228] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, electronic devices, storage media, and computer program products are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0229] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.< / pageheadersize> < / offsetofpageheader>

Claims

1. A data query method, characterized in that, The method includes: Receive query requests carrying specified query parameters; From at least one first index information pre-stored in the memory, find the index information containing the query item to which the specified query parameter belongs, and use it as the second index information; wherein, any first index information represents: the correspondence between an object identifier and at least one type of query item; Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried; Based on the pre-stored movement data corresponding to the object identifier to be queried, the query result is obtained; wherein, the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance; The storage is a disk, and the second index information includes: a first correspondence and at least one second correspondence; The first correspondence represents the correspondence between query parameters and the corresponding object identifiers in the storage addresses of the disk; the first correspondence of each query parameter is stored in the disk in order of the size relationship of the corresponding query parameters. Any second correspondence represents a correspondence between a range of query parameters and a range of storage addresses; the storage address range represents the storage address on the disk of the first correspondence to which the query parameters belonging to the range of query parameters belong. Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried, including: The range of query parameters to which the specified query parameter belongs is determined from at least one second correspondence, and is used as the target query parameter range; A query is performed within the storage address range recorded in the second correspondence to which the target query parameter range belongs in the disk to obtain the first correspondence to which the specified query parameter belongs; Obtain the object identifier recorded at the storage address in the first correspondence queried in the disk, and use it as the object identifier to be queried.

2. The method according to claim 1, characterized in that, The second index information includes: a time query item representing a unit time period, and a latitude and longitude query item representing the encoded value of latitude and longitude; the specified query parameters include a specified latitude and longitude range and a specified time range; The mobile data corresponding to any object identifier includes at least one mobile dataset; any mobile dataset includes: latitude and longitude information representing the latitude and longitude of the object represented by the object identifier collected within a historical unit time period, and the historical unit time period; The query results obtained based on the pre-stored movement data corresponding to the identifier of the object to be queried include: A first mobile dataset is determined from the mobile data corresponding to the object identifier to be queried; wherein, the historical time unit in any first mobile dataset belongs to the specified time range; Based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range, the query results are obtained.

3. The method according to claim 2, characterized in that, Any mobile dataset also includes: a range of latitude and longitude to be matched; the range of latitude and longitude to be matched represents: the latitude and longitude of the smallest bounding polygon region containing the latitude and longitude of the object collected within the historical unit time period; The query results obtained based on the latitude and longitude information recorded in the first mobile dataset and the specified latitude and longitude range include: Based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset, the query results are obtained; wherein, the latitude and longitude range to be matched in any second mobile dataset intersects with the specified latitude and longitude range.

4. The method according to claim 3, characterized in that, Any mobile dataset also includes: a region identifier for each sub-region within the minimum bounding polygon region; any region identifier indicates whether the route formed by the latitude and longitude information passes through the sub-region represented by the region identifier; The query results obtained based on the latitude and longitude information recorded in the second mobile dataset determined from the first mobile dataset include: For each second mobile dataset determined from the first mobile dataset, if there is a target sub-region that intersects with the specified latitude and longitude range among the sub-regions included in the latitude and longitude range to be matched in the second mobile dataset, then a query result is obtained based on the latitude and longitude information recorded in the second mobile dataset; wherein, the region identifier of the target sub-region indicates that the route formed by the latitude and longitude information passes through the target sub-region.

5. The method according to claim 2, characterized in that, The latitude and longitude information in any mobile dataset is obtained by processing the historical latitude and longitude values ​​collected within a historical unit time period using a preset time-series compression algorithm.

6. The method according to claim 1, characterized in that, The process of constructing the first index information in the disk includes: Obtain the third correspondence between each query parameter recorded in memory and each object identifier; Write the object identifiers in the third correspondence relationship to the disk; According to the size relationship of each query parameter, the first correspondence relationship of each query parameter is stored sequentially in the disk. Group each query parameter according to a preset size to determine the query parameter range to which each query parameter belongs; For each range of query parameters, determine the storage address range of the first correspondence to which the query parameters belong in the range on the disk, obtain the second correspondence to which the query parameter range belongs, and write it to the disk.

7. The method according to claim 1, characterized in that, The storage is memory, and any first index information is: the correspondence between object identifiers stored in the memory and at least one type of query item; Based on the second index information, the object identifier corresponding to the specified query parameter is determined as the object identifier to be queried, including: From the second index information, find the object identifier corresponding to the specified query parameter, and use it as the object identifier to be queried.

8. A data query device, characterized in that, The device includes: The query request receiving module is used to receive query requests carrying specified query parameters; The correspondence determination module is used to search for index information containing the query item to which the specified query parameter belongs from at least one first index information pre-stored in the memory, and use it as the second index information; wherein, any first index information represents: the correspondence between an object identifier and at least one type of query item; The identifier determination module is used to determine the object identifier corresponding to the specified query parameter based on the second index information, and use it as the identifier of the object to be queried; The query result determination module is used to obtain query results based on the pre-stored movement data corresponding to the object identifier to be queried; wherein, the movement data corresponding to any object identifier includes: the location information of the object represented by the object identifier collected in advance; The storage is a disk, and the second index information includes: a first correspondence and at least one second correspondence; the first correspondence represents the correspondence between query parameters and the storage addresses of the corresponding object identifiers in the disk; the first correspondence to which each query parameter belongs is stored in the disk in order of the size relationship of the corresponding query parameters. Any second correspondence represents a correspondence between a range of query parameters and a range of storage addresses; the storage address range represents the storage address on the disk of the first correspondence to which the query parameters belonging to the range of query parameters belong. The identifier determination module is specifically used to determine the range of query parameters to which the specified query parameter belongs from at least one second correspondence, as the target query parameter range; to perform a query within the storage address range recorded in the second correspondence to which the target query parameter range belongs in the disk, to obtain the first correspondence to which the specified query parameter belongs; and to obtain the object identifier recorded at the storage address recorded in the first correspondence queried in the disk, as the identifier of the object to be queried.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.

Citation Information

Patent Citations

  • Space-time query method and device, equipment and storage medium

    CN115510339A