A data management method and device

By introducing the concept of time into the graph database and generating second database statements, the problem that graph databases cannot record historical data is solved, enabling time-series management capabilities and supporting complex network relationship analysis and future prediction.

CN123178362APending Publication Date: 2026-11-27HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510699563.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing graph databases cannot record data from different historical periods, and cannot support business scenarios such as internet social networks, historical playback of communication network failures, and AI-based future prediction and analysis.

Method used

By introducing the concept of time into the graph database, a second database statement is generated to record the historical time of the data and set tags or expiration dates to achieve time-series management of the data.

Benefits of technology

This enables graph databases to record data from different historical periods while maintaining compatibility with native operations, providing time-series data management capabilities, simplifying user query operations, and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178362A_ABST
    Figure CN123178362A_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field, and in particular to a data management method and device, so that a database can record data at different historical times and provide time sequence management capability of data under the condition of compatibility of original database (such as a graph database) operation. The method comprises the following steps: receiving a first database statement, the first database statement is used for executing a first database operation on a first object; generating a second database statement according to the first database statement, the second database statement is used for executing the first database operation on the first object, and a first time is set for a first data record, the first data record is a data record obtained after the first database operation is executed on the first object, and the first time is determined according to a system time or a configured data warehousing time; and sending the second database statement to the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data management method and apparatus. Background Technology

[0002] Graph databases are database systems specifically designed for storing, managing, and querying graph-structured data. They are based on graph theory and use graph structures for semantic queries, enabling them to handle complex network relationships. However, current mainstream graph databases lack a native time concept for storage, making it impossible to record data from different historical periods. This hinders their ability to support business scenarios such as internet social networks, historical playback of communication network failures, and future prediction and analysis based on artificial intelligence (AI).

[0003] Therefore, how to enable graph databases to provide time-series data management capabilities while maintaining compatibility with native graph database operations is a question that needs to be considered. Summary of the Invention

[0004] This application provides a data management method and apparatus, which enables the database to record data from different historical times and provide data time-series management capabilities while being compatible with native database (as shown in the figure) operations.

[0005] In a first aspect, embodiments of this application provide a data management method. This method can be executed by a computing device, or specifically by a software module within the computing device. The computing device may be, for example, a computer or a server, and the software module within the computing device may be, for example, a plug-in, script, applet, or interface module running on the computing device. For ease of description, the following description assumes execution by a computing device. The method includes: receiving a first database statement, which is used to perform a first database operation on a first object; generating a second database statement based on the first database statement, which is used to perform the first database operation on the first object, and setting a first time (or entry time) for a first data record. The first data record is the data record obtained after performing the first database operation on the first object, and the first time is determined based on the system time or a configured data entry time; and sending the second database statement to the database.

[0006] The aforementioned databases can be graph databases, relational databases, vector databases, or distributed computing (Hadoop) ecosystem databases, etc.

[0007] Using the above method, the computing device can support generating a second database statement based on a first database statement issued by a database client. This second statement can set a first time (or entry time) for the data record corresponding to the first database statement, enabling the database to record data from different historical periods and providing data time-series management capabilities. Furthermore, since the computing device generates the second database statement based on the first entry statement sent by the database client, existing database clients do not need to be modified. Existing database clients can still operate on the database, and the database remains compatible with native database operations.

[0008] In one possible design, the first database statement and the second database statement are data creation statements; the second database statement is also used to set a first flag for the first data record, the first flag indicating that the first data record is valid.

[0009] Based on the above design, considering the situation where data from different historical times are recorded in the database, an object (such as a point or edge in the database) may correspond to multiple data records from different historical times. Therefore, a first flag can be set for the data record corresponding to the data creation statement to indicate that the data record is valid, in order to distinguish it from the invalid data record corresponding to the data deletion statement.

[0010] In one possible design, the first database statement and the second database statement are data deletion statements; the second database statement is also used to set a second flag for the first data record, the second flag indicating that the first data record is invalid.

[0011] Based on the above design, considering the situation where data from different historical times are recorded in the database, an object (such as a point or edge in the database) may correspond to multiple data records from different historical times. Therefore, a second flag can be set for the data record corresponding to the data deletion statement to indicate that the data record has been deleted or that the content of the data record has become invalid.

[0012] In one possible design, the first database statement is a data modification statement, which is used to modify the second data record of the first object to the first data record; the second database statement includes a data creation statement, which is used to create the first data record of the first object and set a first flag for the first data record, which is used to indicate that the first data record is valid.

[0013] Based on the above design, considering the situation where data from different historical times are recorded in the database, an object (such as a point or edge in the database) can correspond to multiple data records from different historical times. Therefore, when the first database statement is a data modification statement, the second database statement can record the modified data content by creating a modified data record, and indicate that the latest data content is valid through the first marker.

[0014] In one possible design, the second database statement also includes a data deletion statement, which is used to modify the first tag corresponding to the second data record to a second tag, and the second tag is used to indicate that the second data record is invalid.

[0015] Through the above design, for data records of the first object that have been modified, a flag can be set for the data record to indicate that the data record is invalid, so as to prevent the database from mistakenly judging the data record as the latest data record of the first object.

[0016] In one possible design, the first database operation is a data creation operation, and the second database statement is also used to set the validity period for the first data record, which indicates the lifespan of the first data record from the first time.

[0017] The above design allows for efficient identification of expired data through validity periods, enabling the management of the data record lifecycle.

[0018] In one possible design, the method further includes: configuring the data entry time, the validity period of which is a first duration.

[0019] The above design avoids the problem of data records entering the database at different times corresponding to the same data entry time, which leads to unreasonable data entry time settings and affects the querying of data.

[0020] In one possible design, the method further includes: prompting the user to reconfigure the data entry time when the effective duration of the data entry time reaches a first duration, or updating the data entry time according to the system time.

[0021] Through the above design, when the effective duration of the configured data entry time reaches the set effective duration, the user is prompted to reconfigure the data entry time, or the data entry time is updated according to the system time. This can update the configured data entry time and avoid the problem of data records entered at different times corresponding to the same data entry time, which leads to unreasonable data entry time settings.

[0022] In one possible design, the method further includes: receiving a first query statement for querying a first object; generating a second query statement based on the first query statement for querying the first object, wherein the second query statement includes a time filtering condition determined according to a configured query time; sending the second query statement to a database; and receiving query results from the database.

[0023] With the above design, users do not need to be aware of time when generating query statements, which is consistent with query statements without time filtering conditions, thus simplifying the user's query operation and improving the user experience.

[0024] In one possible design, before generating the second query statement based on the first query statement, the method further includes configuring the query time, which is a point in time or a time range.

[0025] Through the above design, query time configuration and query operation can be separated. Once the query time is configured, all query operations can comply with the time filtering conditions corresponding to that query time before the query time configuration is changed. This makes it easier for users to use the database client, and the adaptation cost for the computing device to generate a second query statement based on the first query statement generated by the user through the client is lower.

[0026] In one possible design, the method further includes: receiving a first modeling statement, the first modeling statement being used to create a first data structure for data records of a first type of object, the first data structure including at least one field; generating a second modeling statement based on the first modeling statement, the second modeling statement being used to create a second data structure for data records of the first type of object, the second data structure including at least one field, and at least one of a first field, a second field, or a third field, the first field being used to carry the entry time of the data record, the second field being used to carry a first mark or a second mark, the first mark being used to indicate that the data record is valid, the second mark being used to indicate that the data record is invalid, and the third field being used to carry the validity period of the data record.

[0027] Through the above design, a data structure can be defined in the database to record data at different historical times, thereby supporting the insertion of data records corresponding to the second database statement regenerated by the computing device into the database.

