Index construction method, trajectory query method, device, equipment and readable medium
By building a two-layer index structure, the first index layer stores track point data, the second index layer stores track outsourcing boxes and sub-outsourcing boxes, and establishing links to associate the two-layer index, the problem of inefficient track similarity query in the existing technology is solved, and efficient track search is achieved.
Patent Information
- Application Number
- CN202010292011.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-14
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2040-04-14
AI Technical Summary
The prior art is difficult to effectively process similarity queries of trajectories, resulting in inefficiency in the process of similarity queries.
By building a two-layer index structure, the first index layer stores track point data, and the second index layer stores track outsourcing boxes and sub-outsourcing boxes, and establishes links to associate the two-layer index to realize the index structure of track search.
Effectively handle similarity query of trajectory, improving the processing efficiency of index structure in similarity query.
Smart Images

Figure CN113312346B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular to an index construction method, a trajectory query method, a device, an electronic device, and a computer-readable medium. Background Art
[0002] GPS-enabled devices and location-based services, such as bicycles, generate a large number of trajectories every day. The number of these trajectories is very large, and they contain a lot of information. These trajectories can be used to guide people's activities, such as personal navigation services, logistics services, etc. In addition, people's running characteristics can be discovered by analyzing their trajectories to provide support for company decision-making. The trajectory of a moving object is usually represented by a string of spatial points with timestamps. Since the amount of data in the trajectory data set is very large, it is usually necessary to index the trajectory. Various index structures have been proposed for trajectories. However, due to various reasons, similarity queries of trajectories cannot be effectively processed. How to make the constructed index structure able to effectively process similarity queries of trajectories has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The purpose of the present application is to propose an index construction method, a trajectory query method, an apparatus, an electronic device and a computer-readable medium, which are used to solve the technical problem existing in the prior art of how to make the constructed index structure able to effectively process trajectory similarity queries.
[0004] According to the first aspect of the embodiment of the present application, an index construction method is provided. The method includes: constructing a first index layer according to trajectory point data, each node in the first index layer is used to store the trajectory point data; grouping multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and constructing index nodes of the second index layer according to the grouping result; constructing a link for the first index layer and the second index layer, so as to establish an association relationship between the sub-enclosure frames corresponding to each index node of the second index layer and the trajectory point data in each node in the first index layer through the link; constructing an index structure for trajectory search according to the first index layer, the second index layer and the association relationship.
[0005] According to the second aspect of the embodiment of the present application, a trajectory query method is provided. The method includes: receiving a similar trajectory query request, the similar trajectory query request is used to request a query for a trajectory similar to the trajectory to be queried; according to the similar trajectory query request, determining the index structure of the corresponding trajectory data, wherein the index structure is an index structure constructed according to the index construction method described in the first aspect of the embodiment of the present application; for the index nodes in the second index layer of the index structure, determining the distance relationship between the sub-enclosing frame in each node and the trajectory to be queried in turn according to the hierarchical relationship; according to the distance relationship, determining the node corresponding to the sub-enclosing frame closest to the trajectory to be queried, and obtaining a trajectory similar to the trajectory to be queried according to the determined node.
[0006] According to the third aspect of the embodiment of the present application, an index construction device is provided. The device includes: a first construction module, which is used to construct a first index layer according to trajectory point data, and each node in the first index layer is used to store the trajectory point data; a second construction module, which is used to group multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and construct index nodes of the second index layer according to the grouping result; a third construction module, which is used to build a link for the first index layer and the second index layer, so as to establish an association relationship between the sub-enclosure frames corresponding to each index node of the second index layer and the trajectory point data in each node in the first index layer through the link; a fourth construction module, which is used to build an index structure for trajectory search according to the first index layer, the second index layer and the association relationship.
[0007] According to the fourth aspect of the embodiment of the present application, a trajectory query device is provided. The device includes: a receiving module for receiving a similar trajectory query request, wherein the similar trajectory query request is used to request a query for a trajectory similar to the trajectory to be queried; a first determination module for determining the index structure of the corresponding trajectory data according to the similar trajectory query request, wherein the index structure is an index structure constructed according to the index construction method described in the first aspect of the embodiment of the present application; a second determination module for determining the distance relationship between the sub-enclosing frame in each node and the trajectory to be queried in turn according to the hierarchical relationship for the index nodes in the second index layer of the index structure; a third determination module for determining the node corresponding to the sub-enclosing frame closest to the trajectory to be queried according to the distance relationship, and obtaining a trajectory similar to the trajectory to be queried according to the determined node.
[0008] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a computer-readable medium configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the index construction method described in the first aspect of the above embodiment, or implement the trajectory query method described in the second aspect of the above embodiment.
[0009] According to a sixth aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the index construction method described in the first aspect of the above embodiment is implemented, or the trajectory query method described in the second aspect of the above embodiment is implemented.
[0010] Through the index construction scheme provided by the embodiment of the present application, a first index layer is constructed according to the trajectory point data, each node in the first index layer is used to store the trajectory point data, and a plurality of sub-external frames contained in the trajectory outer frame corresponding to the trajectory point data are grouped, and the index nodes of the second index layer are constructed according to the grouping results, and then a link is constructed for the first index layer and the second index layer, so as to establish the association relationship between the sub-external frames corresponding to each index node of the second index layer and the trajectory point data in each node in the first index layer through the link, and then an index structure for trajectory search is constructed according to the first index layer, the second index layer and the association relationship. Compared with other existing methods, a link is constructed for the first index layer and the second index layer, so as to establish the association relationship between the sub-external frames corresponding to each index node of the second index layer and the trajectory point data in each node in the first index layer through the link, and then an index structure for trajectory search is constructed according to the first index layer, the second index layer and the association relationship. Since the first index layer stores the trajectory point data and the second index layer stores the corresponding outer frame and the sub-external frame, the constructed index structure can effectively process the similarity query of the trajectory. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0012] Figure 1 A schematic diagram of a trajectory collection network framework according to an embodiment of the present invention;
[0013] Figure 2A is a schematic flow chart of an index building method according to another embodiment of the present invention;
[0014] Figure 2B A schematic diagram of an index building method according to another embodiment of the present invention;
[0015] Figure 2CA schematic diagram of an index building method according to another embodiment of the present invention;
[0016] Figure 2D A schematic diagram of an index building method according to another embodiment of the present invention;
[0017] Figure 2E A schematic diagram of an index building method according to another embodiment of the present invention;
[0018] Figure 3A is a schematic diagram of a trajectory query method according to another embodiment of the present invention;
[0019] Figure 3B is a schematic diagram of a trajectory query method according to another embodiment of the present invention;
[0020] Figure 4A is a schematic diagram of a trajectory query method according to another embodiment of the present invention;
[0021] Figure 4B is a schematic diagram of a trajectory query method according to another embodiment of the present invention;
[0022] Figure 5 A schematic block diagram of an index building device according to another embodiment of the present invention;
[0023] Figure 6 is a schematic block diagram of a trajectory query device according to another embodiment of the present invention;
[0024] Figure 7 A schematic structural diagram of an electronic device according to another embodiment of the present invention;
[0025] Figure 8 The present invention is another embodiment of the hardware structure of an electronic device. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in the field based on the embodiments in the embodiments of the present invention should fall within the scope of protection of the embodiments of the present invention.
[0027] In addition, although the description of the system and method of the embodiment of the present invention is mainly about the request for transportation services, it should be understood that this is only an exemplary embodiment. The index construction method of the embodiment of the present invention can be applied to any other type of online-to-offline service. For example, the index construction method of the embodiment of the present invention can be applied to transportation systems in different environments, including land, sea, aerospace or the like or any combination thereof. The vehicles involved in the transportation system may include bicycles such as shared bicycles, taxis, private cars, ride-sharing, buses, trains, bullet trains, high-speed railways, subways, ships, airplanes, spacecraft, hot air balloons, unmanned vehicles, etc. or any combination thereof. The transportation system may also include any transportation system for operation and / or distribution, such as a system for sending and / or receiving express delivery. The application scenarios of the system or method of the embodiment of the present invention may include web pages, browser plug-ins, client terminals, customized systems, internal analysis systems, artificial intelligence robots, etc. or any combination of the above examples.
[0028] The terms "mobile terminal" and "client" in the embodiments of the present invention may be used interchangeably, and refer to a mobile terminal used by a user to provide services or facilitate services.
[0029] In one example, for example, the trajectory data of a shared bicycle is used. Each shared bicycle may be equipped with a trajectory positioning device. The positioning technologies that may be used in embodiments of the present invention may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a compass navigation system (COMPASS), a Galileo positioning system, a quasi-zenith satellite system (QZSS), a wireless fidelity (WIFI) positioning technology, or the like or any combination thereof. One or more of the above positioning technologies may be used interchangeably in embodiments of the present invention.
[0030] Generally speaking, shared bikes support devices such as GPS and location-based services, which generate a large number of trajectories based on time. These trajectories are very large in number and contain a lot of information. For example, they include structured time information and spatial information. For example, these spatiotemporal trajectories include other unstructured information. Using structured information and unstructured information or a combination of the two can generate very valuable data. For example, using clustering and classification algorithms, various recommendation services can be performed based on determined similar trajectories. These trajectories can be used to guide people's activities, such as personal navigation services, logistics services, etc. In addition, people's running characteristics can be discovered by analyzing their trajectories to provide support for the company's decision-making.
[0031] One aspect of an embodiment of the present invention relates to an online system and a method for traversing spatial data. Multiple spatial index values associated with a geographic area can be determined. Multiple data groups for storing data associated with a geographic area can be determined. Each data group can be associated with a spatial index value. A priority queue can be determined based on multiple spatial index values and a geographic area. The priority queue may include first buffer range data associated with a first reference index value and a first part of a geographic area. The data group starts with a data group associated with a minimum spatial index value among the multiple spatial index values and traverses the multiple data groups. If it is determined that the spatial index value of the currently traversed data group is equal to or greater than the first reference index value, data related to the first part of the geographic area is sent to the user terminal.
[0032] The embodiment of the present invention adopts Euclidean distance to determine the spatial index value in the geographic area. The processing engine traverses the data set based on the spatial index, but it should be understood that this is only exemplary, and the embodiment of the present invention can adopt any distance calculation method.
[0033] Figure 1 1 is a block diagram of an exemplary trajectory collection network architecture according to some embodiments. For example, the trajectory collection network architecture may be an online traffic service platform for traffic services. The trajectory collection network architecture may include a server 110, a network 120, a mobile terminal 140, a vehicle 150, a storage device 160, and a navigation system 170.
[0034] The trajectory collection network architecture can provide multiple services. In some embodiments, the online-to-offline service can be any online service, such as ordering recommendations, shopping recommendations, etc., or any other combination.
[0035] In some embodiments, the server 110 may be a single server or a server group. The server group may be centralized or distributed (e.g., the server 110 may be a distributed system). In some embodiments, the server 110 may be local or remote. For example, the server 110 may access information and / or data stored in the mobile terminal 140 and / or the storage device 160 via the network 120. For another example, the server 110 may be directly connected to the mobile terminal 140 and / or the storage device 160 to access the stored information and / or data. In some embodiments, the server 110 may be implemented on a cloud platform. Just to give an example, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an intermediate cloud, a multi-cloud, etc., or any combination thereof.
[0036] In some embodiments, the server 110 may include a processing engine 112. The processing engine 112 may process information and / or data related to the service to perform one or more functions in the embodiments of the present invention. For example, the processing engine 112 may traverse spatial data. In some embodiments, the processing engine 112 may include one or more processing engines (e.g., a single-core processor or a multi-core processor). Just to give an example, the processing engine 112 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), an application-specific instruction set processor (ASIC), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic device (PLD), a controller, a microcontroller unit, a reduced instruction set computer (RISC), a microprocessor, etc. or any combination thereof.
[0037] The network 120 can facilitate the exchange of information and / or data. In some embodiments, one or more components in the track collection network architecture (e.g., server 110, mobile terminal 140, vehicle 150, storage device 160, and navigation system 170) can send information and / or data to other components of the track collection network architecture via the network 120. In some embodiments, the network 120 can be any type of wired network, wireless network, or combination thereof. Just to give an example, the network 120 can include a cable network, a wired network, a fiber optic network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a wide area network (WAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network, a near field communication (NFC) network, etc. or any combination of the above examples. In some embodiments, the network 120 can include one or more network access points. For example, the network 120 may include a wired or wireless network access point such as a base station and / or an Internet exchange point 120-1, 120-2... Through the network access point, one or more components of the trajectory collection network architecture can connect to the network 120 to exchange information and or data.
[0038] In some embodiments, the mobile terminal 140 may include a mobile device 130-1, a tablet computer 130-2, a laptop computer 130-3, a vehicle built-in device 130-4, etc., or any combination of the above examples. In some embodiments, the wearable device may include a smart bracelet, smart shoes and socks, smart glasses, smart helmets, smart watches, smart clothing, smart backpacks, smart accessories, etc., or any combination of the above examples. In some embodiments, the smart mobile device may include a smart phone, a personal digital assistant (PDA), a gaming device, a navigation device, a point of sale (POS) device, etc., or any combination thereof. In some embodiments, the virtual reality device and / or the augmented reality device may include a virtual reality helmet, virtual reality glasses, virtual reality goggles, augmented reality helmets, augmented reality glasses, augmented reality goggles, etc., or any combination of the above examples. In some embodiments, the vehicle built-in device 130-4 may include an onboard computer, an onboard TV, etc. In some embodiments, the mobile terminal 140 may be a device having positioning technology for locating the position of passengers or riders.
[0039] The mobile terminal 140 may include a plurality of mobile terminals 140-1, 140-2, ..., 140-n. In some embodiments, the mobile terminal 140 may be customized to enable online-to-offline services. In some embodiments, the mobile terminal 140 may be a device with positioning technology, which may be used to locate the location of the mobile terminal 140 and / or the vehicle 150 associated with the mobile terminal. In some embodiments, the mobile terminal 140 may communicate with another positioning device to determine the location of the passenger, the mobile terminal 140. In some embodiments, the mobile terminal 140 may periodically send the positioning information to the server 110. In some embodiments, the mobile terminal 140 may also periodically send the availability status to the server 110. The availability status may indicate whether the vehicle 150 associated with the mobile terminal 140 can pick up passengers. For example, or the mobile terminal 140 may send the positioning information and the availability status to the server 110 every 30 minutes. For another example, or the mobile terminal 140 may send the positioning information and the availability status to the server 110 each time the user logs in to the mobile application associated with the online-to-offline service.
[0040] In some embodiments, the mobile terminal 140 may correspond to one or more vehicles 150. The vehicle 150 may pick up passengers and send them to a destination. The vehicle 150 may include a plurality of vehicles 150-1, 150-2, ..., 150-n.
[0041] The storage device 160 may store data and / or instructions. In some embodiments, the storage device 160 may store data obtained from the mobile terminal 140. In some embodiments, the storage device 160 may store data and / or instructions used by the server 110 to execute or use to complete the exemplary method described in the embodiments of the present invention. In some embodiments, the storage device 160 may include a large capacity memory, a removable memory, a volatile read-write memory, a read-only memory (ROM), etc. or any combination thereof. Exemplary large capacity memory may include a magnetic disk, an optical disk, a floppy disk, a solid state drive, etc. Exemplary removable memory may include a flash drive, a floppy disk, an optical disk, a memory card, a compressed disk, a magnetic tape, etc. Exemplary volatile read-write memory may include a random access memory (RAM). Exemplary random access memory may include a dynamic random access memory (DRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), a static random access memory (SRAM), a thyristor random access memory (T-RAM), and a zero capacitance memory (Z-RAM), etc. Exemplary read-only memories may include masked read-only memories (MROMs), programmable read-only memories (PROMs), erasable programmable read-only memories (PEROMs), electrically erasable programmable read-only memories (EEPROMs), compact disk read-only memories (CD-ROMs), and digital versatile disk read-only memories, etc. In some embodiments, the storage device 160 may be implemented on a cloud platform. Just to give an example, the cloud platform may include private clouds, public clouds, hybrid clouds, community clouds, distributed clouds, intermediate clouds, multiple clouds, etc., or any combination thereof.
[0042] In some embodiments, the storage device 160 may be connected to the network 120 to communicate with one or more components of the trajectory collection network architecture (e.g., the server 110, the mobile terminal 140, etc.). One or more components of the trajectory collection network architecture may access data or instructions stored in the storage device 160 through the network 120. In some embodiments, the storage device 160 may be directly connected or communicated with one or more components of the trajectory collection network architecture (e.g., the server 110, the mobile terminal 140, etc.). In some embodiments, the storage device 160 may be part of the server 110.
[0043] The navigation system 170 can determine information related to an object, for example, one or more service mobile terminals 140, vehicles 150, etc. In some embodiments, the navigation system 170 can be a global positioning system (GPS), a global navigation satellite system (GLONASS), a compass navigation system (COMPASS), a Beidou navigation satellite system, a Galileo positioning system, a quasi-zenith satellite system (QZSS), etc. The information may include the location, altitude, speed, acceleration, or current time of the object. The navigation system 170 may include one or more satellites, for example, satellite 170-1, satellite 170-2, and satellite 170-3. Satellites 170-1 to 170-3 can determine the above information independently or jointly. The satellite navigation system 170 can send the above information to the network 120, the mobile terminal 140, or the vehicle 150 via a wireless connection.
[0044] In some embodiments, one or more components of the track collection network architecture (e.g., server 110, mobile terminal 140, etc.) may have access to storage device 160. In some embodiments, when one or more conditions are met, one or more components of the track collection network architecture may read and / or modify information related to passengers and / or riders. For example, after a service is completed, server 110 may read and / or modify the information of one or more passengers. For another example, after a service is completed, server 110 may read and / or modify the information of one or more mobile terminal users.
[0045] In some embodiments, the information exchange of one or more components of the trajectory collection network architecture can be realized by requesting a service. The object of the service can be any product. In some embodiments, the product can include food, medicine, goods, chemical products, electrical appliances, clothing, cars, houses, luxury goods, etc., or any combination of the above examples. In some embodiments, the product can include service products, financial products, knowledge products, Internet products, etc., or any combination of the above examples. Internet products can include personal host products, website products, mobile Internet products, commercial host products, embedded products, etc., or any combination of the above examples. Mobile Internet products can be used for software, programs, systems, etc. of mobile terminals, or any combination of the above examples. Mobile terminals can include tablet computers, laptop computers, mobile phones, PDAs, smart watches, point of sale (POS) devices, vehicle computers, vehicle TVs, portable devices, etc., or any combination of the above examples. For example, the product can be any software and / or application for a computer or mobile phone. The software and / or application can be related to social, shopping, transportation, entertainment, learning, investment, etc., or any combination of the above examples. In some embodiments, the traffic-related software and / or application may include travel software and / or application, traffic tool dispatching software and / or application, map software and / or application, etc. In the traffic tool dispatching software and / or application, the traffic tool may include a horse, a carriage, a rickshaw (e.g., a wheelbarrow, a bicycle, a tricycle, etc.), a car (e.g., a taxi, a bus, a private car, etc.), a train, a subway, a ship, an aircraft (e.g., an airplane, a helicopter, a space shuttle, a rocket, a hot air balloon, etc.), or any combination thereof.
[0046] The specific implementation of the embodiment of the present invention is further described below in conjunction with the accompanying drawings of the embodiment of the present invention.
[0047] Figure 2A is a schematic flow chart of an index building method according to another embodiment of the present invention; Figure 2A The index building methods include:
[0048] 210: Construct a first index layer according to the trajectory point data, where each node in the first index layer is used to store the trajectory point data.
[0049] It should be understood that the trajectory point data may be a space-time trajectory point, a space-time trajectory line segment, or a space-time sub-trajectory. Figure 1The trajectory point data collected by the data collection method. The trajectory point data can be various trajectory data, and the embodiment of the present invention does not limit the trajectory point data. For example, the trajectory point data can be data about trajectory segments and data about sub-trajectories. In addition, the sub-trajectory can be trajectory point data or trajectory segments. Optionally, the sub-trajectory can be generated by trajectory point data or by trajectory segments. In addition, the sub-trajectory can also be generated by trajectory segments. In addition, the spatiotemporal sub-trajectory can be the original collected trajectory point or can be obtained by segmenting the trajectory formed by multiple trajectory points. For example, the first index layer adopts a TB (Trajectory Bundle) structure, and the second index layer adopts a 3DR tree structure. For example, the second index layer (for example, the 3DR layer) is a 3DR tree established for the sub-outer frame, and the first index layer (for example, the TB layer) is a page storing actual trajectory points.
[0050] 220: Grouping a plurality of sub-enclosing frames contained in the trajectory enclosing frame corresponding to the trajectory point data, and constructing an index node of a second index layer according to the grouping result.
[0051] It should be understood that the second index layer in the solution of the embodiment of the present invention includes at least one of the following: a leaf node layer, an intermediate node layer, a child node layer, and a root node layer. For example, the second index layer includes a leaf node layer, an intermediate node layer, and a root node layer. For example, multiple leaf nodes in the leaf node layer correspond to the same intermediate node in the intermediate node layer. For example, multiple intermediate nodes in the intermediate node layer correspond to the root node in the root node layer. For example, the root node can be one or more. The embodiment of the present invention is not limited to this.
[0052] 230: Building a link between the first index layer and the second index layer, so as to establish an association relationship between the sub-boundary boxes corresponding to each index node of the second index layer and the track point data in each node in the first index layer through the link.
[0053] For example, the association relationship may point to a location where the corresponding actual trajectory point is stored in the first index layer.
[0054] For the second index layer, the internal nodes may be similar to the nodes in the R-tree, or may be different from the nodes in the R-tree. For example, in the index structure of the embodiment of the present invention, in each leaf node, in addition to the sub-enclosure frame, the above-mentioned association relationship may also be stored. It should be understood that other links may also be stored in the leaf node. In addition, the other links may also point to the leaf nodes of the previous and next sub-enclosure frames storing the same track in the second index layer.
[0055] 240: Construct an index structure for trajectory search according to the first index layer, the second index layer and the association relationship.
[0056] Since the first index layer stores trajectory point data and the second index layer stores corresponding bounding boxes and sub-bounding boxes, the constructed index structure can effectively process trajectory similarity queries.
[0057] In addition, in the index structure of the embodiment of the present invention, by using as much information in the sub-box as possible, I / O (input / output) resources are fully utilized, and as many sub-boxes as possible are retrieved from the index to ensure that the precise point of the trajectory is retrieved.
[0058] In addition, the first index layer is used to retrieve trajectory points within a given time period. The solution of the embodiment of the present invention links shorter sub-trajectories together to form longer sub-trajectories that can be stored in a memory page, for example, in the same memory page.
[0059] It should also be understood that the allocation of leaf nodes in the first index layer and the nodes in the second index layer can be the same or different. In other words, the link from the second index layer to the first index layer can be a many-to-many mapping. In other words, the packing strategy (i.e., which sub-trajectories should be stored together) or (envelope strategy) can be the same or different in the first index layer and the second index layer.
[0060] It should also be understood that the first index layer of the embodiment of the present invention stores trajectory points (or, trajectory segments; or, sub-trajectories). Compared with the index layer that stores the outer bounding box of each segment, it is easier to update the trajectory points. In other words, the segmentation and grouping methods of the first index layer and the second index layer can be different. In addition, the precise points of the trajectory (or, trajectory segments; or, sub-trajectories; or, trajectory points) are not stored in the second index layer, and multiple second index layers can be built on the same first index layer to support different types of queries. In this way, the index pruning performance and trajectory extraction overhead can be optimized at the same time.
[0061] In another implementation of the present invention, the above-mentioned index structure can be updated. For example, the first index layer can be constructed or updated. In addition, the second index layer can be modified (or updated) according to the changes (or changes; or the results of the update) of the first index layer. Since the first index layer and the second index layer are constructed relatively independently, and there is a mapping relationship between the first index layer and the second index layer, the update operation of the first index layer is relatively simple and convenient. For example, in the first index layer, accurate trajectory points can be stored, and when updating, the trajectory points can be updated. For example, its sub-outer frame (and outer frame) can be provided to the second index layer. Thus, the spatiotemporal outer frame (or sub-outer frame) on the second index layer can be loaded and updated.
[0062] In another implementation of the present invention, the multiple sub-enclosure frames contained in the trajectory outer frame corresponding to the trajectory point data are grouped, and the trajectory outer frame can be grouped evenly or in other ways. For example, the grouping can be based on the time dimension. For example, the grouping can be based on the space dimension. For example, the trajectory outer frame is evenly divided in time. For example, the feature points in multiple trajectories in the trajectory outer frame are determined, and the trajectory outer frame is divided based on the feature points. It should be understood that the feature points are points with rich information in the trajectory. For example, the feature points are points with high nonlinearity in the trajectory, and the non-feature points are points with low nonlinearity in the trajectory. For example, the feature points are points with high disorder in the trajectory, and the non-feature points are points with low disorder in the trajectory. For example, the trajectory is divided based on the above-mentioned feature points, so that the trajectory segments after the division have high order and high linearity. It should be understood that the segmentation of the trajectory outer frame based on the feature points makes the recommendation degree of the trajectory information after the similarity query more accurate and has a higher recommendation value. For example, the trajectory may be initially segmented based on the feature points, and then the trajectory segments obtained after the initial segmentation may be segmented. For example, the trajectory segments may be segmented evenly. It should also be understood that the feature points mentioned above may be time feature points or space feature points.
[0063] It should also be understood that the grouping of the trajectory outer frame as the outer frame of the sub-envelope frame can be based on the geometric parameters of the sub-envelope frame, or can be based on the trajectory parameters in the sub-envelope frame. For example, the grouping can be based on the center of the sub-envelope frame. For example, the grouping can be based on the centroid parameter of the trajectory in the sub-envelope frame. For example, the search space is divided into multiple space-time regions based on the centroid parameter threshold. For example, the sub-envelope frame whose centroid parameter is in a specific space-time region is grouped. For example, the grouping of the sub-envelope frame can also be based on the above-mentioned conditions and other constraints.
[0064] As an example, grouping multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data includes: grouping the multiple sub-enclosure frames according to the centroids of the multiple sub-enclosure frames to obtain grouping results of the multiple sub-enclosure frames.
[0065] As an example, constructing the index nodes of the second index layer according to the grouping results includes: constructing the index nodes of the second index layer according to the grouping results and the time lengths of the leaf nodes of the second index layer.
[0066] As an example, before constructing the index node of the second index layer, the method also includes: determining the time length that minimizes the total volume of the leaf node based on the relationship between the time length of the leaf node and the total volume of the leaf node, and using the time length that minimizes the total volume of the leaf node as the time length for constructing the index node of the second index layer.
[0067] For example, when the second index layer is constructed by loading the spatiotemporal outer frame (or, sub-outer frame), the sub-outer frame is grouped according to the centroid of the sub-outer frame to construct the leaf node. For example, when constructing the index structure tree, the relationship between the time length of the leaf node layer in the second index layer and the total size of the outer frame of the leaf node is pre-calculated. For example, based on the above relationship, the leaf time length that minimizes the total volume of the leaf node is obtained, and the construction is performed with this length. For spatiotemporal trajectory data, when the spatial range generally remains unchanged over time and the time period is long and growing, the second index layer is constructed in the above manner, for example, the leaf node layer in the second index layer is constructed, so that the indexing efficiency is improved as a whole.
[0068] In another implementation of the present invention, multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data are grouped, and index nodes of the second index layer are constructed according to the grouping results, including at least one of the following: establishing a link between the leaf node layer and the intermediate node layer in the second index layer; establishing a link between the sub-enclosure frame in the leaf node and the leaf node, that is, establishing a link between the identifier of the leaf node and the identifier of the sub-trajectory in the sub-enclosure frame; establishing a link between the leaf node layer and the intermediate node layer; establishing a link between the sub-enclosure frame and the intermediate node in the intermediate node layer; establishing a link between the sub-enclosure frame belonging to the same leaf node in the leaf node layer and another sub-enclosure frame; establishing a link between the sub-enclosure frame belonging to the same leaf node and the same trajectory and another sub-enclosure frame; establishing a link between the intermediate node where the sub-enclosure frame belonging to the same trajectory is located and the intermediate node where another sub-enclosure frame is located, for example, the adjacent sub-trajectory between the sub-trajectory in the other sub-enclosure frame and the sub-trajectory in the sub-enclosure frame. For example, sub-enclosure frames belonging to the same trajectory are stored between different intermediate nodes. Since multi-layer indexing is used in the second index layer to establish links between different sub-enclosure frames, the indexing efficiency is greatly improved.
[0069] As an example, multiple sub-enclosure frames included in the trajectory outer box corresponding to the trajectory point data are grouped, and index nodes of the second index layer are constructed according to the grouping results, including: grouping multiple sub-enclosure frames included in the trajectory outer box corresponding to the trajectory point data, and constructing index nodes of the second index layer according to the grouping results; and setting for each leaf node in the index node: links between nodes of the first index layer where the trajectory point data corresponding to the sub-enclosure frame of the current leaf node is located, and links to leaf nodes where other sub-enclosure frames in the total outer box to which the sub-enclosure frame of the current leaf node belongs are located.
[0070] In another implementation of the present invention, different orders may be used to establish at least one of the above-mentioned links in the second index layer. For example, a direct link between the sub-enclosure frame and the leaf node may be established first, and then a link between the sub-enclosure frame and the intermediate node may be established. For example, a direct link between the sub-enclosure frame and the leaf node may be established first, and then a link between the sub-enclosure frame of the sub-track belonging to the same track and another sub-enclosure frame of the adjacent sub-track adjacent to the sub-track may be established. For example, a direct link between the sub-enclosure frame and the leaf node may be established, and then a link between the leaf node enclosure frame (i.e., the enclosure frame) of the sub-track belonging to the same track and the leaf node enclosure frame (which may be the same leaf node or different leaf nodes) of the adjacent sub-track adjacent to the sub-track may be established.
[0071] For example, a direct link between a sub-enclosing frame and a leaf node may be established, and then a link may be established between an intermediate node enclosing frame of a sub-trace belonging to the same trajectory and an intermediate node enclosing frame of an adjacent sub-trace adjacent to the sub-trace (which may be the same intermediate node or different intermediate nodes).
[0072] For example, a link may be established between the total outer bounding box of a sub-track belonging to the same track and the total outer bounding box of an adjacent sub-track adjacent to the sub-track (which may be the same total outer bounding box or different total outer bounding boxes). For example, the total outer bounding box may be an intermediate node outer bounding box of an intermediate node layer. It may also be a leaf node outer bounding box of a leaf node layer. It should be understood that the construction process of the various links described above may be implemented by a traversal algorithm, or by an update algorithm, or may be implemented for a specific index layer or a sub-layer in an index layer (e.g., a leaf node layer or an intermediate node layer).
[0073] As an example, the link between the leaf nodes where other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs is set in the following manner: a first round of traversal is performed on the leaf nodes in the second index layer to record the mapping between the sub-outer-boxes in each leaf node in the second index layer and the serial numbers of the leaf nodes; a second round of traversal is performed on the leaf nodes in the second index layer to determine the other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs; and based on the mapping and the determined other sub-outer-boxes, a link is set between the current leaf node and the leaf nodes where the other sub-outer-boxes are located.
[0074] As an example, the link with the leaf nodes where other sub-enclosure frames in the total enclosure frame to which the sub-enclosure frame of the current leaf node belongs includes: the link with the leaf nodes where the sub-enclosure frames of the adjacent sub-trajectories of the trajectory to which the sub-enclosure frame of the target sub-trajectory of the current leaf node belongs.
[0075] Since direct links are established between different sub-trajectories belonging to the same trajectory, the continuous part of the trajectory can be effectively retrieved, thereby further reducing the impact on the calculation of distances when retrieving neighboring objects. In addition, the link is located between the leaf nodes from the sub-enclosing box to other sub-enclosing boxes containing the same trajectory, so it is more conducive to improving indexing efficiency than between nodes storing points of the same trajectory.
[0076] As an example, an index structure for trajectory search is constructed based on the first index layer, the second index layer and the association relationship, including: constructing an index structure for trajectory search based on the TB structure tree, the 3DR structure and the association relationship between the sub-outer boxes corresponding to each index node of the 3DR structure and the trajectory point data in each node in the TB structure.
[0077] Figure 2B Schematic diagram of an index construction method according to another embodiment of the present invention. As shown in the figure, the target track is divided into sub-track t1, sub-track t2 and sub-track t3. Among them, sub-track t1, sub-track t2 and sub-track t3 have sub-enclosing frame b1, sub-enclosing frame b2 and sub-enclosing frame b3 respectively. It should be understood that the track in the figure is only an example, and the segmentation method of the track in the figure is also exemplary, that is, the track can have other segmentation points and segmentation numbers, etc. It should also be understood that the shape and number of the above-mentioned sub-enclosing frames can also be different. For example, each sub-enclosing frame can be a sub-enclosing frame for each sub-track after segmentation. For example, each sub-enclosing frame can be a sub-enclosing frame of a sub-track composed of multiple (for example, at least two) sub-tracks after segmentation. In other words, the sub-track after segmentation can be a sub-track corresponding to the sub-enclosing frame, or it can not correspond to the sub-track of the sub-enclosing frame. In other words, the sub-track corresponding to the sub-enclosing frame can be a sub-track after segmentation, or it can include multiple sub-tracks after segmentation. For example, the sub-enclosure frame shown in the figure is the projection of the sub-enclosure frame on the paper, and it should be understood that the projection shape of the sub-enclosure frame can be a rectangle, or a polygon, a circle, an ellipse, etc. For example, the shape of the sub-enclosure frame can be a parallelepiped, or a polyhedron, a column such as a cylinder, a prism, a cone, etc.
[0078] Figure 2CSchematic diagram of an index construction method of another embodiment of the present invention. As shown in the figure, different sub-trajectories are stored in the first index layer, in other words, the first index layer is constructed for different multiple sub-trajectories. In addition, different sub-enclosure frames are stored in the second index layer, in other words, the second index layer is constructed for different multiple sub-enclosure frames. In the first index layer, sub-trajectory t1 is located in one node, and sub-trajectories t2 and t3 are located in another node. In the second index layer, sub-enclosure frame b1, sub-enclosure frame b2 and sub-enclosure frame b3 are respectively located in three nodes. It should be understood that the above allocation method is only exemplary. For example, sub-enclosure frame b1, sub-enclosure frame b2 and sub-enclosure frame b3 can also be stored in two nodes or in one node. In addition, when the above three sub-trajectories are arranged through two nodes, sub-trajectory t1 and sub-trajectory t2 can also be located in one node, and sub-trajectory t3 is stored in another node. In addition, the above three nodes can also be arranged in one node or in three nodes, and the embodiment of the present invention is not limited to this.
[0079] As shown in the figure, in this example, the mapping relationship between different nodes in the first index layer and the second index layer is that the node storing the sub-trajectory t1 corresponds to the sub-enclosing frame b1, and the nodes storing the sub-trajectory t2 and the sub-trajectory t3 correspond to the nodes of the sub-enclosing frame b1 and the nodes of the sub-enclosing frame b3. It should be understood that in other examples, the nodes of each sub-trajectory and the nodes of each sub-enclosing frame can have a one-to-one, one-to-many, many-to-one, or many-to-many mapping relationship.
[0080] Figure 2D Schematic diagram of an index construction method according to another embodiment of the present invention. As shown in the figure, in addition to the mapping between the nodes of the first index layer and the nodes of the second index layer (for example, in addition to Figure 2CIn addition to the example shown), the second index layer may also include multiple sub-layers. For example, in addition to the sub-outer frame layer, the second index layer may also include a leaf node layer, and the leaf nodes in the leaf node layer have a mapping relationship with the nodes in the sub-outer frame layer. For example, the above mapping relationship may be based on the relationship between the sub-outer frame nodes, for example, the above mapping relationship may be based on the relationship between the sub-outer frames. As shown in the figure, in this example, sub-track t1, sub-track t2 and sub-track t3 are three consecutive sub-tracks. Correspondingly, sub-outer frame b1 is three consecutive sub-outer frames. For example, sub-outer frame b1 itself belongs to leaf node 1. For example, sub-outer frame b2 after sub-outer frame b1 also belongs to leaf node 1, and a link between sub-outer frame b1 and leaf node 1 is established. In addition, for sub-outer-box b2, the outer-boxes before and after it are sub-outer-box b1 and sub-outer-box b3, and sub-outer-box b1 and sub-outer-box b3 belong to leaf node 1 and leaf node 3 respectively, so for sub-outer-box b2, links to leaf node 1 and leaf node 2 are established. In addition, for sub-outer-box b3, the sub-outer-box before it is sub-outer-box b2, so a mapping relationship is established between leaf node 1 to which sub-outer-box b2 belongs and sub-outer-box b3.
[0081] It should be understood that in this example, the target track with three sub-tracks is used for illustration. However, in other examples, the target track may have more than three sub-tracks or less than three sub-tracks. For the example in which the target track includes a plurality of three sub-tracks, a sub-enclosure frame may be provided before the unillustrated sub-enclosure frame b1. Alternatively, a sub-enclosure frame may be provided after the unillustrated sub-enclosure frame b3. In addition, the leaf node layer may further include other leaf nodes. Accordingly, other mapping relationships may also be provided between these unillustrated sub-enclosure frames and the illustrated leaf nodes or between the illustrated sub-enclosure frames and the unillustrated leaf nodes.
[0082] Figure 2E Schematic diagram of an index construction method of another embodiment of the present invention. As shown in the figure, the second index layer can also be an intermediate node layer. It should be understood that in this example, only one intermediate node is shown, however, it should be understood that in other examples, the intermediate node layer can also include multiple intermediate nodes. In addition, in this example, leaf node 1 and leaf node 2 are located at the intermediate node, in other words, leaf node 1 and leaf node 2 are associated with the intermediate node, or stored in the intermediate node. The intermediate node can correspond to the storage of the trajectory, or it can correspond to the storage of the sub-trajectory. For example, the above-mentioned trajectory and sub-trajectory can be used as the target for query. It should be understood that in some other examples, the intermediate node can establish a link with the sub-outer frame, thereby realizing a longer trajectory index. Alternatively, the intermediate node can establish a link with the sub-outer frame, which is more conducive to pruning during indexing, so as to perform a more accurate trajectory query.
[0083] Figure 3A The figure is a schematic flow chart of a trajectory query method according to another embodiment of the present invention. Figure 3A The trajectory query methods include:
[0084] 310: Receive a similar trajectory query request, where the similar trajectory query request is used to request a query for trajectories that are similar to the trajectory to be queried.
[0085] For example, the similar trajectory query request includes information about the trajectory to be queried. For example, the similar trajectory query request may be a sub-query request generated according to the front-end recommendation request.
[0086] 320: Determine the index structure of the corresponding trajectory data according to the similar trajectory query request.
[0087] 330: For the index nodes in the second index layer of the index structure, determine the distance relationship between the sub-boundary box in each node and the trajectory to be queried in sequence according to the hierarchical relationship.
[0088] 340: Determine, according to the distance relationship, a node corresponding to the sub-enclosing frame that is closest to the trajectory to be queried, and obtain, according to the determined node, a trajectory similar to the trajectory to be queried.
[0089] It should be understood that a trajectory similar to the trajectory to be queried may be returned. For example, at least one similar trajectory is returned. For example, the at least one similar trajectory may be recommended to a user. For example, at least one similar trajectory is a trajectory of a first user. The trajectory to be queried is a trajectory of a second user. For example, at least one similar trajectory may be a trajectory of a first time period of a target user. The trajectory to be queried may be a trajectory of a second time period of a target user. For example, at least one similar trajectory may be a trajectory of a target user in a first spatial range. The trajectory to be queried may be a trajectory of a second spatial range of a target user.
[0090] In the index constructed by the method of the embodiment of the present invention, since the first index layer stores the trajectory point data and the second index layer stores the corresponding outer bounding box and the sub-outer bounding box, the constructed index structure can effectively process the similarity query of the trajectory. In the query processing of the embodiment of the present invention, when reading the precise point of the trajectory, it is possible to load (for example) a continuous part of a trajectory. For example, when the sub-trajectory is relatively short, many continuous parts can be loaded through a single I / O.
[0091] In another implementation of the present invention, the distance relationship between the sub-enclosed frame in each node and the trajectory to be queried may be determined in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure. For example, the trajectory to be queried may also be preprocessed. For example, the distance relationship between the sub-enclosed frame in each node and the preprocessed trajectory to be queried may also be determined in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure. For example, the trajectory to be queried may be preprocessed to simplify it. For example, a plurality of trajectory points in the set of trajectory points to be queried within the spatiotemporal range of the trajectory to be queried may be simplified. For example, some of the trajectory points in the plurality of trajectory points may be deleted or extracted to obtain a simplified trajectory point set. For example, the distance relationship between the sub-enclosed frame in each node and the preprocessed simplified trajectory point set may be determined in sequence according to the hierarchical relationship.
[0092] As an example, for the index nodes in the second index layer of the index structure, before determining in sequence according to the hierarchical relationship the distance relationship between the sub-enclosing box in each node and the trajectory to be queried, the method also includes: simplifying the trajectory to be queried to obtain a simplified trajectory of the trajectory to be queried; for the index nodes in the second index layer of the index structure, determining in sequence according to the hierarchical relationship the distance relationship between the sub-enclosing box in each node and the trajectory to be queried, including: for the index nodes in the second index layer of the index structure, determining in sequence according to the hierarchical relationship the distance relationship between the sub-enclosing box in each node and the simplified trajectory.
[0093] It should be understood that in the branch reduction process of trajectory query (e.g., KNN query), the distance between the trajectory to be queried and each outer bounding box loaded can be calculated. In the case where the computational overhead is proportional to the number of queried sub-trajectories, for example, in the case where the computational overhead increases linearly with the increase of the query length, the preprocessing method of the embodiment of the present invention described above can save the computational overhead.
[0094] For example, for kNN queries or other distance-related queries, if the distance used satisfies the triangle inequality for the relevant tracks, then for the query track Q and any track Q' and track T defined in the time period of track Q. If the distance between Q' and T is the first distance; the distance between Q and Q' is the second distance; the distance between Q and T is the third distance, then the first distance - the second distance ≤ the third distance ≤ the first distance + the second distance.
[0095] For the preprocessing method of the embodiment of the present invention, if the number of line segments of Q' is less than that of the track Q, and the second distance is smaller than the third distance of the track T in the query. Therefore, we can use the track Q' to replace the track Q in the filtering calculation process to save the calculation cost. Therefore, the first distance - the second distance = the third distance represents a simplified distance, which realizes the reuse of the intermediate data, so that the calculation cost can be greatly saved while ensuring the calculation accuracy.
[0096] As an example, simplifying the trajectory to be queried includes: determining a first trajectory point on the trajectory to be queried that has the largest distance to a line connecting a start point and an end point of the trajectory to be queried;
[0097] Determine the second trajectory point on the trajectory to be queried that has the largest distance to the line connecting the starting point of the trajectory to be queried and the first trajectory point, and the third trajectory point on the trajectory to be queried that has the largest distance to the line connecting the ending point of the trajectory to be queried and the first trajectory point, until n+1 trajectory points are determined on the trajectory to be queried, where n represents the number of line segments in the simplified trajectory; sequentially connect the starting point of the trajectory to be queried, the determined n+1 trajectory points, and the ending point of the trajectory to be queried to generate a simplified trajectory of the trajectory to be queried.
[0098] In this example, specifically, when simplifying the trajectory Q to the trajectory Q', for example, when calculating the distance from point P to line L, the Euclidean distance between P and the points in line L is calculated instead of the perpendicular distance. For example, each time a new point is selected, the point with the largest distance from the existing line segment among the unselected points is selected instead of recursively selecting each line segment. For example, instead of setting a threshold on the maximum distance, it will stop after selecting n+1 points, where n is the number of line segments we want in the simplified trajectory. For example, the time length of the trajectory Q is divided by the average time length of the sub-trajectories in the index to determine the number of line segments of the trajectory Q'.
[0099] In another implementation of the present invention, at least one priority queue may be established for a sub-outsourcing frame, a leaf node, and an intermediate node. For example, priority queues may be established for a sub-outsourcing frame, a leaf node, and an intermediate node, respectively. For example, a priority queue may be set for a sub-outsourcing frame and a leaf node, and another priority queue may be set for an intermediate node. For example, a first priority queue may be set for a sub-outsourcing frame, and a second priority queue may be set for a leaf node and an intermediate node. For example, the results of the two priority queues may be used to determine the distance relationship with the trajectory to be queried. For example, the sorting result of the first priority queue is used to determine the sorting result of the second priority queue.
[0100] For example, a second priority queue for leaf nodes and intermediate nodes is loaded, for example, for trajectory queries (e.g., kNN queries), which can be based on the above two priority queues to support priority queue-based distance lower bounds. The inputs in the two priority queues can contain three parts: the identifier of the corresponding trajectory or node, the calculated distance lower bound, and the state of the node or trajectory. For the state attribute, state 0 represents an internal node, state 1 represents a leaf node, state 2 represents an incomplete outer bound, state 3 represents a complete outer bound, and state 4 represents an accurate trajectory. The state "incomplete" means that there are unloaded sub-outer bounds of the trajectory, and the time interval of the sub-outer bound intersects the time range of the query. These inputs will be sorted according to their distance lower bounds, so the input with a smaller distance lower bound will be loaded earlier. If the distance lower bounds of two inputs are the same, the input with a larger state will be popped out earlier. For example, when processing two queues, the smaller one at the top of the two queues is regarded as the top of the two queues, and when inserting, the input will be inserted according to its type. The inputs to states 0 and 1 will be stored in the node queue, while the inputs to states 2, 3, and 4 will be stored in the trajectory queue.
[0101] As an example, for the index nodes in the second index layer of the index structure, the distance relationship between the sub-enclosed box in each node and the trajectory to be queried is determined in turn according to the hierarchical relationship, including: for the index nodes in the second index layer of the index structure, the distance relationship between the sub-enclosed box in each node and the trajectory to be queried is determined in turn according to the hierarchical relationship, and according to the distance relationship, the node corresponding to the sub-enclosed box is added to the priority queue.
[0102] As an example, the priority queue includes a priority queue for index nodes in a second index level of the index structure.
[0103] As an example, the node information of a node in a priority queue includes at least one of the following information: an identifier of an intermediate node or a leaf node, a distance relationship between the trajectory to be queried and the intermediate node or the leaf node, a state attribute of the intermediate node or the leaf node, an identifier of the trajectory, a distance relationship between the trajectory to be queried and the trajectory, and a state attribute of the trajectory.
[0104] As an example, the nodes in the priority queue include at least one of the following: the root node of the index layer of the index structure tree, the intermediate node of the index layer of the index structure tree, the leaf node of the index layer of the index structure tree, the node where the trajectory data of all outer frames have not been read, the node where the trajectory data of all outer frames have been read, and the node where the trajectory data composed of real trajectory points is located.
[0105] Figure 3BFIG. 1 is a schematic diagram of a trajectory query method according to another embodiment of the present invention. As shown in the figure, a KNN search process is shown as an example. It should be understood that the above KNN search process is only exemplary. For example, Figure 3B The embodiment comprises the steps of:
[0106] S401: Add the root node to the priority queue.
[0107] S402: Find the priority queue entry closest to the query.
[0108] S403: If it is an intermediate node, its child nodes are queued.
[0109] S404: If it is a leaf node, remove the outer bounding box stored in it and distribute it to each track, and then recalculate the lower bounds of each track involved.
[0110] S405: If it is a trajectory and its bounding box is incomplete, read out the leaf node that stores its next bounding box related to the query, and then follow the same process as reading the leaf node on the left.
[0111] S406: If it is a trajectory and its bounding box is complete, then take out its specific trajectory points and enter them into the queue.
[0112] S407: If it is a trajectory, and its specific trajectory point has been taken out, it is the nearest neighbor and is taken out as the result.
[0113] S408: Have K nearest neighbors been found?
[0114] S409: End.
[0115] First, the leaf node function loads all outer bounds from the leaf nodes and assigns them to the corresponding trajectory if the time segment of the outer bound intersects with the query time segment. This process creates new entries in the priority queue for the newly encountered trajectory. Second, with the help of query simplification, it recalculates the distance lower bound for the trajectory that receives the new outer bound. Then, the relevant priority queue entry will update its distance lower bound accordingly and update its state to state 2 or state 3, depending on whether the corresponding trajectory has other child outer bounds that are not loaded.
[0116] In other words, each time the nearest input is popped out from the priority queue and queried, if it is an intermediate node or a leaf node, read this node and add all its child nodes to the queue. If it is the outer bounding box of the trajectory, read the leaf node of the outer bounding box containing the rest of the trajectory. If it is a specific trajectory, output it as the result of the KNN query.
[0117] During the query process, different sub-frames of a single trajectory may be loaded at different times. For example, the lower limit of the distance from the query may be updated based on them. For example, for a trajectory that has loaded some sub-frames, it may be necessary to maintain the loaded sub-frames, the unloaded sub-frames whose leaf nodes contain the trajectory, and the storage location of the sub-trajectory. In addition, the distance that has been calculated by precise calculation or by the lower limit based on the maximum speed may be recorded to avoid repeated calculations.
[0118] As an example, based on the determined node, a trajectory similar to the trajectory to be queried is obtained, including: if the determined node is an intermediate node in the second index layer, the child nodes of the intermediate node are queued; if the determined node is a leaf node in the second index layer, the outer box stored in the leaf node is taken out and assigned to the corresponding trajectory, and the lower bound of the corresponding trajectory involved is recalculated.
[0119] As an example, the method also includes: if the determined node is the node where the trajectory data is located in the second index layer, and the outer bounding box of the trajectory is incomplete, then reading out the leaf node of the outer bounding box that stores the next trajectory related to the trajectory to be queried; if the determined node is a leaf node in the second index layer, then taking out the outer bounding box stored in the leaf node and distributing it to each trajectory, and recalculating the lower bound of each trajectory involved.
[0120] As an example, the method also includes: if the determined node is the node where the trajectory data in the second index layer is located, and the outer bounding box of the trajectory is complete, then the trajectory points of the trajectory are taken out and entered into the queue; if the determined node is the node where the trajectory data in the second index layer is located, and the trajectory points of the trajectory have been taken out, then the trajectory is the nearest neighbor of the trajectory to be queried.
[0121] Figure 4A It is a schematic diagram of a trajectory query method according to another embodiment of the present invention. As shown in the figure, the trajectory is first divided according to certain rules, T1 is divided into four segments, and four outer boxes B1, B2, B3, B4 are corresponding. Similarly, T2 is divided into three segments, and three outer boxes B5, B6, B7 are corresponding. In other words, the trajectory T1 and T2 are divided into four sub-trajectories and three sub-trajectories respectively. For example, each sub-trajectory of trajectory T1 has a sub-outer box B1, a sub-outer box B2, a sub-outer box B3 and a sub-outer box B4. Each sub-trajectory of trajectory T2 has a sub-outer box B5, a sub-outer box B6 and a sub-outer box B7. The following will be combined with Figure 4B right Figure 4A The index of the segmented sub-track is described.
[0122] Figure 4B This is a schematic diagram of a trajectory query method according to another embodiment of the present invention. As shown in the figure, assuming Figure 4ATrajectory T1 and trajectory T2 are two trajectories moving in one-dimensional space (the vertical axis is time). When constructing the index structure of an embodiment of the present invention, for example, when constructing the first index layer, the sub-trajectories of each segment are recombined, assuming that the sub-trajectories in B1 and B2 can be stored in one memory page, recorded as T1_1. The trajectory points in B3 and B4 are stored in another memory page T1_2, and the trajectory points of T2 are stored in the memory page T2_1. For example, when constructing the second index layer, the construction process can be the same as that of an ordinary R-tree, assuming that the final result is as shown in the figure above. It should be understood that although the outer boxes of each node are not drawn in the text, these outer boxes can be obtained through the contained sub-outer boxes. It should also be understood that the front and back connections between the sub-outer boxes are not drawn in the text.
[0123] In addition, when performing a KNN search, assuming that the query is the trajectory closest to trajectory Q, the root node N1 is first added to the queue, then N1 is taken out and N2 and N3 are added. If the outer boxes of N2 and N3 intersect with Q, they are opened in turn and the child nodes are queued. Then, if the outer boxes of N4, N5, N6, N7, and N4 intersect with Q, B1 and B5 are read out. After that, B5 is closest to Q, but its time range does not cover the time range of Q (that is, the outer box is incomplete), so the next child outer box B6 of B5 is searched and found to be at the N6 node, so it is read out. After obtaining B5 and B6, if Q is far away from the trajectory composed of these two outer boxes at this time, the node N5 closest to the query in the queue is continued to be read out to obtain the outer boxes B2 and B3. If it is found that the track contained in B2 and B3 is closer to Q than other unread outer frames, then the specific sub-track points of B2 and B3 are searched, and it is found that B2 and B3 are stored in T1_1 and T1_2. Therefore, after reading these two pages, the specific track points of T1 can be obtained. If it is found that this track is still at the front of the queue, in other words, if this track is closest to the query, the query result is T1.
[0124] It should be understood that the above-mentioned KNN search process is merely exemplary, and the embodiments of the present invention are not only used for KNN search (KNN retrieval or KNN query) or ANN (approximate nearest neighbor) retrieval, but can also be used for other retrieval processes.
[0125] Figure 5 A schematic block diagram of an index building device according to another embodiment of the present invention; Figure 5 The index building device includes:
[0126] The first construction module 510 is used to construct a first index layer according to the trajectory point data, and each node in the first index layer is used to store the trajectory point data.
[0127] The second construction module 520 is used to group the multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and construct the index nodes of the second index layer according to the grouping result.
[0128] The third construction module 530 is used to construct a link between the first index layer and the second index layer, so as to establish an association relationship between the sub-boundary boxes corresponding to each index node in the second index layer and the track point data in each node in the first index layer through the link.
[0129] The fourth construction module 540 is used to construct an index structure for trajectory search according to the first index layer, the second index layer and the association relationship.
[0130] Since the first index layer stores trajectory point data and the second index layer stores corresponding bounding boxes and sub-bounding boxes, the constructed index structure can effectively process trajectory similarity queries.
[0131] In another implementation of the present invention, the second constructing module is specifically used to: group the multiple sub-enclosed frames according to the centroids of the multiple sub-enclosed frames to obtain the grouping result of the multiple sub-enclosed frames.
[0132] In another implementation of the present invention, the second construction module is specifically used to: construct the index nodes of the second index layer according to the grouping result and the time length of the leaf nodes of the second index layer.
[0133] In another implementation of the present invention, before constructing the index nodes of the second index layer, the device also includes a determination module, which is used to determine the time length that minimizes the total volume of the leaf nodes based on the relationship between the time length of the leaf nodes and the total volume of the leaf nodes, and use the time length that minimizes the total volume of the leaf nodes as the time length for constructing the index nodes of the second index layer.
[0134] In another implementation of the present invention, the second construction module is specifically used to: group the multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and construct the index node of the second index layer according to the grouping result; and set for each leaf node in the index node: the link between the nodes of the first index layer where the trajectory point data corresponding to the sub-enclosure frame of the current leaf node is located, and the link with the leaf nodes where other sub-enclosure frames in the total enclosure frame to which the sub-enclosure frame of the current leaf node belongs.
[0135] In another implementation of the present invention, the link with the leaf node where other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs is set in the following manner: a first round of traversal is performed on the leaf nodes in the second index layer to record the mapping between the sub-outer-boxes in each leaf node in the second index layer and the serial numbers of the leaf nodes; a second round of traversal is performed on the leaf nodes in the second index layer to determine the other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs; and based on the mapping and the determined other sub-outer-boxes, a link is set between the current leaf node and the leaf node where the other sub-outer-boxes are located.
[0136] In another implementation of the present invention, the link with the leaf node where other sub-enclosure frames in the total enclosure frame to which the sub-enclosure frame of the current leaf node belongs includes: the link with the leaf node where the sub-enclosure frame of the adjacent sub-trajectory of the trajectory to which the sub-enclosure frame of the target sub-trajectory of the current leaf node belongs.
[0137] In another implementation of the present invention, the first index layer adopts a TB structure, and the second index layer adopts a 3DR structure, and the fourth construction module is specifically used to: construct an index structure for trajectory search based on the TB structure tree, the 3DR structure, and the association relationship between the sub-boxes corresponding to each index node of the 3DR structure and the trajectory point data in each node in the TB structure.
[0138] The method of this embodiment can be executed by any appropriate electronic device with data processing capability, including but not limited to: a server, a mobile terminal (such as a mobile phone, a PAD, etc.) and a PC, etc.
[0139] The device of this embodiment is used to implement the corresponding methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0140] Figure 6 It is a schematic block diagram of a trajectory query device according to another embodiment of the present invention. Figure 6 The trajectory query device includes:
[0141] The receiving module 610 is used to receive a similar trajectory query request, where the similar trajectory query request is used to request to query a trajectory similar to the trajectory to be queried.
[0142] The first determination module 620 is configured to determine an index structure of corresponding trajectory data according to a similar trajectory query request.
[0143] The second determination module 630 is used to determine the distance relationship between the sub-boundary box in each node and the trajectory to be queried in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure.
[0144] The third determination module 640 is used to determine the node corresponding to the sub-enclosing frame closest to the to-be-queried trajectory according to the distance relationship, and obtain a trajectory similar to the to-be-queried trajectory according to the determined node.
[0145] In another implementation of the present invention, before determining the distance relationship between the sub-enclosing box in each node and the trajectory to be queried in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure, the device also includes: a simplification module, which simplifies the trajectory to be queried to obtain a simplified trajectory of the trajectory to be queried; the second determination module is specifically used to: determine the distance relationship between the sub-enclosing box in each node and the simplified trajectory in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure.
[0146] In another implementation of the present invention, the simplification module is specifically used to: determine the first trajectory point on the trajectory to be queried that has the largest distance to the line connecting the starting point and the ending point of the trajectory to be queried; determine the second trajectory point on the trajectory to be queried that has the largest distance to the line connecting the starting point of the trajectory to be queried and the first trajectory point, and determine the third trajectory point on the trajectory to be queried that has the largest distance to the line connecting the ending point of the trajectory to be queried and the first trajectory point, until n+1 trajectory points are determined on the trajectory to be queried, where n represents the number of line segments in the simplified trajectory; and sequentially connect the starting point of the trajectory to be queried, the determined n+1 trajectory points, and the ending point of the trajectory to be queried to generate a simplified trajectory of the trajectory to be queried.
[0147] In another implementation of the present invention, the second determination module is specifically used to: for the index nodes in the second index layer of the index structure, determine the distance relationship between the sub-enclosing box in each node and the trajectory to be queried in turn according to the hierarchical relationship, and according to the distance relationship, add the node corresponding to the sub-enclosing box to the priority queue.
[0148] In another implementation of the present invention, the priority queue comprises a priority queue for index nodes in a second index layer of the index structure.
[0149] In another implementation of the present invention, the node information of the node in the priority queue includes at least one of the following information: an identifier of the intermediate node or the leaf node, a distance relationship between the trajectory to be queried and the intermediate node or the leaf node, a state attribute of the intermediate node or the leaf node, an identifier of the trajectory, a distance relationship between the trajectory to be queried and the trajectory, and a state attribute of the trajectory.
[0150] In another implementation of the present invention, the nodes in the priority queue include at least one of the following: the root node of the index layer of the index structure tree, the intermediate node of the index layer of the index structure tree, the leaf node of the index layer of the index structure tree, the node where the trajectory data of all outer frames have not been read, the node where the trajectory data of all outer frames have been read, and the node where the trajectory data composed of real trajectory points are located.
[0151] In another implementation of the present invention, the third determination module is specifically used to: if the determined node is an intermediate node in the second index layer, then the child nodes of the intermediate node are queued; if the determined node is a leaf node in the second index layer, then the outer frame stored in the leaf node is taken out and assigned to the corresponding trajectory, and the lower bound of the corresponding trajectory involved is recalculated.
[0152] In another implementation of the present invention, the device also includes a first processing module, which is used to: if the determined node is the node where the trajectory data is located in the second index layer, and the outer bounding box of the trajectory is incomplete, then read out the leaf node of the outer bounding box that stores the next trajectory and is related to the trajectory to be queried; if the determined node is a leaf node in the second index layer, then take out the outer bounding box stored in the leaf node and distribute it to each trajectory, and recalculate the lower bound of each trajectory involved.
[0153] In another implementation of the present invention, the device also includes a second processing module, which is used to: if the determined node is the node where the trajectory data in the second index layer is located, and the outer bounding box of the trajectory is complete, then the trajectory points of the trajectory are taken out and queued; if the determined node is the node where the trajectory data in the second index layer is located, and the trajectory points of the trajectory have been taken out, then the trajectory is the nearest neighbor of the trajectory to be queried.
[0154] The method of this embodiment can be executed by any appropriate electronic device with data processing capability, including but not limited to: a server, a mobile terminal (such as a mobile phone, a PAD, etc.) and a PC, etc.
[0155] The device of this embodiment is used to implement the corresponding methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0156] Figure 7 This is a schematic diagram of the structure of an electronic device according to another embodiment of the present invention; the electronic device may include:
[0157] One or more processors 701;
[0158] The computer readable medium 702 may be configured to store one or more programs,
[0159] When the one or more programs are executed by the one or more processors, the one or more processors implement the methods described in the above embodiments.
[0160] Figure 8 The hardware structure of the electronic device of another embodiment of the present invention is as follows; Figure 8 As shown, the hardware structure of the electronic device may include: a processor 801, a communication interface 802, a computer readable medium 803 and a communication bus 804;
[0161] The processor 801, the communication interface 802, and the computer readable medium 803 communicate with each other via a communication bus 804;
[0162] Optionally, the communication interface 802 may be an interface of a communication module;
[0163] Among them, the processor 801 can be specifically configured to: construct a first index layer according to the trajectory point data, and each node in the first index layer is used to store the trajectory point data; group multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and construct index nodes of the second index layer according to the grouping result; build a link for the first index layer and the second index layer to establish an association relationship between the sub-enclosure frames corresponding to each index node of the second index layer and the trajectory point data in each node in the first index layer through the link; construct an index structure for trajectory search according to the first index layer, the second index layer and the association relationship, or,
[0164] A similar trajectory query request is received, wherein the similar trajectory query request is used to request a query for a trajectory similar to the trajectory to be queried; according to the similar trajectory query request, an index structure of corresponding trajectory data is determined; for index nodes in a second index layer of the index structure, a distance relationship between a sub-enclosing frame in each node and the trajectory to be queried is determined in sequence according to a hierarchical relationship; according to the distance relationship, a node corresponding to a sub-enclosing frame closest to the trajectory to be queried is determined, and according to the determined node, a trajectory similar to the trajectory to be queried is obtained.
[0165] The processor 801 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It may implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0166] The computer readable medium 803 can be, but is not limited to, a random access memory medium (RAM), a read-only memory medium (ROM), a programmable read-only memory medium (PROM), an erasable read-only memory medium (EPROM), an electrically erasable read-only memory medium (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0167] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code configured to execute the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the above functions defined in the method of the present invention are executed. It should be noted that the computer-readable medium of the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access storage medium (RAM), a read-only storage medium (ROM), an erasable programmable read-only storage medium (EPROM or flash memory), an optical fiber, a portable compact disk read-only storage medium (CD-ROM), an optical storage medium, a magnetic storage medium, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus or a device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program configured to be used by or in combination with an instruction execution system, an apparatus or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0168] Computer program code configured to perform the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0169] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of the code contains one or more executable instructions configured to implement the specified logical function. There are specific sequential relationships in the above-mentioned specific embodiments, but these sequential relationships are only exemplary. When the specific implementation is implemented, these steps may be less, more or the execution order may be adjusted. That is, in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0170] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The names of these modules do not limit the modules themselves in some cases.
[0171] As another aspect, the present invention further provides a computer-readable medium having a computer program stored thereon, which implements the method described in the above embodiment when the program is executed by a processor.
[0172] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the device: constructs a first index layer according to the trajectory point data, and each node in the first index layer is used to store the trajectory point data; groups multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and constructs index nodes of the second index layer according to the grouping results; constructs links for the first index layer and the second index layer to establish an association relationship between the sub-enclosure frames corresponding to each index node of the second index layer and the trajectory point data in each node in the first index layer through the link; constructs an index structure for trajectory search according to the first index layer, the second index layer and the association relationship, or,
[0173] A similar trajectory query request is received, wherein the similar trajectory query request is used to request a query for a trajectory similar to the trajectory to be queried; according to the similar trajectory query request, an index structure of corresponding trajectory data is determined; for index nodes in a second index layer of the index structure, a distance relationship between a sub-enclosing frame in each node and the trajectory to be queried is determined in sequence according to a hierarchical relationship; according to the distance relationship, a node corresponding to a sub-enclosing frame closest to the trajectory to be queried is determined, and according to the determined node, a trajectory similar to the trajectory to be queried is obtained.
[0174] The expressions "first", "second", "the first" or "the second" used in various embodiments of the present disclosure may modify various components regardless of order and / or importance, but these expressions do not limit the corresponding components. The above expressions are only configured for the purpose of distinguishing an element from other elements. For example, a first user device and a second user device represent different user devices, although both are user devices. For example, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element without departing from the scope of the present disclosure.
[0175] When one element (e.g., a first element) is referred to as being "(operably or communicatively) coupled" or "(operably or communicatively) coupled to" or "connected to" another element (e.g., a second element), it is understood that the one element is directly connected to the other element or the one element is indirectly connected to the other element via yet another element (e.g., a third element). Conversely, it is understood that when an element (e.g., a first element) is referred to as being "directly connected" or "directly coupled" to another element (the second element), no element (e.g., a third element) is interposed between the two.
[0176] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.
Claims
1. A method for constructing an index, the method comprising: Constructing a first index layer according to the trajectory point data, each node in the first index layer is used to store the trajectory point data; Grouping multiple sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data, and constructing an index node of the second index layer according to the grouping result; and setting for each leaf node in the index node: a link between nodes of the first index layer where the trajectory point data corresponding to the sub-enclosure frame of the current leaf node is located, and a link to leaf nodes where other sub-enclosure frames in the total enclosure frame to which the sub-enclosure frame of the current leaf node belongs; Building a link between the first index layer and the second index layer, so as to establish an association relationship between the sub-boundary boxes corresponding to each index node of the second index layer and the track point data in each node in the first index layer through the link; An index structure for performing track search is constructed according to the first index layer, the second index layer and the association relationship.
2. The method according to claim 1, wherein: The grouping of a plurality of sub-enclosure frames contained in the trajectory enclosure frame corresponding to the trajectory point data comprises: The plurality of sub-enclosed frames are grouped according to the centroids of the plurality of sub-enclosed frames to obtain a grouping result of the plurality of sub-enclosed frames.
3. The method according to claim 1, wherein: The step of constructing the index node of the second index layer according to the grouping result includes: The index nodes of the second index layer are constructed according to the grouping result and the time length of the leaf nodes of the second index layer.
4. The method according to claim 3, wherein: Before constructing the index node of the second index layer, the method further includes: According to the relationship between the time length of the leaf node and the total volume of the leaf node, the time length that makes the total volume of the leaf node minimized is determined, and the time length that makes the total volume of the leaf node minimized is used as the time length for constructing the index node of the second index layer.
5. The method according to claim 1, wherein: The link with the leaf nodes where other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs is set in the following manner: Performing a first round of traversal on the leaf nodes in the second index layer to record the mapping between the sub-enclosure frames in each leaf node in the second index layer and the sequence number of the leaf node; Perform a second round of traversal on the leaf nodes in the second index layer to determine other sub-outer bounding boxes in the total outer bounding box to which the sub-outer bounding box of the current leaf node belongs; According to the mapping and the determined other sub-enclosure frames, links are set between the current leaf node and the leaf nodes where the other sub-enclosure frames are located.
6. The method according to claim 1, wherein: The link with the leaf nodes where other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs are located includes: A link to the leaf node where the sub-bounding box of the adjacent sub-track of the track to which the sub-bounding box of the target sub-track of the current leaf node belongs is located.
7. The method according to claim 1, wherein: The first index layer adopts a TB structure, and the second index layer adopts a 3DR structure, The step of constructing an index structure for performing track search according to the first index layer, the second index layer and the association relationship includes: An index structure for trajectory search is constructed based on the association between the TB structure tree, the 3DR structure, the sub-boxes corresponding to each index node of the 3DR structure, and the trajectory point data in each node in the TB structure.
8. A trajectory query method, the method comprising: receiving a similar trajectory query request, wherein the similar trajectory query request is used to request to query a trajectory similar to the trajectory to be queried; Determine, according to the similar trajectory query request, an index structure of the corresponding trajectory data, wherein the index structure is an index structure constructed according to the index construction method according to any one of claims 1 to 7; For the index nodes in the second index layer of the index structure, determining the distance relationship between the sub-boundary box in each node and the trajectory to be queried in sequence according to the hierarchical relationship; According to the distance relationship, a node corresponding to the sub-enclosing frame closest to the trajectory to be queried is determined, and according to the determined node, a trajectory similar to the trajectory to be queried is obtained.
9. The method according to claim 8, wherein: Before determining the distance relationship between the sub-boundary box in each node and the to-be-queried trajectory in order according to the hierarchical relationship for the index nodes in the second index layer of the index structure, the method further includes: Simplifying the trajectory to be queried to obtain a simplified trajectory of the trajectory to be queried; The step of determining the distance relationship between the sub-boundary box in each node and the trajectory to be queried in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure includes: For the index nodes in the second index layer of the index structure, the distance relationship between the sub-boundary box in each node and the simplified trajectory is determined in sequence according to the hierarchical relationship.
10. The method according to claim 9, wherein: The simplifying the trajectory to be queried includes: Determine a first track point on the track to be queried that has the largest distance to a line connecting a starting point and an end point of the track to be queried; Determine a second trajectory point on the to-be-queried trajectory that has the largest distance to a line connecting the starting point of the to-be-queried trajectory and the first trajectory point, and a third trajectory point on the to-be-queried trajectory that has the largest distance to a line connecting the ending point of the to-be-queried trajectory and the first trajectory point, until n+1 trajectory points are determined on the to-be-queried trajectory, where n represents the number of line segments in the simplified trajectory; The starting point of the trajectory to be queried, the determined n+1 trajectory points and the ending point of the trajectory to be queried are sequentially connected to generate a simplified trajectory of the trajectory to be queried.
11. The method according to claim 8, wherein: The step of determining the distance relationship between the sub-boundary box in each node and the trajectory to be queried in sequence according to the hierarchical relationship for the index nodes in the second index layer of the index structure includes: For the index nodes in the second index layer of the index structure, the distance relationship between the sub-enclosing frame in each node and the trajectory to be queried is determined in sequence according to the hierarchical relationship, and the node corresponding to the sub-enclosing frame is added to the priority queue according to the distance relationship.
12. The method according to claim 11, wherein: The priority queue comprises a priority queue for index nodes in a second index level of the index structure.
13. The method according to claim 12, wherein: The node information of the nodes in the priority queue includes at least one of the following information: an identifier of the intermediate node or the leaf node, a distance relationship between the trajectory to be queried and the intermediate node or the leaf node, a state attribute of the intermediate node or the leaf node, an identifier of the trajectory, a distance relationship between the trajectory to be queried and the trajectory, and a state attribute of the trajectory.
14. The method according to claim 12, wherein: The nodes in the priority queue include at least one of the following: the root node of the index layer of the index structure tree, the intermediate node of the index layer of the index structure tree, the leaf node of the index layer of the index structure tree, the node where the trajectory data of all outer frames have not been read, the node where the trajectory data of all outer frames have been read, and the node where the trajectory data composed of real trajectory points are located.
15. The method according to claim 8, wherein: The step of obtaining a trajectory similar to the trajectory to be queried according to the determined node includes: If the determined node is an intermediate node in the second index layer, enqueue the child nodes of the intermediate node; If the determined node is a leaf node in the second index layer, the outer bounding box stored in the leaf node is taken out and assigned to the corresponding track, and the lower bound of the corresponding track involved is recalculated.
16. The method according to claim 15, wherein: The method further comprises: If the determined node is the node where the trajectory data is located in the second index layer, and the outer bounding box of the trajectory is incomplete, reading out the leaf node of the outer bounding box of the next trajectory related to the trajectory to be queried; If the determined node is a leaf node in the second index layer, the outer bounding box stored in the leaf node is taken out and distributed to each track, and the lower bounds of each track involved are recalculated.
17. The method according to claim 15, wherein: The method further comprises: If the determined node is the node where the trajectory data in the second index layer is located, and the outer bounding box of the trajectory is complete, then taking out the trajectory points of the trajectory and putting them into a queue; If the determined node is the node where the trajectory data in the second index layer is located, and the trajectory points of the trajectory have been retrieved, then the trajectory is the nearest neighbor of the trajectory to be queried.
18. An index building device, the device comprising: A first construction module, configured to construct a first index layer according to the trajectory point data, wherein each node in the first index layer is used to store the trajectory point data; The second construction module is used to group the multiple sub-outer-boxes contained in the trajectory outer-box corresponding to the trajectory point data, and construct the index node of the second index layer according to the grouping result; and set for each leaf node in the index node: the link between the nodes of the first index layer where the trajectory point data corresponding to the sub-outer-box of the current leaf node is located, and the link with the leaf nodes where other sub-outer-boxes in the total outer-box to which the sub-outer-box of the current leaf node belongs; A third construction module is used to construct a link between the first index layer and the second index layer, so as to establish an association relationship between the sub-boundary boxes corresponding to each index node of the second index layer and the track point data in each node in the first index layer through the link; The fourth construction module is used to construct an index structure for trajectory search according to the first index layer, the second index layer and the association relationship.
19. A trajectory query device, comprising: A receiving module, configured to receive a similar trajectory query request, wherein the similar trajectory query request is used to request to query a trajectory similar to a trajectory to be queried; A first determination module, configured to determine an index structure of corresponding trajectory data according to the similar trajectory query request, wherein the index structure is an index structure constructed according to the index construction method according to any one of claims 1 to 7; A second determination module is used to determine, for index nodes in the second index layer of the index structure, the distance relationship between the sub-boundary box in each node and the trajectory to be queried in sequence according to the hierarchical relationship; The third determination module is used to determine, according to the distance relationship, a node corresponding to the sub-enclosing frame that is closest to the trajectory to be queried, and obtain a trajectory similar to the trajectory to be queried according to the determined node.
20. An electronic device, comprising: one or more processors; A computer readable medium configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the index construction method as described in any one of claims 1 to 7, or implement the trajectory query method as described in any one of claims 8 to 17.
21. A computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the index construction method according to any one of claims 1 to 7 is implemented, or the trajectory query method according to any one of claims 8 to 17 is implemented.