[0028] In one possible design, the method further includes sending an index creation statement to the database, the index creation statement being used to generate an index in the database for the first field.

[0029] The above design allows the database to generate an index for the first field, which records the entry time of data records, thereby improving the efficiency of querying data based on time filtering conditions.

[0030] Secondly, embodiments of this application provide a data management device that has the function of implementing the method described in the first aspect. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules (or units) corresponding to the above-described function, such as an interface unit and a processing unit.

[0031] In one possible design, the device can be a chip, an integrated circuit, or a computing device.

[0032] In one possible design, the device includes a memory and a processor, the memory for storing computer programs or instructions executed by the processor, and when the computer programs or instructions are executed by the processor, the device can perform the method described in the first aspect above.

[0033] Thirdly, embodiments of this application provide a data management device, which includes an interface circuit and a processor, with the processor and interface circuit coupled to each other. The interface circuit is used for inputting and / or outputting signals, and the processor uses logic circuits or executing instructions to implement the method described in the first aspect. It is understood that the interface circuit can be a transceiver, transceiver device, or input / output interface.

[0034] Optionally, the data management device may also include a memory for storing instructions executed by the processor, or storing input data required by the processor to execute instructions, or storing data generated after the processor executes instructions. The memory may be a physically independent unit, or it may be coupled to the processor, or the processor may include the memory (i.e., the processor and memory are integrated together).

[0035] In one possible implementation, the data management device is a chip.

[0036] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions, which, when executed by a processor, can implement the method described in the first aspect.

[0037] Fifthly, embodiments of this application also provide a computer program product, including a computer program or instructions, which, when executed by a processor, can implement the method described in the first aspect.

[0038] In a sixth aspect, embodiments of this application also provide a chip system including a processor, which is coupled to a memory for storing programs or instructions. When the program or instructions are executed by the processor, the method described in the first aspect can be implemented.

[0039] The technical effects achievable by the second to sixth aspects mentioned above are similar to those achievable by the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0040] Figure 1 This is a schematic diagram of data storage for a graph database provided in an embodiment of this application;

[0041] Figure 2 A schematic diagram of the system architecture applicable to the method provided in the embodiments of this application;

[0042] Figure 3 A schematic diagram of a data management method provided in an embodiment of this application;

[0043] Figure 4 A schematic diagram of the data management process provided in this application embodiment;

[0044] Figure 5 This application provides the graph database showing changes in graph data at various time points in the embodiments of the present application;

[0045] Figure 6 and Figure 7 A schematic diagram of the structure of a data management device provided in an embodiment of this application. Detailed Implementation

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

[0047] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. The terms “first” and “second” are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as “first” or “second” may explicitly or implicitly include one or more of that feature. “First” and “second,” etc., are used to distinguish different objects, not to describe a particular order of objects. For example, a first object and a second object are used to distinguish different objects, not to describe a particular order of objects.

[0048] In the description of the embodiments in this application, unless otherwise stated, "multiple" means two or more. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.

[0049] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or related scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0050] The term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A existing alone, A and B existing simultaneously, and B existing alone.

[0051] To facilitate understanding by those skilled in the art, some terms used in this application are explained below.

[0052] 1) Database

[0053] A database is a repository for organizing, storing, and managing data according to a specific data structure. Databases store data in a specific format, and users can perform create (C), delete (D), update (U), and read (R) operations on the data stored in the database. The create operation, also known as an insert operation, adds data to the database; the delete operation, also known as a delete operation, removes data from the database; the update operation, also known as a modify operation, modifies data in the database; and the read operation, also known as a query operation, retrieves data from the database. These create, read, update, and delete operations are collectively referred to as CRUD operations.

[0054] In this embodiment, the database can be a graph database, a relational database, a non-relational database (such as a not only structured query language (NoSQL) database), a vector database, a time-series database, an in-memory database, or a Hadoop ecosystem database, etc. Taking a graph database as an example, a graph database is a database system specifically designed for storing, managing, and querying graph-structured data. It is a database based on graph theory and uses graph structures for semantic queries, capable of handling complex network relationships. In a graph database, vertices and edges are used as basic storage units. A graph database can be understood as a collection of vertices and edges, where "vertices" represent entities and "edges" represent relationships between entities.

[0055] Figure 1 This is a schematic diagram of data storage for a graph database provided in an embodiment of this application. Figure 1 The graph database shown uses nodes to represent people and edges to represent the closeness between people. The data structure (or data model) of a node (person) includes: ID, name, and age fields. The data structure (or data model) of an edge (relationship) includes: closeness. Figure 1 In the graph database, there are vertices "p1":("p1", "Alice", 30), "p2":("p2", "Bob", 25), and "p3":("p3", "Charlie", 27); edges: "P1"->"p2":("5"), "P2"->"p3":("7"), and "P3"->"p1":("3"). "P1"->"p2":("5") can be interpreted as p2 having a closeness of 5 to p1.

[0056] 2) Data Table

[0057] Data tables are used to store data. A data table can also be understood as a collection of structured data, a form of structured data organization, typically stored in rows and columns. Each row represents a data record, and each column represents a field or attribute within that record. For example, a user information table might include fields such as user identity (ID), name, age, or address, with each row representing a data record for a single user.

[0058] 3) Graph query language (GQL)

[0059] GQL is a standardized graph database query language jointly published by the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC), aiming to unify the syntax for graph data queries. GQL can be used to create graph models (such as vertex or edge models) and perform data creation, reading, updating, and deletion (CRUD) operations in graph databases.

[0060] It should be understood that not all of the terms described above are existing terms, and some of them may be terms proposed based on examples in this application.

[0061] Taking graph databases as an example, the native storage of current mainstream graph databases typically lacks a time concept, does not support the management of data from different historical periods, and cannot record data from different historical times. For example: in Figure 1 The graph database shown does not support recording the historical creation time of point "p1". If the data of point "p1" is updated, the graph database does not support recording the data before the update of point "p1", nor does it support recording the data update time of point "p1". This inability to record data from different historical times means that the graph database cannot support business scenarios such as internet social networks, historical playback of communication network failures, and future prediction and analysis based on artificial intelligence (AI).

[0062] Based on this, embodiments of this application provide a data management method and apparatus, which, while being compatible with native database (as shown in the figure) operations, enables the database to record the time of data operations and provides data time-series management capabilities.

[0063] Figure 2 This is a schematic diagram of a system architecture applicable to the method provided in the embodiments of this application. This architecture may include a client device, a computing device, and a database. The following describes each part of the system architecture:

[0064] (1) Client device

[0065] Client devices are devices with the client software deployed, such as mobile phones, tablets, and computers. The client here can also be called a product application, which is a software module that uses a database. It can exist as a software client, a mini-program within a software client, or even a webpage in a browser.

[0066] The client can be used to perform CRUD operations on the database, as well as to perform data analysis or processing based on the queried data. For example, it can perform network fault analysis based on queried network data, social relationship analysis based on queried social data, and financial anti-fraud analysis based on queried financial transaction data.

[0067] The client can also establish a session connection with the interface module through the database's common client interface. Based on the established session connection, the client device can send time switching (or configuration) commands, native database statements, etc., to the interface module. Since the client's time switching (or configuration) command operation is independent of the database's CRUD operations, the time for data operations can be flexibly switched (or configured) using separate commands at the periphery without changing the existing core CRUD database statements.

[0068] (2) Computing devices

[0069] A computing device is a device with an interface module deployed on it. A computing device can be a mobile phone, tablet, computer, server, or server cluster, etc. The interface module here can refer to a software module responsible for database interface encapsulation and data querying, and it can exist in the form of a plugin, script, or app, etc.

[0070] The interface module can provide an interface for native database statements based on the saved syntax rules of native database statements, capable of receiving and parsing native database statements from clients. Taking a graph database as an example, the syntax rules of the native database statements can be the syntax rules in specifications such as GQL; taking a relational database as an example, the syntax rules of the native database statements can be the syntax rules of relational databases based on Structured Query Language (SQL), and so on. The interface for native database statements can include software development kits (SDKs) or interfaces for representational state transfer (RESTful) protocols, etc.

[0071] The interface module can provide session management capabilities, maintain session context information for client session connections, and isolate session connections established with different clients; it also provides statement parsing and assembly capabilities, and can automatically add time attribute fields and rewrite database statements.

[0072] The interface module can also process time switching (or configuration) commands from the client, record the specified time information in the session time management unit, and then rewrite the database statement from the client based on the specified time information to generate a new database statement. By providing an intermediate conversion layer between the client and the database, the complex time statement construction operations can be shielded, leaving the simple operations to the upper-layer client.

[0073] After the interface module generates the database statement, it can send the generated database statement to the database. This database statement can be used to add the data operation time (or data entry time) to the data records that are added, deleted, or modified in the database, or to query data records that meet specific query time filtering conditions.

[0074] It should be noted that the interface module is not strongly bound to a specific database. In other words, the interface module can be used not only with graph databases, but also with other types of databases, such as SQL-based relational databases.

[0075] (3) Database

[0076] The database can be a graph database, supporting the graph query language and conforming to the GQL specification. It is also applicable to other types of databases, such as SQL-based relational databases.

[0077] It should be noted that the above Figure 2 Client devices with client software deployed in the system have the corresponding client functions, and computing devices with interface modules deployed in the system have the corresponding interface module functions.

[0078] Databases are typically deployed on the network side. In some embodiments, a computing device is deployed on the network side, which can process native database statements and time switching instructions from multiple client devices. In other embodiments, an interface module is located in the client device, which processes the native database statement before it is sent by the client and manages the entry time and / or query time.

[0079] The data management method provided in this application can be executed by a computing device, or specifically by a software module within the computing device. The computing device may be, for example, a computer or a server, and the software module within the computing device may be, for example, a plug-in, script, applet, or interface module running on the computing device. For ease of description, the following description will focus on execution by a computing device.

[0080] Figure 3 This diagram illustrates a data management method provided in an embodiment of this application. This method can be applied to... Figure 2 The system architecture shown is composed of Figure 2 The computing device in the process executes.

[0081] like Figure 3 As shown, the method includes:

[0082] S301: The computing device receives the first database statement.

[0083] The first database statement is used to perform a first database operation on the first object.

[0084] The first object can be called the target, which can be a record in the database, or one or more fields in a record in the database. Taking a graph database as an example, the first object can be at least one vertex and / or at least one edge in the graph database.

[0085] In some embodiments, the first database statement can be a database statement triggered by a user's operation on a client device. This database statement can be used to perform a first database operation (such as a data creation operation, a data deletion operation, or a data modification operation) on a first object in the database.

[0086] As an example of S301: A user creates a point (person) in a graph database through a client device. The point's attributes include: identifier, name, and age. The name and age values ​​can be input by the user, while the identifier can be generated by the client device. Based on the user's actions on the client device, the client device can generate a first database statement to perform a data creation operation on that point (person) in the database. An example of the first database statement is as follows:

[0087] INSERT VERTEX person(id, name, age)VALUES

[0088] "p2":("p2","Bob",25).

[0089] The meaning of the first database statement is: insertion point (person), including the values ​​of the identifier, name, and age fields, and the specific value to be inserted (or the content is: person "p2":(identifier: p2, name: Bob, age: 25).

[0090] Furthermore, since database statements can be used to perform database operations (such as data creation, data deletion, or data modification) on a specific object in the database, adding, deleting, or modifying data, in some embodiments, database statements can also be called insertion statements. For example, the first database statement mentioned above can also be called the first insertion statement.

[0091] S302: The computing device generates a second database statement based on the first database statement.

[0092] The second database statement is used to perform a first database operation on the first object and set a first time for the first data record. The first data record is the data record obtained after performing the first database operation on the first object. The first time is determined based on the system time or the configured data entry time.

[0093] In this application embodiment, setting a first time for the first data record can also be understood as setting an entry time or operation time for the first data record.

[0094] After the client device generates a first database statement for performing a first database operation on a first object, it can send the first database statement to the computing device. Upon receiving the first database statement, the computing device can obtain a first time and generate a second database statement based on the first database statement and the first time. The second database statement can not only perform the first database operation on the first object, but also set a first time for the first data record obtained after performing the first operation. For example, the computing device can add an assignment statement corresponding to a first field in the first database statement, where the first field can be historytime, storagetime, or operatingtime, etc., and the value assigned to the first field is the first time.

[0095] The first time set for the first data record obtained after performing the first operation can be determined by the computing device based on the configured data entry time or the current system time. The following explanation illustrates different implementation methods.

[0096] Implementation 1: The computing device is configured with a data entry time, and the computing device determines the first time based on the configured data entry time.

[0097] In one possible implementation, the data entry time can be configured by the user on the computing device via a client device.

[0098] As an example: After a user logs into the client device, a prompt box can be displayed on the client device asking whether to configure the data entry time. If the user chooses to configure the data entry time, a prompt box for entering the data entry time can also be displayed on the client device. After the user enters the data entry time, the client device can send a time configuration command, including the user's user identifier and the data entry time, to the computing device. After receiving the time configuration command, the computing device can save the data entry time for that user. For example, the computing device can save the association between the user's user identifier and the data entry time. Alternatively, the computing device can save the data entry time in the session context of the session connection established with the client device for that user. In addition to saving the data entry time, the session context can also save information related to the session connection established between the computing device and the client device for that user, such as the user's user identifier and the identifier of the session connection established with the client device for that user. The user identifier can be the user's account for logging into the client device, an identifier assigned to the user during the session connection established between the computing device and the client device for that user, etc., which is not limited in this embodiment.

[0099] After configuring the data entry time, when the computing device receives the first data entry statement sent from the client device for performing the first database operation on the first object, it can identify the data entry time associated with the user identifier used when logging into the client device, and set the data entry time as the first time for the first data record obtained after performing the first operation.

[0100] Implementation 2: The computing device determines the first time based on the current system time.

[0101] In implementation 2, there is no need to configure the data entry time. When the computing device receives the first data entry statement sent from the client device for performing the first database operation on the first object, the current system time can be used as the first time set for the first data record obtained after performing the first operation.

[0102] Implementation 3: The computing device is configured with a data entry time. If the configured data entry time meets the first condition, the computing device determines the first time based on the configured data entry time; if the configured data entry time does not meet the first condition, the computing device determines the first time based on the current system time.

[0103] The first condition may include at least one of the following: the effective duration of the configured data entry time is less than or equal to a first duration; the time interval between the configured data entry time and the current system time is less than or equal to a second duration.

[0104] As an example: After configuring the data entry time, when the computing device receives a first data entry statement from the client device for performing a first database operation on a first object, it can identify the data entry time associated with the user identifier used when logging into the client device, and determine whether the data entry time meets a first condition. If the first condition is met, the computing device can use the data entry time as the first time set for the first data record obtained after performing the first operation; if the first condition is not met, the computing device can use the current system time as the first time set for the first data record obtained after performing the first operation.

[0105] Optionally, the first duration and the second duration can be set according to the system's requirements for data timeliness. For example, the first duration can be 12 hours or 24 hours, and the second duration can be 12 hours or 24 hours. This application does not limit the values ​​of the first duration and the second duration.

[0106] In some embodiments, for implementation 1 or implementation 3 above, to avoid using the same data entry time for all data records corresponding to database operations over a long period and to ensure the rationality of the data entry time configuration, the computing device can configure the validity period of the data entry time. This validity period can be determined autonomously by the computing device or specified by the client device; this application does not limit this.

[0107] Taking the validity period of the data entry time as the first duration as an example, when the effective duration of the database entry time reaches the first duration, the computing device can prompt the user to reconfigure the data entry time. For example, the computing device can send a request to the client device to reconfigure the data entry time, and the client device will prompt the user to reconfigure the data entry time. After the user reconfigures the data entry time, the client device can send a time configuration command carrying the reconfigured data entry time to the computing device. After receiving the time configuration command, the computing device can update the saved data entry time.

[0108] Alternatively, when the effective duration of the database entry time reaches the first duration, the computing device can also obtain the system time when the effective duration of the database entry time reaches the first duration, and update the data entry time according to the system time.

[0109] In some embodiments, when the effective duration of the database entry time reaches a first duration, the computing device may also delete the database entry time. After deleting the database entry time and before the user reconfigures the data entry time, the first time set in the data records obtained after performing database operations can be determined based on the current system time.

[0110] It should be noted that the first time can be in the format of year, month, day, hour, minute, and second, or in the format of Universal Time Coordinated (UTC). The UTC format refers to the total number of seconds from Greenwich Mean Time 00:00:00 on January 1, 1970 (08:00:00 Beijing Time on January 1, 1970) to the present. For example, 2025 / 3 / 28 0:00:00 converted to UTC time is 1743091200.

[0111] Taking the first database statement used to perform a data creation operation (i.e., the first database operation) on point (person) p2 (i.e., the first object) in the database as an example, assuming that the first time is determined according to the current system time, which is 1743091200 (2025 / 3 / 28 0:00:00), a possible example of the second database statement is as follows:

[0112] INSERT VERTEX person(id, name, age, historytime)VALUES

[0113] "p2_1743091200": ("p2", "Bob", 25, 1743091200).

[0114] The second database statement means: Insertion point (person), including the values ​​of the identifier, name, age, and historical time fields. The specific value (or content) to be inserted is: Person "p2_1743091200":(Identifier: p2, Name: Bob, Age: 25, Historical Time: 1743091200).

[0115] In some embodiments, if the first database operation is a data creation operation, the second database statement can also be used to set an expiration date for the first data record. This expiration date indicates the lifespan of the first data record from a first time. This allows the database to efficiently determine expired data through the expiration date, thereby achieving lifecycle management of data records.

[0116] Taking the first database statement used to perform a data creation operation (i.e., the first database operation) on point (person) p2 (i.e., the first object) in the database as an example, assuming the first time is determined based on the current system time, which is 1743091200 (2025 / 3 / 28 0:00:00), and the validity period is carried by the retention time (reserve_time) field, a possible example of the second database statement is as follows:

[0117] INSERT VERTEX person(id, name, age, historytime, reserve_time)VALUES

[0118] "p2_1743091200": ("p2", "Bob", 25, 1743091200, 8640000).

[0119] The meaning of the second database statement is: Insertion point (person), including the values ​​of the ID, name, age, historical time, and validity period fields. The specific inserted value (or content) is: Person "p2_1743091200":(ID: p2, Name: Bob, Age: 25, Historical Time: 1743091200, Validity Period: 8640000).

[0120] In some embodiments, to ensure compatibility with native database operations, the computing device may determine whether to generate a second database statement based on the first database statement, depending on whether the first database statement carries a time series (TS) switch or the state (or value) of the TS switch carried in the first database statement. If the first database statement does not carry a TS switch, or if the TS switch is in a closed state, the computing device may not process the first database statement but instead pass it through to the database for execution.

[0121] As an example: After a user logs into the client device, the user can configure the TS switch on the client device. If the user chooses to enable the TS switch, the TS switch is included in the first database statement sent by the client device to the computing device. The computing device can then generate a second database statement based on the first database statement containing the TS switch. If the user does not choose to enable the TS switch, the TS switch is not included in the first database statement sent by the client device to the computing device. The computing device can then pass this first database statement without the TS switch to the database for execution.

[0122] As another example: After a user logs into the client device, the user can configure the TS switch on the client device. Regardless of whether the user chooses to enable the TS switch, the TS switch can be included in the first database statement sent by the client device to the computing device. When the user chooses to enable the TS switch, its state is "on" (e.g., the TS switch value is 0); when the user chooses to disable the TS switch, its state is "off" (e.g., the TS switch value is 1). After receiving the first database statement from the client device, the computing device can identify the state of the TS switch carried in the first database statement. If the TS switch is "on," the computing device can generate a second database statement based on the first database statement; if the TS switch is "off," the computing device can pass the first database statement through to the database for execution.

[0123] In one possible implementation, the computing device can also filter out TS switches in the generated second database statement or the first database statement passed to the database, in order to reduce transmission overhead and avoid the database from parsing the TS switches in the first or second database statement, thus avoiding resource waste.

[0124] S303: The computing device sends a second database statement to the database.

[0125] After the computing device generates the second database statement, it can send the second database statement to the database for execution and obtain the status information returned by the database (such as the execution result).

[0126] It is understandable that the computing device sends the second database statement to the database for execution, or it could mean that the computing device calls the database's interface to cause the database to execute the second database statement.

[0127] After introducing the first time (or data entry time) into the data record, in order to distinguish whether the data record has been deleted, the second database statement generated by the computing device can also be used to set a deletion flag for the first data record obtained after executing the first database operation. When the deletion flag is the first flag (e.g., 0), it indicates that the data record is valid (or not deleted), and when the deletion flag is the second flag (e.g., 1), it indicates that the data record is invalid (or deleted). The following is an explanation with different implementation examples.

[0128] A is achieved by: the first database statement and the second database statement being data creation statements; the second database statement is also used to set a first flag for the first data record, which indicates that the first data record is valid.

[0129] Taking the first database statement as the data creation statement, and using it to create a point (person) p2 with the identifier: p2, name: Bob, age: 25 as an example, the first database statement is as follows:

[0130] INSERT VERTEX person(id, name, age)VALUES

[0131] "p2":("p2","Bob",25).

[0132] The meaning of the first database statement is: Insertion point (person), including the values ​​of the identifier, name, and age fields. The specific value to be inserted is: Person "p2":(Identifier: p2, Name: Bob, Age: 25).

[0133] Assuming the system time when the computing device generates the second database statement is 1743091200, then the second database statement generated by the computing device based on the first database statement can be:

[0134] INSERT VERTEX person(id,name,age,historytime,deleteflag)VALUES

[0135] "p2_1743091200": ("p2", "Bob", 25, 1743091200, 0).

[0136] The second database statement means: Insertion point (person), including the values ​​of the identifier, name, age, historical time, and deletion flag fields. The specific value to be inserted is: Person "p2_1743091200":(Identifier: p2, Name: Bob, Age: 25, Historical Time: 1743091200, Deletion Flag: 0).

[0137] The second database statement can be used to set the first time "1743091200" and the first flag "0" for the first data record "p2":("p2","Bob",25). The deletion flag "0" indicates that the first data record is valid and has not been deleted.

[0138] Implementation B: The first database statement and the second database statement are data deletion statements; the second database statement is also used to set a second flag for the first data record, which is used to indicate that the first data record is invalid.

[0139] Taking the first database statement as a data deletion statement, used to delete the point (person) p2 with the identifier: p2, name: Bob, age: 25, as an example, the first database statement is as follows:

[0140] DELETE VERTEX person"p2".

[0141] The meaning of the first database statement is: delete point (person) p2.

[0142] Assuming the system time when the computing device generates the second database statement is 1743091200, then the second database statement generated by the computing device based on the first database statement can be:

[0143] INSERT VERTEX person(id,name,age,historytime,deleteflag)VALUES

[0144] "p2_1743091200": ("p2", "Bob", 25, 1743091200, 1).

[0145] The second database statement means: Insertion point (person), including the values ​​of the identifier, name, age, historical time, and deletion flag fields. The specific value to be inserted is: Person "p2_1743091200":(Identifier: p2, Name: Bob, Age: 25, Historical Time: 1743091200, Deletion Flag: 1).

[0146] The second database statement can be used to set the first time (1743091200) and the second flag "1" for the first data record "p2":("p2","Bob",25). The deletion flag, the second flag "1", indicates that the first data record is invalid and has been deleted.

[0147] Implementation C: The first database statement is a data modification statement, which is used to modify the second data record of the first object to the first data record; the second database statement includes a data creation statement, which is used to create the aforementioned first data record of the first object and set a first flag for the first data record, which is used to indicate that the first data record is valid.

[0148] Taking the first database statement as a data modification statement, to change the age in the point (person) p2 (the second data record) with identifier: p2, name: Bob, age: 25 to 30, as an example, the first database statement is as follows:

[0149] UPDATE VERTEX person"p2"

[0150] SET age=30.

[0151] The meaning of the first database statement is: Update point (person) p2, set the value of the age field to 30.

[0152] Assuming the system time when the computing device generates the second database statement is 1743091200, then the second database statement generated by the computing device based on the first database statement can be:

[0153] INSERT VERTEX person(id,name,age,historytime,deleteflag)VALUES

[0154] "p2_1743091200": ("p2", "Bob", 30, 1743091200, 0).

[0155] The second database statement means: Insertion point (person), including the values ​​of the identifier, name, age, historical time, and deletion flag fields. The specific value to be inserted is: Person "p2_1743091200":(Identifier: p2, Name: Bob, Age: 30, Historical Time: 1743091200, Deletion Flag: 0).

[0156] The second database statement can be used to set the first time (1743091200) and the first flag "0" for the first data record "p2":("p2","Bob",30). The deletion flag "0" indicates that the first data record is valid and has not been deleted.

[0157] In one possible implementation, the second database statement may also include a data deletion statement, which is used to modify the first mark corresponding to the second data record to a second mark. The second mark is used to indicate that the second data record is invalid, so as to avoid the database misjudging the second data record as a valid data record at point "p2" or the latest data record.

[0158] In some embodiments, to facilitate setting a first time (or data entry time), a deletion marker (such as a first marker or a second marker), or an expiration date in a data record, the computing device can, based on a first modeling statement from a client device, concatenate one or more of the following: a first field carrying the first time (or data entry time), a second field carrying the deletion marker (such as a first marker or a second marker), or a third field carrying the expiration date, to generate a second modeling statement. For example, if the first modeling statement is used to create a first data structure for a data record of a first type of object, and this first data structure includes at least one field, then the computing device can generate a second modeling statement based on the first modeling statement. This second modeling statement can be used to create a second data structure for a data record of the first type of object. In addition to including at least one field from the first data structure, the second data structure may also include at least one of the first field, the second field, or the third field.

[0159] As an example: The first modeling statement is used to create the point model (or the first data structure for the point): user, including two fields (or attributes) for username and total number of comments. Additionally, a TS switch and a maximum retention time (RESERVE_TIME) can be added to the end of the first modeling statement.

[0160] The first modeling statement example is as follows:

[0161]

[0162] Taking a scenario where the first field is the historytime field and the second field is the delete flag (delete flag), the second modeling statement is as follows:

[0163]

[0164] The second modeling statement is used to create the point model (or the second data structure for creating points): The user field includes not only the username and comment count fields, but also the historytime and deletion flag fields. Additionally, in the second modeling statement, TTL_DURATION refers to the time to live (TTL) duration, and TTL_COL indicates the start or beginning time of the validity period, determined by the value of the historytime field.

[0165] In some embodiments, after the client device establishes a session connection with the computing device, the user can configure the query time through the client device before querying data. The query time can be a point in time or a time range.

[0166] As an example: After a user specifies a query time on the client device, the client device can send a time configuration (or switching) instruction carrying the query time to the computing device. The computing device can execute the time configuration (or switching) instruction to specify the query time. This query time remains unchanged until the user configures the query time again, and it can take effect on the first query statement received by the computing device from the client device during this period.

[0167] In this way, after receiving a first query statement from a client device for querying a specific object (such as the first object), the computing device can generate a second query statement based on the first query statement and the configured query time. The second query statement not only queries the object but also includes time filtering conditions determined by the configured query time. After generating the second query statement, the computing device can send it to the database, which executes the second query statement and returns the query results to the computing device. Upon receiving the query results from the database, the computing device can send the results to the client device, which then provides them to the user.

[0168] In one possible implementation, the second query statement may also include a deletion flag filter condition, which is used to filter data records whose deletion flag is the first flag, that is, to filter valid or not deleted data records.

[0169] In one possible implementation, in order to improve the efficiency of querying data based on time filtering conditions, after sending the second modeling statement to the database, the computing device can also send an index creation statement to the database to generate an index for the first field (i.e., the field that carries the first time corresponding to the data record), so that the database generates an index for the first field, thereby improving the efficiency of querying data based on time filtering conditions.

[0170] The following example uses a graph database to store the relationships between users and posts in an internet social network. The first field is the historical time field, the second field is the deletion flag field, and the database statement is an insertion statement. Figure 4 Specific embodiments, for the above Figure 3 The data management methods will be explained.

[0171] Figure 4 This application provides a schematic diagram of a data management process, which includes:

[0172] 1. Modeling stage.

[0173] S401: The client device sends a first modeling statement to the computing device, and the computing device receives the first modeling statement accordingly.

[0174] In this embodiment of the application, the client device can add a TS switch for storing historical graph data and a maximum retention time (RESERVE_TIME) to the end of the modeling statement, based on the original graph model (vertex / edge model) modeling statement.

[0175] For example, the first modeling statement may include one or more of the following.

[0176] (1) Create a point model: user, with attributes including username and the total number of comments posted by the user.

[0177]

[0178] (2) Create a point model: post, with attributes including the post content and the total number of comments received by the post (comment_count).

[0179]

[0180] (3) Create an edge model: comment, with attributes including the comment content field.

[0181] CREATE EDGE IF NOT EXISTS comment(

[0182] content STRING

[0183] )TS RESERVE_TIME=8640000.

[0184] S402: When the first modeling statement carries the TS switch, the computing device generates the second modeling statement according to the first modeling statement.

[0185] For example, based on the first modeling statement described above, the generated second modeling statement may include one or more of the following:

[0186] (1) Create a point model: user, and add the historytime and delete flag fields to the attributes.

[0187]

[0188] )TTL_DURATION=8640000,TTL_COL="historytime";

[0189] (2) Create a point model: post, and add the historytime and delete flag fields to the attributes.

[0190]

[0191] )TTL_DURATION=8640000,TTL_COL="historytime";

[0192] (3) Create an edge model: comment, and add the historytime and delete flag fields to the attributes.

[0193]

[0194] It should be noted that the TTL-related statements mentioned above (such as TTL_DURATION or TTL_COL) are optional. If the graph database has TTL capability, then add the above TTL-related statements to the modeling statements; if it does not have TTL capability, then there is no need to add TTL-related statements, and users can delete data periodically according to the aging time.

[0195] S403: The computing device sends a second modeling statement to the graph database, and the graph database receives the second modeling statement accordingly.

[0196] After the second modeling statement is generated, the computing device can submit it to the graph database for execution. The graph database will execute the second modeling statement to create point and / or edge models and can obtain the status information (such as modeling results) returned by the graph database.

[0197] In some embodiments, the interface unit can also create an index on the historytime field of each point or edge. An example of an index creation statement is as follows:

[0198] CREATE TAG INDEX IF NOT EXISTS user_index on player(historytime);

[0199] CREATE TAG INDEX IF NOT EXISTS post_index on team(historytime);

[0200] CREATE EDGE INDEX IF NOT EXISTS follow_index on serve(historytime);

[0201] CREATE EDGE INDEX IF NOT EXISTS like_index on serve(historytime);

[0202] CREATE EDGE INDEX IF NOT EXISTS comment_index on serve(historytime).

[0203] For index creation statements, computing devices can also submit them to the graph database for execution and obtain the returned status information (such as the index creation result).

[0204] 2. Data entry stage.

[0205] S404: The client device sends the first data entry statement to the computing device, and the computing device receives the first data entry statement accordingly.

[0206] The client device can generate the first import statement according to the original import statement generation method of the graph database and submit it to the computing device. Graph data can be imported at the following three time points (t1, t2, t3): An example of the first import statement is as follows:

[0207] Time point t1: The UTC time of the session context of the current session connection established between the computing device and the client device is 1743091200 (2025 / 3 / 28 0:00:00).

[0208] Insert three users: u1, u2, and u3

[0209] INSERT VERTEX user(username,comment_count)VALUES

[0210] "u1":("Alice",0),

[0211] "u2":("Bob",0),

[0212] "u3":("Charlie",0);

[0213] Insert two posts, p1 and p2:

[0214] INSERT VERTEX post(content,comment_count)VALUES

[0215] "p1":("Graph is powerful!",0),

[0216] "p2":("Graph databases are the future",0).

[0217] Time point t2: The UTC time of the session context of the current session connection established between the computing device and the client device is 1743091800 (2025 / 3 / 28 0:10:00).

[0218] Comment from u1 to p1, and establish an edge between points u1 and p1.

[0219] INSERT EDGE comment(content)VALUES

[0220] "u1"->"p1":("Great post!");

[0221] Update the counters, update point u1, update the total number of comments initiated by u1 to 1, and update the total number of comments received by p1 to 1.

[0222] UPDATE VERTEX"u1"SET user.comment_count=1;

[0223] UPDATE VERTEX"p1"SET post.comment_count=1;

[0224] Comment on p1 using u2, and establish an edge between points u2 and p1.

[0225] INSERT EDGE comment(content)VALUES

[0226] "u2"->"p1":("I learned a lot");

[0227] Update the counters, update point u2, update the total number of comments initiated by u2 to 1, and update the total number of comments received by p1 to 2.

[0228] UPDATE VERTEX"u2"SET user.comment_count=1;

[0229] UPDATE VERTEX"p1"SET post.comment_count=2;

[0230] Comment on p2 from u3, and establish an edge between u3 and p2.

[0231] INSERT EDGE comment(content)VALUES

[0232] "u3"->"p2":("Very helpful");

[0233] Update the counters, update point u3, update the total number of comments initiated by u3 to 1, and update the total number of comments received by p2 to 1.

[0234] UPDATE VERTEX"u3"SET user.comment_count=1;

[0235] UPDATE VERTEX "p2" SET post.comment_count=1.

[0236] Time point t3: The UTC time of the session context obtained by the current session connection between the computing device and the client device is 1743092400 (2025 / 3 / 28 0:20:00).

[0237] u2 deletes its comment on p1, and the edge between u2 and p1...

[0238] DELETE EDGE comment"u2"->"p1";

[0239] Update the counters to set the total number of comments initiated by u2 to 0 and the total number of comments received by p1 to 1.

[0240] UPDATE VERTEX"u2"SET user.comment_count=0;

[0241] UPDATE VERTEX "p1" SET post.comment_count=1.

[0242] S405: The computing device generates a second input statement based on the first input statement and the system time (such as the current UTC time).

[0243] After receiving the first write statement, the computing device can obtain the current UTC time and generate a second write statement based on the first write statement and the current UTC time. An example of the second write statement is as follows:

[0244] Time point t1: The UTC time of the session context of the current session connection established between the computing device and the client device is 1743091200 (2025 / 3 / 28 0:00:00).

[0245] Insert 3 users, and add the historical time "1743091200" and the deletion marker "0" to the attributes of each user.

[0246] INSERT VERTEX user(username,comment_count,historytime,deleteflag)VALUES

[0247] "u1_1743091200":("Alice",0,1743091200,0),

[0248] "u2_1743091200":("Bob",0,1743091200,0),

[0249] "u3_1743091200":("Charlie",0,1743091200,0);

[0250] Insert two posts, and add the history time "1743091200" and the deletion tag "0" to the attributes of each post.

[0251] INSERT VERTEX post(content,comment_count,historytime,deleteflag)VALUES

[0252] "p1_1743091200":("Graph is powerful!",0,1743091200,0),

[0253] "p2_1743091200":("Graph databases are the future",0,1743091200,0).

[0254] Time point t2: The UTC time of the session context established between the current computing device and the client device is 1743091800 (2025 / 3 / 28 0:10:00).

[0255] Commenting on p1 by u1, add the historical time 1743091800 and remove the marker 0 on the edge between u1 and p1.

[0256] INSERT EDGE comment(content,historytime,deleteflag)VALUES

[0257] "u1_1743091200"->"p1_1743091200":("Great post!",1743091800,0);

[0258] Update the counter, adding two historical time points, user and post, carrying the historical time 1743091800 and the deletion marker 0 respectively.

[0259] INSERT VERTEX user(username,comment_count,historytime,deleteflag)VALUES

[0260] "u1_1743091200":("Alice",0,1743091800,0);

[0261] INSERT VERTEX post(content,comment_count,historytime,deleteflag)VALUES

[0262] "p1_1743091200":("Graph is powerful!",0,1743091800,0),

[0263] Commenting on p1 by u2, add the historical time 1743091800 and remove the marker 0 on the edge between u2 and p1.

[0264] INSERT EDGE comment(content,historytime,deleteflag)VALUES

[0265] "u2_1743091200"->"p1_1743091200":("I learned a lot",1743091800,0);

[0266] Update the counter, adding two historical time points, user and post, carrying the historical time 1743091800 and the deletion marker 0 respectively.

[0267] INSERT VERTEX user(username,comment_count,historytime,deleteflag)VALUES

[0268] "u2_1743091200":("Bob",1,1743091800,0);

[0269] INSERT VERTEX post(content,comment_count,historytime,deleteflag)VALUES

[0270] "p1_1743091200":("Graph is powerful!",2,1743091800,0);

[0271] Commenting on p2 from u3, add the historical time 1743091800 and remove the marker 0 on the edge between u3 and p2.

[0272] INSERT EDGE comment(content,historytime,deleteflag)VALUES

[0273] "u3_1743091200"->"p2_1743091200":("Very helpful",1743091800,0);

[0274] Update the counter, adding two historical time points, user and post, carrying the historical time 1743091800 and the deletion marker 0 respectively.

[0275] INSERT VERTEX user(username,comment_count,historytime,deleteflag)VALUES

[0276] "u3_1743091200":("Charlie",1,1743091800,0);

[0277] INSERT VERTEX post(content,comment_count,historytime,deleteflag)VALUES

[0278] "p2_1743091200":("Graph databases are the future",1,1743091800,0).

[0279] Time point t3: The UTC time of the session context of the current session connection established between the computing device and the client device is 1743092400 (2025 / 3 / 28 0:20:00).

[0280] u2 deletes its comment on p1, and adds a pseudo-deletion edge.

[0281] INSERT EDGE comment(content,historytime,deleteflag)VALUES

[0282] "u2_1743092400"->"p1_1743092400":("I learned a lot",1743092400,1);

[0283] Update the counter, adding two historical time points for user and post points.

[0284] INSERT VERTEX user(username,comment_count,historytime,deleteflag)VALUES

[0285] "u2_1743092400":("Bob",0,1743092400,0);

[0286] INSERT VERTEX post(content,comment_count,historytime,deleteflag)VALUES

[0287] "p1_1743092400":("Graph is powerful!",1,1743092400,0).

[0288] S406: The computing device sends a second import statement to the graph database, and the graph database receives the second import statement accordingly.

[0289] After generating the second input statement, the computing device can submit it to the graph database for execution. The changes in graph data in the graph database at various points in time are as follows: Figure 5 As shown.

[0290] 3. Specify the query time period.

[0291] S407: The client device sends a query time configuration command to the computing device, and the computing device receives the query time configuration command accordingly.

[0292] Before querying, the client device can send a query time configuration command to the computing device. Taking the query time as t2, i.e., UTC time 1743091800 (2025 / 3 / 28 0:10:00) as an example, after receiving the query time configuration command, the client device can store the query time 1743091800 (i.e., t2) indicated by the query time configuration command in the session context of the session connection established between the computing device and the client device. An example of a query time configuration command is as follows:

[0293] The command `alter{spacename}ts 1743091800` is used, where `spacename` represents the name of the graph database.

[0294] 4. Querying graph data stage.

[0295] S408: The client device sends a first query statement to the computing device, and the computing device receives the first query statement accordingly.

[0296] Taking a user's query for the status graph of users and posts at time t2 as an example, the first query statement does not need to be aware of time information. The first query statement is completely transparent to time in its expression; that is, it queries the historical status graph of users and posts. An example of the first query statement is as follows:

[0297]

[0298]

[0299] S409: The computing device retrieves the query time t2.

[0300] S410: The computing device generates a second query statement based on the query time t2 and the first query statement.

[0301] The second query statement senses the query time t2 and is used to query the status graph of users and posts at time t2. An example of the second query statement is as follows:

[0302]

[0303] Add a time filter condition based on the query time t2 to the second query statement, which is the WHERE part in the example above.

[0304] S411: The computing device sends a second query statement to the graph database, and the graph database receives the second query statement accordingly.

[0305] S412: The graph database sends query results to the computing device, and the computing device receives the query results accordingly.

[0306] After determining the second query statement, the computing device can submit the second query statement to the graph database for execution and obtain the query results from the graph database. The query results (i.e., the state graph of users and posts at time t2) are shown in Table 1.

[0307] Table 1

[0308]

[0309] The graph information of the social network at time t2 (i.e., the state graph of users and posts at time t2) can be obtained and used to replay the interaction information at historical time t2.

[0310] The above example uses the user and post status graph at time t2. If we were to query the user and post status graph at time t3, the computing device would generate the following example of a second query statement:

[0311]

[0312] Add a time filter condition based on the query time t3 to the second query statement, which is the WHERE part in the example above.

[0313] After determining the second query statement, the computing device can submit the second query statement to the graph database for execution and obtain the query results from the graph database. The query results (i.e., the state graph of users and posts at time t3) are shown in Table 2.

[0314] Table 2

[0315]

[0316]

[0317] The graph information of the social network at time t3 (i.e., the state graph of users and posts at time t3) can be obtained and used to replay the interaction information at historical time t3.

[0318] The data management method provided in this application, where a computing device acts as an intermediate conversion layer between a client device and a database, can rewrite database statements from the client based on specified time information to generate new database statements. These new statements can be used to add data operation times (or data entry times) to data records added, deleted, or modified in the database, or to query data records that meet specific query time filtering conditions. This allows the database to record the time of data operations, providing time-series data management capabilities. Furthermore, it does not require changes to existing database clients; existing database clients can still operate on the database, and the database is also compatible with native database operations.

[0319] Taking a graph database as an example, the data management method provided in this application adds several time fields to record time information when directly modeling points or edges in the graph database. When performing CRUD operations on points or edges, the time value is displayed in the operation statement as an input assignment condition or as a query filter condition. Users do not need to be strongly aware of time in each operation, and the complexity of the database statement generated by the client is not changed. It is user-friendly and compatible with native database operations.

[0320] It is understood that, in order to achieve the functions in the above embodiments, the computing device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and method steps of the various examples described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.

[0321] Figure 6 and Figure 7 This is a schematic diagram illustrating the structure of a possible data management device provided in the embodiments of this application. These data management devices can be used to implement the functions of the computing device in the above method embodiments, and therefore can also achieve the beneficial effects of the above method embodiments. In the embodiments of this application, the data management device can be a computing device, or it can be a module (such as a chip) applied to the computing device.

[0322] Please see Figure 6 , Figure 6 This is a schematic diagram of a data management device according to an embodiment of this application. The data management device may include units or modules corresponding to all or part of the steps in the above method embodiments, and can be used to execute the steps executed by the computing device in the above embodiments. Please refer to the relevant descriptions in the above method embodiments for details.

[0323] like Figure 6 As shown, the data management device 600 includes a processing unit 610 and an interface unit 620, wherein the processing unit 610 may be a processor or a processing circuit, and the interface unit 620 may be a transceiver unit or an input / output interface. The data management device 600 can be used to implement the steps executed by the computing device in the above embodiments.

[0324] When the data management device 600 is used to implement the steps performed by the computing device in the above embodiments:

[0325] Interface unit 620 is used to receive a first database statement, which is used to perform a first database operation on a first object;

[0326] The processing unit 610 is used to generate a second database statement based on the first database statement. The second database statement is used to perform the first database operation on the first object and set a first time for the first data record. The first data record is the data record obtained after performing the first database operation on the first object. The first time is determined based on the system time or based on the configured data entry time.

[0327] Interface unit 620 is also used to send a second database statement to the database.

[0328] In one possible design, the first database statement and the second database statement are data creation statements; the second database statement is also used to set a first flag for the first data record, the first flag indicating that the first data record is valid.

[0329] In one possible design, the first database statement and the second database statement are data deletion statements; the second database statement is also used to set a second flag for the first data record, the second flag indicating that the first data record is invalid.

[0330] In one possible design, the first database statement is a data modification statement, which is used to modify the second data record of the first object to the first data record; the second database statement includes a data creation statement, which is used to create the first data record of the first object and set a first flag for the first data record, which is used to indicate that the first data record is valid.

[0331] In one possible design, the second database statement also includes a data deletion statement, which is used to modify the first tag corresponding to the second data record to a second tag, and the second tag is used to indicate that the second data record is invalid.

[0332] In one possible design, the first database operation is a data creation operation, and the second database statement is also used to set the validity period for the first data record, which indicates the lifespan of the first data record from the first time.

[0333] In one possible design, the processing unit 610 is also used to configure the data entry time, the validity period of which is a first duration.

[0334] In one possible design, the processing unit 610 is also used to prompt the user to reconfigure the data entry time or update the data entry time according to the system time when the effective duration of the data entry time reaches a first duration.

[0335] In one possible design, interface unit 620 is further configured to receive a first query statement for querying a first object; processing unit 610 is further configured to generate a second query statement based on the first query statement for querying the first object, and the second query statement includes a time filtering condition determined according to a configured query time; interface unit 620 is further configured to send the second query statement to the database; and receive query results from the database.

[0336] In one possible design, the processing unit 610 is further configured to configure a query time, which is a point in time or a time range, before generating a second query statement based on the first query statement.

[0337] In one possible design, the interface unit 620 is further configured to receive a first modeling statement, which is used to create a first data structure for a data record of a first type of object. The first data structure includes at least one field. The processing unit 610 is further configured to generate a second modeling statement based on the first modeling statement. The second modeling statement is used to create a second data structure for a data record of a first type of object. The second data structure includes at least one field, and at least one of a first field, a second field, or a third field. The first field is used to carry the entry time of the data record. The second field is used to carry a first flag or a second flag. The first flag is used to indicate that the data record is valid, and the second flag is used to indicate that the data record is invalid. The third field is used to carry the validity period of the data record.

[0338] In one possible design, interface unit 620 is also used to send an index creation statement to the database, which is used to generate an index on the first field in the database.

[0339] For a more detailed description of the processing unit 610 and the interface unit 620, please refer to [reference needed]. Figure 3 The relevant descriptions in the method embodiments shown.

[0340] like Figure 7 As shown, this application also provides a data management device 700, including a processor 710 and potentially a communication interface 720. The processor 710 and the communication interface 720 are coupled to each other. It is understood that the communication interface 720 can be a transceiver, input / output interface, input interface, output interface, interface circuit, etc. Optionally, the data management device 700 may further include a memory 730 for storing instructions executed by the processor 710, or storing input data required by the processor 710 to execute instructions, or storing data generated after the processor 710 executes instructions. The memory 730 can be a physically independent unit, or it can be coupled to the processor 710, or the processor 710 may include the memory 730.

[0341] When the data management device 700 is used to implement the steps executed by the computing device in the above embodiments, the processor 710 can be used to implement the function of the processing unit 610, and the communication interface 720 can be used to implement the function of the interface unit 620.

[0342] In this application embodiment, the processor (e.g., processor 710) can be one or more central processing units (CPUs). If the processor is a CPU, it can be a single-core CPU or a multi-core CPU. The processor can also be one or a combination of several of the following: CPU, general-purpose processor, application-specific integrated circuit (ASIC), digital signal processor, microprocessor, microcontroller, graphics processor, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, artificial intelligence processor, or neural network processor. The processor can implement or execute the methods, steps, and logic block diagrams disclosed in this application embodiment. The steps of the methods disclosed in this application embodiment can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

[0343] In this embodiment, the memory (e.g., memory 730) may include, but is not limited to, cache, read-only memory (ROM), random access memory, synchronous dynamic random access memory, hard disk or solid-state drive, erasable programmable read-only memory, or compact disc read-only memory (CD-ROM), etc. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. The memory in this embodiment may also be a circuit or any other device capable of implementing storage functions for storing computer programs or instructions, and / or data.

[0344] It is understood that the method steps in the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory, flash memory, read-only memory, programmable read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and storage medium can reside in an ASIC. Alternatively, the ASIC can reside in a computing device. Of course, the processor and storage medium can also exist as discrete components in the computing device.

[0345] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one network device, terminal, computer, server, or data center to another network device, terminal, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video optical disc; or it can be a semiconductor medium, such as a solid-state drive. The computer-readable storage medium may be a volatile or non-volatile storage medium, or may include both types of storage media.

[0346] In the various embodiments of this application, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions of different embodiments are consistent and can be referenced by each other. The technical features of different embodiments can be combined to form new embodiments according to their inherent logical relationship.

[0347] Additionally, it should be understood that in the embodiments of this application, the term "exemplary" is used to indicate that it is an example, illustration, or description. Any embodiment or design scheme described as "exemplary" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the term "exemplary" is intended to present the concept in a concrete manner.

[0348] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers described above does not imply the order of execution; the execution order of each process should be determined by its function and internal logic.

Claims

1. A data management method, characterized in that, include: Receive a first database statement, which is used to perform a first database operation on a first object; A second database statement is generated based on the first database statement. The second database statement is used to perform the first database operation on the first object and set a first time for the first data record. The first data record is the data record obtained after performing the first database operation on the first object. The first time is determined based on the system time or based on the configured data entry time. Send the second database statement to the database.

2. The method as described in claim 1, characterized in that, The first database statement and the second database statement are data creation statements; The second database statement is also used to set a first flag for the first data record, the first flag being used to indicate that the first data record is valid.

3. The method as described in claim 1, characterized in that, The first database statement and the second database statement are data deletion statements; The second database statement is also used to set a second flag for the first data record, the second flag indicating that the first data record is invalid.

4. The method as described in claim 1, characterized in that, The first database statement is a data modification statement, which is used to modify the second data record of the first object to the first data record; The second database statement includes a data creation statement, which is used to create the first data record of the first object and set a first flag for the first data record, the first flag being used to indicate that the first data record is valid.

5. The method as described in claim 4, characterized in that, The second database statement also includes a data deletion statement, which is used to modify the first marker corresponding to the second data record to a second marker, the second marker being used to indicate that the second data record is invalid.

6. The method as described in claim 1 or 2, characterized in that, The first database operation is a data creation operation, and the second database statement is also used to set an expiration period for the first data record. The expiration period is used to indicate the lifespan of the first data record from the first time.

7. The method according to any one of claims 1-6, characterized in that, The method further includes: Configure the data entry time, and the validity period of the data entry time is a first duration.

8. The method as described in claim 7, characterized in that, The method further includes: When the effective duration of the data entry time reaches the first duration, the user is prompted to reconfigure the data entry time, or update the data entry time according to the system time.

9. The method according to any one of claims 1-8, characterized in that, The method further includes: Receive a first query statement, which is used to query the first object; A second query statement is generated based on the first query statement. The second query statement is used to query the first object, and the second query statement includes a time filter condition, which is determined based on the configured query time. Send the second query statement to the database; Receive query results from the database.

10. The method as described in claim 9, characterized in that, Before generating the second query statement based on the first query statement, the method further includes: Configure the query time, which can be a point in time or a time range.

11. The method according to any one of claims 1-10, characterized in that, The method further includes: Receive a first modeling statement, the first modeling statement being used to create a first data structure for data records of a first type of object, the first data structure including at least one field; A second modeling statement is generated based on the first modeling statement. The second modeling statement is used to create a second data structure for the data record of the first type of object. The second data structure includes at least one field, and at least one of a first field, a second field, or a third field. The first field is used to carry the entry time of the data record. The second field is used to carry a first mark or a second mark. The first mark is used to indicate that the data record is valid, and the second mark is used to indicate that the data record is invalid. The third field is used to carry the validity period of the data record.

12. The method as described in claim 11, characterized in that, The method further includes: Send an index creation statement to the database, the index creation statement being used to generate an index in the database for the first field.

13. A data management device, characterized in that, Includes modules or units for performing the method as described in any one of claims 1-12.

14. A data management device, characterized in that, Includes a processor for executing computer programs or instructions in memory to implement the method as described in any one of claims 1-12.

15. The data management device as described in claim 14, characterized in that, The data management device further includes: the memory for storing the computer program or instructions.

16. A computer program product, characterized in that, It includes a computer program or instructions that, when executed by a processor, cause the method as described in any one of claims 1-12 to be implemented.

17. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions that, when executed by a processor, cause the method as described in any one of claims 1-12 to be implemented.