[go: up one dir, main page]

CN111523000A - Method, device, equipment and storage medium for importing data - Google Patents

Method, device, equipment and storage medium for importing data Download PDF

Info

Publication number
CN111523000A
CN111523000A CN202010325575.6A CN202010325575A CN111523000A CN 111523000 A CN111523000 A CN 111523000A CN 202010325575 A CN202010325575 A CN 202010325575A CN 111523000 A CN111523000 A CN 111523000A
Authority
CN
China
Prior art keywords
target
import
target node
identification information
directed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010325575.6A
Other languages
Chinese (zh)
Other versions
CN111523000B (en
Inventor
汪洋
郑杰鹏
王益飞
宋勋超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010325575.6A priority Critical patent/CN111523000B/en
Publication of CN111523000A publication Critical patent/CN111523000A/en
Application granted granted Critical
Publication of CN111523000B publication Critical patent/CN111523000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了用于导入数据的方法、装置、设备以及存储介质,涉及知识图谱领域。具体实现方案为:获取至少一个目标节点以及至少一个目标节点之间的有向边;获取至少一个目标节点的原始标识信息和内部标识信息;确定各有向边的目标导入顺序;根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。该方法按照目标导入顺序进行数据导入,提高了数据导入的效率。

Figure 202010325575

The present application discloses a method, apparatus, device and storage medium for importing data, and relates to the field of knowledge graphs. The specific implementation scheme is: obtaining at least one target node and a directed edge between at least one target node; obtaining the original identification information and internal identification information of at least one target node; determining the target import sequence of each directed edge; The original identification information of the two connected target nodes and the target import sequence are sequentially imported into the internal identification information of at least one target node. The method performs data import according to the target import sequence, which improves the efficiency of data import.

Figure 202010325575

Description

用于导入数据的方法、装置、设备以及存储介质Method, apparatus, device and storage medium for importing data

技术领域technical field

本申请的实施例涉及计算机技术领域,进一步涉及知识图谱领域,具体涉及用于导入数据的方法、装置、设备以及存储介质。The embodiments of the present application relate to the field of computer technologies, and further relate to the field of knowledge graphs, and in particular, to a method, apparatus, device, and storage medium for importing data.

背景技术Background technique

图数据库支持以图这种数据结构存储和查询数据的数据库。在图数据库中,所有数据通常以节点和边的形式存储。Graph databases support databases that store and query data in a graph-like data structure. In a graph database, all data is usually stored in the form of nodes and edges.

数据导入性能是评价图数据库的重要性能指标。当数据量达到一定程度时,内存、磁盘等系统资源的限制会对数据导入性能产生影响,进而对图数据库的查询性能产生影响。Data import performance is an important performance indicator for evaluating graph databases. When the amount of data reaches a certain level, the limitation of system resources such as memory and disk will affect the data import performance, which in turn will affect the query performance of the graph database.

发明内容SUMMARY OF THE INVENTION

提供了一种用于导入数据的方法、装置、设备以及存储介质。A method, apparatus, device, and storage medium for importing data are provided.

根据第一方面,提供了一种用于导入数据的方法,该方法包括:获取至少一个目标节点以及至少一个目标节点之间的有向边;获取至少一个目标节点的原始标识信息和内部标识信息;确定各有向边的目标导入顺序;根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。According to a first aspect, a method for importing data is provided, the method comprising: acquiring at least one target node and a directed edge between the at least one target node; acquiring original identification information and internal identification information of the at least one target node ; Determine the target import sequence of each directed edge; and sequentially import the internal identification information of at least one target node according to the original identification information of the two target nodes connected by the directed edge and the target import sequence.

根据第二方面,提供了一种用于导入数据的装置,该装置包括:第一获取单元,被配置成获取至少一个目标节点以及至少一个目标节点之间的有向边;第二获取单元,被配置成获取至少一个目标节点的原始标识信息和内部标识信息;确定单元,被配置成确定各有向边的目标导入顺序;导入单元,被配置成根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。According to a second aspect, there is provided an apparatus for importing data, the apparatus comprising: a first obtaining unit configured to obtain at least one target node and a directed edge between the at least one target node; a second obtaining unit, is configured to obtain the original identification information and internal identification information of at least one target node; the determination unit is configured to determine the target import order of each directed edge; the import unit is configured to be configured according to the two target nodes connected by the directed edge. The original identification information and the target import sequence are sequentially imported into the internal identification information of at least one target node.

根据第三方面,提供了一种电子设备,该电子设备包括:至少一个处理器;以及与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行如第一方面描述的方法。According to a third aspect, an electronic device is provided, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor. The at least one processor executes to enable the at least one processor to perform the method as described in the first aspect.

根据第四方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,计算机指令用于使计算机执行如第一方面描述的方法。According to a fourth aspect, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method as described in the first aspect.

根据本申请的技术解决了现有的数据导入方法占用磁盘量大,导致导入效率低的问题,实现了按照目标导入顺序进行数据导入,提高了数据导入的效率。The technology according to the present application solves the problem that the existing data import method occupies a large amount of disk, resulting in low import efficiency, realizes data import according to the target import sequence, and improves the efficiency of data import.

应当理解,本部分所描述的内容并非旨在标识本申请的实施例的关键或重要特征,也不用于限制本申请的范围。本申请的其它特征将通过以下的说明书而变得容易理解。It should be understood that the content described in this section is not intended to identify key or critical features of the embodiments of the application, nor is it intended to limit the scope of the application. Other features of the present application will become readily understood from the following description.

附图说明Description of drawings

附图用于更好地理解本方案,不构成对本申请的限定。其中:The accompanying drawings are used for better understanding of the present solution, and do not constitute a limitation to the present application. in:

图1是本申请的一个实施例可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present application may be applied;

图2是根据本申请的用于导入数据的方法的一个实施例的流程图;Figure 2 is a flowchart of one embodiment of a method for importing data according to the present application;

图3是图2所示实施例中至少一个目标节点与至少一个目标节点之间的有向边的示意图;3 is a schematic diagram of a directed edge between at least one target node and at least one target node in the embodiment shown in FIG. 2;

图4是根据本申请的用于导入数据的方法的一个应用场景的示意图;4 is a schematic diagram of an application scenario of the method for importing data according to the present application;

图5是根据本申请的用于导入数据的方法的又一个实施例的流程图;Figure 5 is a flowchart of yet another embodiment of a method for importing data according to the present application;

图6是根据本申请的用于导入数据的装置的一个实施例的结构示意图;6 is a schematic structural diagram of an embodiment of an apparatus for importing data according to the present application;

图7是适于用来实现本申请的实施例的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present application.

具体实施方式Detailed ways

以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted from the following description for clarity and conciseness.

图1示出了可以应用本申请的用于导入数据的方法或用于导入数据的装置的示例性架构100。FIG. 1 shows an exemplary architecture 100 to which the method for importing data or the apparatus for importing data of the present application may be applied.

如图1所示,系统架构100可以包括服务器101、网络102、源数据库服务器103和目标数据库服务器104。网络102用以在服务器101和源数据库服务器103、目标数据库服务器104之间提供通信链路的介质。网络102可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , the system architecture 100 may include a server 101 , a network 102 , a source database server 103 and a target database server 104 . The network 102 is a medium used to provide a communication link between the server 101 and the source database server 103 and the target database server 104 . The network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.

源数据库服务器103可以部署源数据库,可以是向服务器101提供数据支持的数据库服务器。源数据库可以是一个存储设备,可以存储至少一个目标节点,以及至少一个目标节点之间的有向边,目标节点可以表示目标实体,有向边可以表示目标实体之间的关联关系。服务器101可以通过网络102从源数据库服务器103处获取至少一个目标节点,以及至少一个目标节点之间的有向边。The source database server 103 may deploy the source database, which may be a database server that provides data support to the server 101 . The source database can be a storage device, which can store at least one target node and a directed edge between at least one target node, the target node can represent the target entity, and the directed edge can represent the association relationship between the target entities. The server 101 can obtain at least one target node and a directed edge between the at least one target node from the source database server 103 through the network 102 .

服务器101可以根据有向边连接的两个目标节点的原始标识信息,依次导入至少一个目标节点的内部标识信息。The server 101 may sequentially import the internal identification information of at least one target node according to the original identification information of the two target nodes connected by the directed edge.

目标数据库服务器104可以部署目标数据库。服务器101可以通过网络102将有向边的连接的两个目标节点的内部标识信息以及有向边存储在目标数据库中。目标数据库可以是图数据库,服务器101还可以根据图数据库中存储的数据生成知识图谱。The target database server 104 may deploy the target database. The server 101 may store the internal identification information of the two target nodes connected by the directed edge and the directed edge in the target database through the network 102 . The target database can be a graph database, and the server 101 can also generate a knowledge graph according to the data stored in the graph database.

需要说明的是,本申请实施例所提供的用于导入数据的方法一般由服务器101执行,相应地,用于导入数据的装置一般设置于服务器101中。It should be noted that the method for importing data provided by the embodiments of the present application is generally executed by the server 101 , and correspondingly, the apparatus for importing data is generally set in the server 101 .

应该理解,图1中的服务器、网络、源数据库服务器和目标数据库服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的服务器、网络、源数据库服务器和目标数据库服务器。It should be understood that the numbers of servers, networks, source database servers, and target database servers in FIG. 1 are merely illustrative. There can be any number of servers, networks, source database servers, and target database servers, depending on the implementation needs.

继续参考图2,示出了根据本申请的用于导入数据的方法的一个实施例的流程200。该用于导入数据的方法包括以下步骤:With continued reference to FIG. 2, a flow 200 of one embodiment of a method for importing data according to the present application is shown. The method for importing data includes the following steps:

步骤201,获取至少一个目标节点以及至少一个目标节点之间的有向边。Step 201: Obtain at least one target node and a directed edge between at least one target node.

在本实施例中,上述用于导入数据的方法的执行主体(例如图1所示的服务器101)可以从图数据库中获取至少一个目标节点与上述至少一个目标节点之间的有向边。在这里,目标节点可以用来表示目标实体,例如人、动物、物体、地点等,有向边可以用来表示目标实体之间的关联关系。可以理解的是,目标节点及各目标节点之间的有向边可以为源数据库(例如图1所示的源数据库服务器103部署的源数据库)中待导入目标图数据库(例如图1所示的目标数据库服务器104部署的目标数据库)中的数据。In this embodiment, the execution body of the above-mentioned method for importing data (for example, the server 101 shown in FIG. 1 ) may obtain a directed edge between at least one target node and the above-mentioned at least one target node from a graph database. Here, target nodes can be used to represent target entities, such as people, animals, objects, places, etc., and directed edges can be used to represent associations between target entities. It can be understood that the target node and the directed edges between the target nodes may be the target graph database to be imported in the source database (for example, the source database deployed by the source database server 103 shown in FIG. 1 ) (for example, as shown in FIG. 1 ). data in the target database deployed by the target database server 104).

步骤202,获取至少一个目标节点的原始标识信息和内部标识信息。Step 202: Acquire original identification information and internal identification information of at least one target node.

在本实施例中,上述执行主体可以从至少一个目标节点的标识映射关系中获取至少一个目标节点原始标识信息和内部标识信息。在这里,原始标识信息可以是目标节点所对应的目标实体在源数据库中存储时的标识信息。内部标识信息可以是目标实体在目标数据库中存储时的标识信息。内部标识信息可以是为了便于后续查询的定长的标识信息,例如数字标识1、2、3、4。内部标识可以是执行主体预先生成的,也可以是其它电子设备根据各目标节点的原始标识信息生成的。各目标节点的内部标识信息之间可以具有一定的关系,例如各内部标识信息可以形成递增序列。In this embodiment, the above-mentioned execution body may acquire the original identification information and internal identification information of at least one target node from the identification mapping relationship of at least one target node. Here, the original identification information may be the identification information of the target entity corresponding to the target node when it is stored in the source database. The internal identification information may be the identification information of the target entity when it is stored in the target database. The internal identification information may be fixed-length identification information for the convenience of subsequent inquiries, such as digital identifications 1, 2, 3, and 4. The internal identification may be pre-generated by the execution body, or may be generated by other electronic devices according to the original identification information of each target node. The internal identification information of each target node may have a certain relationship, for example, each internal identification information may form an increasing sequence.

步骤203,确定各有向边的目标导入顺序。Step 203: Determine the target import sequence of each directed edge.

在本实施例中,上述执行主体可以通过多种方式确定各有向边的导入顺序。例如,对各有向边进行随机排列,确定各有向边的目标导入顺序。在导入数据时,上述执行主体需要先将要导入的数据读取到内存,然后由内存中将数据写入目标数据库。可以理解的是,当内存的容量有限,并且需要导入多个有向边时,不同的导入顺序可能会带来不同的内存读取代价。因此,本实施例需要确定出目标导入顺序。In this embodiment, the above-mentioned execution body may determine the import sequence of each directed edge in various ways. For example, randomize each directed edge to determine the target import order of each directed edge. When importing data, the above-mentioned execution body needs to read the data to be imported into the memory first, and then write the data into the target database from the memory. It is understandable that when the memory capacity is limited and multiple directed edges need to be imported, different import orders may bring different memory read costs. Therefore, in this embodiment, the target import sequence needs to be determined.

在本实施的一些可选的实现方式中,上述步骤203具体可以通过以下步骤来实现:确定各目标节点连接的有向边的个数;根据各目标节点连接的有向边的个数以及各目标节点连接的有向边,确定各至少一个目标节点以及有向边的导入顺序。In some optional implementation manners of this implementation, the above step 203 can be specifically implemented by the following steps: determining the number of directed edges connected to each target node; Directed edges connected by target nodes, determine at least one target node and the import order of directed edges.

在该可选实现方式中,上述执行主体可以先确定各目标节点连接的有向边的个数,然后按照各目标节点连接的有向边的个数的数量,从多到少对各目标节点进行排列,再按照各目标节点的排列顺序,依次排列各目标节点连接的有向边,确定各有向边的导入顺序。In this optional implementation manner, the above-mentioned execution body may first determine the number of directed edges connected to each target node, and then, according to the number of directed edges connected to each target node, perform the task for each target node in descending order. Arrangement is performed, and then according to the arrangement order of each target node, the directed edges connected to each target node are sequentially arranged, and the import sequence of each directed edge is determined.

图3是图2所示实施例中至少一个目标节点与至少一个目标节点之间的有向边的示意图。在图3中,目标节点可以为T1、T2、T3、T4,有向边L1连接目标节点T1、T2,有向边L2连接目标节点T1、T4,有向边L3连接目标节点T1、T3,有向边L4连接目标节点T3、T4,则目标节点T1连接的有向边的个数的数量为3(有向边L1、L2、L3),目标节点T2连接的有向边的个数的数量为1(有向边L1),目标节点T3连接的有向边的个数的数量为2(有向边L3、L4),目标节点T4连接的有向边的个数的数量为2(有向边L2、L4),那么各目标节点的排列顺序为T1、T3、T4、T2,或者T1、T4、T3、T2,各有向边的导入顺序为L1、L2、L3、L4,或者L2、L1、L3、L4,或者L3、L1、L2、L4等。FIG. 3 is a schematic diagram of a directed edge between at least one target node and at least one target node in the embodiment shown in FIG. 2 . In Figure 3, the target nodes can be T1, T2, T3, T4, the directed edge L1 connects the target nodes T1, T2, the directed edge L2 connects the target nodes T1, T4, and the directed edge L3 connects the target nodes T1, T3, The directed edge L4 connects the target nodes T3 and T4, then the number of directed edges connected to the target node T1 is 3 (directed edges L1, L2, L3), and the number of directed edges connected to the target node T2 is The number is 1 (directed edge L1), the number of directed edges connected to the target node T3 is 2 (directed edges L3, L4), and the number of directed edges connected to the target node T4 is 2 ( directed edges L2, L4), then the order of each target node is T1, T3, T4, T2, or T1, T4, T3, T2, and the import order of each directed edge is L1, L2, L3, L4, or L2, L1, L3, L4, or L3, L1, L2, L4, etc.

通过该实现方式确定出的目标导入顺序,在导入数据时可以优先导入关联关系较多的目标节点,在导入这些目标节点时不需要频繁的读取内存,从而提高了数据导入的效率。The target import sequence determined by this implementation method can preferentially import target nodes with more associations when importing data, and does not need to read memory frequently when importing these target nodes, thereby improving the efficiency of data importing.

步骤204,根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。Step 204: Import the internal identification information of at least one target node in sequence according to the original identification information of the two target nodes connected by the directed edge and the target import sequence.

在本实施例中,上述执行主体可以根据有向边连接的两个目标节点的原始标识信息,确定出对应的有向边,然后再根据最终确定出的目标导入顺序,依次将各有向边连接的两个目标节点的原始标识信息替换为内部标识信息。In this embodiment, the above-mentioned execution body may determine the corresponding directed edges according to the original identification information of the two target nodes connected by the directed edges, and then sequentially load the directed edges according to the finally determined target import sequence. The original identification information of the two connected target nodes is replaced with the internal identification information.

在本实施的一些可选的实现方式中,上述方法还可以进一步包括图2中未示出的以下步骤:根据各有向边连接的两个目标节点的实体类型,对至少一个目标节点以及各有向边进行存储。In some optional implementations of the present implementation, the above method may further include the following steps not shown in FIG. 2 : according to the entity types of the two target nodes connected by each directional edge, for the at least one target node and each Directed edges are stored.

在该可选实现方式中,上述执行主体可以先确定至少一个目标节点的实体类型,然后按照有向边连接的两个目标节点的实体类型,对有向边进行存储。例如有向边L1连接的目标节点T1的实体类型为人、目标节点T2的实体类型为书,有向边L2连接的目标节点T1的实体类型为人、目标节点T3的实体类型为动物,则上述执行主体可以先将目标节点T1的原始标识信息与内部标识信息、T2的原始标识信息与内部标识信息加载至内存,进行有向边L1的导入,在完成有向边L1的导入后,再将目标节点T3的原始标识信息与内部标识信息加载至内存,进行有向边L2的导入。In this optional implementation manner, the above-mentioned execution body may first determine the entity type of at least one target node, and then store the directed edge according to the entity types of the two target nodes connected by the directed edge. For example, the entity type of the target node T1 connected by the directed edge L1 is human, the entity type of the target node T2 is book, the entity type of the target node T1 connected by the directed edge L2 is human, and the entity type of the target node T3 is animal, then the above execution The main body can first load the original identification information and internal identification information of the target node T1 and the original identification information and internal identification information of T2 into the memory, and import the directed edge L1. The original identification information and internal identification information of the node T3 are loaded into the memory, and the directed edge L2 is imported.

现有的一些数据导入方法,需要将所有的需要导入的节点的标识之间的映射关系保存在执行主体的内存中。当需要导入的节点的数量较大时,容易导致内存不足,就需要借助外部存储。外部存储的读取性能远低于内存的读取性能,这样导致执行主体在读取节点时需要花费更多的时间。还有一些现有的数据导入方法,将需要导入的各节点以及各节点之间的边都保存在磁盘中,并根据标识进行混合排序。导致执行主体严重依赖磁盘的读写性能和主存的排序性能。当需要导入的节点的数量较大时,也会降低导入效率。In some existing data import methods, the mapping relationship between the identifiers of all nodes to be imported needs to be stored in the memory of the execution body. When the number of nodes to be imported is large, it is easy to cause insufficient memory, and external storage is required. The read performance of external storage is much lower than that of memory, which causes the execution subject to spend more time reading nodes. There are also some existing data import methods, which save each node to be imported and the edges between each node in the disk, and perform mixed sorting according to the identifier. As a result, the execution body relies heavily on the read and write performance of the disk and the sorting performance of the main memory. When the number of nodes to be imported is large, the import efficiency will also be reduced.

通过该实现方式,通过将各目标节点以及有向边按照类型来存储。在导入数据时,只需将两类实体类型对应的两个目标节点的标识映射关系加载至内存。在导入完成后,再将新的实体类型对应的标识映射关系加载至内存。从而不需要将全部目标节点的标识映射关系加载至内存,实现了在内存有限、不借助外部存储的情况下,完成数据的导入。Through this implementation, each target node and directed edges are stored by type. When importing data, it is only necessary to load the identity mapping relationship of the two target nodes corresponding to the two types of entity types into the memory. After the import is completed, the identity mapping relationship corresponding to the new entity type is loaded into the memory. Therefore, it is not necessary to load the identification mapping relationship of all target nodes into the memory, so that the data import can be completed under the condition of limited memory and no external storage.

继续参考图4,图4是根据本申请的用于导入数据的方法的一个应用场景的示意图。在图4的应用场景中,上述执行主体401可以获取源数据库服务器402发送的至少一个目标节点(T1、T2、T3、T4)、至少一个目标节点之间的有向边(L1、L2、L3、L4)、以及目标节点的原始标识信息(T1、T2、T3、T4)与内部标识信息(1、2、3、4)之间的映射关系(T1对应1、T2对应2、T3对应3、T4对应4)。403表示各有向边的连接的两个目标节点。上述执行主体401确定各有向边的目标导入顺序404,然后根据目标导入顺序404,依次导入至少一个目标节点的内部标识信息。405为数据的导入结果。Continuing to refer to FIG. 4 , FIG. 4 is a schematic diagram of an application scenario of the method for importing data according to the present application. In the application scenario of FIG. 4 , the above-mentioned execution body 401 can obtain at least one target node (T1, T2, T3, T4) and at least one directed edge (L1, L2, L3) between the target nodes sent by the source database server 402 , L4), and the mapping relationship between the original identification information (T1, T2, T3, T4) of the target node and the internal identification information (1, 2, 3, 4) (T1 corresponds to 1, T2 corresponds to 2, T3 corresponds to 3 , T4 corresponds to 4). 403 represents two target nodes connected by each directed edge. The above-mentioned execution body 401 determines the target import sequence 404 of each directed edge, and then sequentially imports the internal identification information of at least one target node according to the target import sequence 404 . 405 is the import result of the data.

本公开的上述实施例提供的用于导入数据的方法,通过获取至少一个目标节点以及至少一个目标节点之间的有向边、以及至少一个目标节点的原始标识信息和内部标识信息,然后确定各有向边的目标导入顺序,最后根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。该方法按照目标导入顺序进行数据导入,提高了数据导入的效率。The method for importing data provided by the above-mentioned embodiments of the present disclosure includes acquiring at least one target node, a directed edge between at least one target node, and the original identification information and internal identification information of at least one target node, and then determining each target node. The target import sequence of the directed edge, and finally, according to the original identification information of the two target nodes connected by the directed edge and the target import sequence, the internal identification information of at least one target node is sequentially imported. The method performs data import according to the target import sequence, which improves the efficiency of data import.

继续参考图5,示出了根据本申请的用于导入数据的方法的又一个实施例的流程500。该用于导入数据的方法包括以下步骤:Continuing to refer to FIG. 5, a flow 500 of yet another embodiment of a method for importing data according to the present application is shown. The method for importing data includes the following steps:

步骤501,获取至少一个目标节点以及至少一个目标节点之间的有向边。Step 501: Obtain at least one target node and a directed edge between at least one target node.

步骤502,获取至少一个目标节点的原始标识信息和内部标识信息。Step 502: Acquire original identification information and internal identification information of at least one target node.

上述步骤501、步骤502分别与前述实施例中的步骤201、步骤202一致,上文针对步骤201、步骤202的描述也适用于步骤501、步骤502,此处不再赘述。The above steps 501 and 502 are respectively consistent with the steps 201 and 202 in the foregoing embodiments. The above descriptions of the steps 201 and 202 are also applicable to the steps 501 and 502, and are not repeated here.

步骤503,对各有向边进行全排序,确定出候选导入顺序。Step 503: Perform full sorting on each directed edge to determine the candidate import sequence.

在本实施例中,上述执行主体可以有向边进行全排序,确定候选导入顺序。例如,有向边为L1、L2、L3,则候选导入顺序可以为L1、L2、L3,L1、L3、L2,L2、L1、L3,L2、L3、L3,L3、L1、L2,L3、L2、L1。In this embodiment, the above-mentioned execution body may perform full sorting on directed edges to determine the import sequence of candidates. For example, if the directed edges are L1, L2, L3, the candidate import order can be L1, L2, L3, L1, L3, L2, L2, L1, L3, L2, L3, L3, L3, L1, L2, L3, L2, L1.

步骤504,确定每个候选导入顺序对应的内存读取代价。Step 504: Determine the memory read cost corresponding to each candidate import sequence.

在本实施例中,上述执行主体可以确定每个候选导入顺序对应的内存读取代价。在这里,内存读取代价可以指占用内存的时间值,或者内存的使用量。In this embodiment, the above-mentioned execution body may determine the memory read cost corresponding to each candidate import sequence. Here, the memory read cost can refer to the time value of occupying memory, or the amount of memory used.

在本实施的一些可选的实现方式中,还可以通过以下步骤确定每个候选导入顺序对应的内存读取代价:将每个有向边连接的两个目标节点作为该有向边对应的节点集合;对于每个候选导入顺序,根据该候选导入顺序中相邻两个有向边对应的节点集合的差集,确定每个候选导入顺序对应的内存读取代价。In some optional implementation manners of this implementation, the memory read cost corresponding to each candidate import sequence may also be determined by the following steps: take the two target nodes connected by each directed edge as the node corresponding to the directed edge Set; for each candidate import order, determine the memory read cost corresponding to each candidate import order according to the difference set of the node sets corresponding to two adjacent directed edges in the candidate import order.

在该可选实现方式中,上述执行主体可以将每个有向边连接的两个目标节点作为该有向边对应的节点集合,然后确定出候选导入顺序中相邻两个有向边对应的节点集合的差集,再基于相邻两个有向边对应的节点集合的差集,确定出该候选导入顺序对应的内存读取代价。In this optional implementation manner, the above-mentioned execution body may take the two target nodes connected by each directed edge as the node set corresponding to the directed edge, and then determine the corresponding nodes corresponding to two adjacent directed edges in the candidate import sequence. The difference set of the node set, and then based on the difference set of the node sets corresponding to two adjacent directed edges, the memory read cost corresponding to the candidate import order is determined.

例如,候选导入顺序为L1、L2、L3、L4,有向边L1对应的节点集合为(T1,T2),有向边L1对应的节点集合为(T2,T3),与有向边L1相邻的有向边L2对应的节点集合的差集为(T1,T3)。上述执行主体可以预先设置各有向边的导入顺序对应的内存读取代价的计算公式:For example, the candidate import sequence is L1, L2, L3, L4, the node set corresponding to the directed edge L1 is (T1, T2), the node set corresponding to the directed edge L1 is (T2, T3), and the node set corresponding to the directed edge L1 is (T2, T3). The difference set of the node sets corresponding to the adjacent directed edge L2 is (T1, T3). The above execution body can preset the calculation formula of the memory read cost corresponding to the import order of each directed edge:

Figure BDA0002463092080000081
Figure BDA0002463092080000081

其中,n表示有向边对应的节点集合的数量,W表示内存读取代价,W1表示候选导入顺序中第一个有向边对应的内存读取代价(一般为2M,M表示一个目标节点对应的平均内存读取代价),Ei表示有向边i对应的节点集合,|Ei+1-Ei|表示差集中的目标节点的数量的绝对值。Among them, n represents the number of node sets corresponding to the directed edge, W represents the memory read cost, and W1 represents the memory read cost corresponding to the first directed edge in the candidate import sequence (usually 2M, M represents a target node corresponding to The average memory read cost of ), E i represents the node set corresponding to the directed edge i, and |E i+1 -E i | represents the absolute value of the number of target nodes in the difference set.

该实现方式可以基于上述内存读取代价的计算公式,快速确定出每个候选导入顺序对应的内存读取代价。In this implementation manner, the memory read cost corresponding to each candidate import sequence can be quickly determined based on the above-mentioned calculation formula of the memory read cost.

步骤505,根据内存读取代价,从候选导入顺序中确定出目标导入顺序。Step 505: Determine the target import sequence from the candidate import sequences according to the memory read cost.

在本实施例中,执行主体在确定各候选导入顺序对应的内存读取代价后,可以确定出目标导入顺序。例如,上述执行主体可以将内存读取代价最低的候选导入顺序,作为目标导入顺序。或者,执行主体可以将内存读取代价小于预设阈值的候选导入顺序作为目标导入顺序。In this embodiment, after determining the memory read cost corresponding to each candidate import order, the execution body can determine the target import order. For example, the above-mentioned execution body may use the candidate import order with the lowest memory read cost as the target import order. Alternatively, the execution body may use the candidate import order whose memory read cost is less than the preset threshold as the target import order.

步骤506,根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。Step 506: Import the internal identification information of at least one target node in sequence according to the original identification information of the two target nodes connected by the directed edge and the target import sequence.

上述步骤506分别与前述实施例中的步骤204一致,上文针对步骤204的描述也适用于步骤506,此处不再赘述。The foregoing step 506 is respectively consistent with the step 204 in the foregoing embodiment, and the above description of the step 204 is also applicable to the step 506, and details are not repeated here.

本实施例中的用于导入数据的方法的流程图500,说明了另外一种确定各有向边的目标导入顺序的方法,通过确定各候选导入顺序的对应的内存读取代价,选择内存读取代价最低的候选导入顺序,作为目标导入顺序,提高了数据导入的效率。The flowchart 500 of the method for importing data in this embodiment illustrates another method for determining the target import order of each directed edge. By determining the corresponding memory read cost of each candidate import order, select the memory read The candidate import sequence with the lowest price is replaced as the target import sequence, which improves the efficiency of data import.

进一步参考图6,作为对上述各图所示方法的实现,本申请提供了用于导入数据的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Referring further to FIG. 6 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of an apparatus for importing data. The apparatus embodiment corresponds to the method embodiment shown in FIG. 2 . Can be applied to various electronic devices.

如图6所示,本实施例提供的用于导入数据的装置600包括第一获取单元601、第二获取单元602、确定单元603以及导入单元604。其中,第一获取单元601,被配置成获取至少一个目标节点以及至少一个目标节点之间的有向边;第二获取单元602,被配置成获取至少一个目标节点的原始标识信息和内部标识信息;确定单元603,被配置成确定各有向边的目标导入顺序;导入单元604,被配置成根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。As shown in FIG. 6 , the apparatus 600 for importing data provided in this embodiment includes a first acquiring unit 601 , a second acquiring unit 602 , a determining unit 603 , and an importing unit 604 . Wherein, the first obtaining unit 601 is configured to obtain at least one target node and a directed edge between at least one target node; the second obtaining unit 602 is configured to obtain the original identification information and internal identification information of at least one target node Determining unit 603 is configured to determine the target import sequence of each directed edge; Import unit 604 is configured to import at least one target node successively according to the original identification information of the two target nodes connected by directed edges and the target import sequence internal identification information.

在本实施例中,用于导入数据的装置600中:第一获取单元601、第二获取单元602、确定单元603以及导入单元604的具体处理及其所带来的技术效果可分别参考图2对应实施例中的步骤201、步骤202、步骤203和步骤204的相关说明,在此不再赘述。In this embodiment, in the apparatus 600 for importing data: the specific processing of the first acquiring unit 601, the second acquiring unit 602, the determining unit 603 and the importing unit 604 and the technical effects brought by them can be referred to FIG. 2 respectively. Corresponding descriptions of step 201, step 202, step 203, and step 204 in the embodiment are not repeated here.

在本实施例的一些可选的实现方式中,第二获取单元602进一步被配置成通过以下模块确定各有向边的目标导入顺序:第一确定模块,被配置成确定各目标节点连接的有向边的个数;第二确定模块,被配置成根据各目标节点连接的有向边的个数以及各目标节点连接的有向边,确定各有向边的导入顺序。In some optional implementations of this embodiment, the second obtaining unit 602 is further configured to determine the target import sequence of each directed edge through the following modules: a first determining module, configured to determine the target nodes connected to each target node. The number of directed edges; the second determining module is configured to determine the import sequence of each directed edge according to the number of directed edges connected to each target node and the directed edges connected to each target node.

在本实施例的一些可选的实现方式中,第二获取单元602进一步被配置成通过以下模块确定各有向边的目标导入顺序:第三确定模块,被配置成对各有向边进行全排序,确定出候选导入顺序;第四确定模块,被配置成确定每个候选导入顺序对应的内存读取代价;第五确定模块,被配置成根据内存读取代价,从候选导入顺序中确定出目标导入顺序。In some optional implementations of this embodiment, the second obtaining unit 602 is further configured to determine the target import sequence of each directional edge through the following modules: a third determining module, configured to perform a full operation on each directional edge. Sorting, to determine the candidate import order; the fourth determination module, configured to determine the memory read cost corresponding to each candidate import order; the fifth determination module, configured to determine from the candidate import order according to the memory read cost Target import order.

在本实施例的一些可选的实现方式中,第四确定模块进一步被配置成:将每个有向边连接的两个目标节点作为该有向边对应的节点集合;对于每个候选导入顺序,根据该候选导入顺序中相邻两个有向边对应的节点集合的差集,确定每个候选导入顺序对应的内存读取代价。In some optional implementations of this embodiment, the fourth determining module is further configured to: take the two target nodes connected by each directed edge as the node set corresponding to the directed edge; for each candidate import sequence , according to the difference set of the node sets corresponding to two adjacent directed edges in the candidate import sequence, determine the memory read cost corresponding to each candidate import sequence.

在本实施例的一些可选的实现方式中,装置还包括:存储单元(图中未示出),被配置成根据各有向边连接的两个目标节点的实体类型,对至少一个目标节点以及各有向边进行存储。In some optional implementations of this embodiment, the apparatus further includes: a storage unit (not shown in the figure), configured to store at least one target node according to the entity types of the two target nodes connected by each directed edge And each directed edge is stored.

本申请的上述实施例提供的装置,通过第一获取单元601获取至少一个目标节点以及至少一个目标节点之间的有向边,然后通过第二获取单元602获取至少一个目标节点的原始标识信息和内部标识信息,确定单元603确定各有向边的目标导入顺序,导入单元604根据有向边连接的两个目标节点的原始标识信息以及目标导入顺序,依次导入至少一个目标节点的内部标识信息。该装置可以按照目标导入顺序进行数据导入,提高了数据导入的效率。In the apparatus provided by the above-mentioned embodiments of the present application, the first obtaining unit 601 obtains at least one target node and a directed edge between the at least one target node, and then the second obtaining unit 602 obtains the original identification information of the at least one target node and the For the internal identification information, the determining unit 603 determines the target import sequence of each directed edge, and the import unit 604 sequentially imports the internal identification information of at least one target node according to the original identification information and target import sequence of the two target nodes connected by the directed edge. The device can perform data importing according to the target importing sequence, which improves the efficiency of data importing.

根据本申请的实施例,本申请还提供了一种电子设备和一种可读存储介质。According to the embodiments of the present application, the present application further provides an electronic device and a readable storage medium.

如图7所示,是根据本申请实施例的用于导入数据的方法的电子设备的框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。As shown in FIG. 7 , it is a block diagram of an electronic device for a method for importing data according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are by way of example only, and are not intended to limit implementations of the application described and/or claimed herein.

如图7所示,该电子设备包括:一个或多个处理器701、存储器702,以及用于连接各部件的接口,包括高速接口和低速接口。各个部件利用不同的总线互相连接,并且可以被安装在公共主板上或者根据需要以其它方式安装。处理器可以对在电子设备内执行的指令进行处理,包括存储在存储器中或者存储器上以在外部输入/输出装置(诸如,耦合至接口的显示设备)上显示GUI的图形信息的指令。在其它实施方式中,若需要,可以将多个处理器和/或多条总线与多个存储器和多个存储器一起使用。同样,可以连接多个电子设备,各个设备提供部分必要的操作(例如,作为服务器阵列、一组刀片式服务器、或者多处理器系统)。图7中以一个处理器701为例。As shown in FIG. 7 , the electronic device includes: one or more processors 701 , a memory 702 , and interfaces for connecting various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or otherwise as desired. The processor may process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used with multiple memories and multiple memories, if desired. Likewise, multiple electronic devices may be connected, each providing some of the necessary operations (eg, as a server array, a group of blade servers, or a multiprocessor system). A processor 701 is taken as an example in FIG. 7 .

存储器702即为本申请所提供的非瞬时计算机可读存储介质。其中,存储器存储有可由至少一个处理器执行的指令,以使至少一个处理器执行本申请所提供的用于导入数据的方法。本申请的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本申请所提供的用于导入数据的方法。The memory 702 is the non-transitory computer-readable storage medium provided by the present application. Wherein, the memory stores instructions executable by at least one processor, so that the at least one processor executes the method for importing data provided by the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to perform the method for importing data provided by the present application.

存储器702作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本申请实施例中的用于导入数据的方法对应的程序指令/模块(例如,附图6所示的第一获取单元601、第二获取单元602、确定单元603、导入单元604)。处理器701通过运行存储在存储器702中的非瞬时软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的用于导入数据的方法。As a non-transitory computer-readable storage medium, the memory 702 can be used to store non-transitory software programs, non-transitory computer-executable programs and modules, such as program instructions/modules ( For example, the first acquiring unit 601, the second acquiring unit 602, the determining unit 603, and the importing unit 604 shown in FIG. 6). The processor 701 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions and modules stored in the memory 702, that is, implementing the method for importing data in the above method embodiments.

存储器702可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据用于导入数据的电子设备的使用所创建的数据等。此外,存储器702可以包括高速随机存取存储器,还可以包括非瞬时存储器,例如至少一个磁盘存储器件、闪存器件、或其他非瞬时固态存储器件。在一些实施例中,存储器702可选包括相对于处理器701远程设置的存储器,这些远程存储器可以通过网络连接至用于导入数据的电子设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 702 may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function; the stored data area may store data created according to the use of the electronic device for importing the data Wait. Additionally, memory 702 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 702 may optionally include memory located remotely from processor 701 that may be connected via a network to an electronic device for importing data. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

用于导入数据的方法的电子设备还可以包括:输入装置703和输出装置704。处理器701、存储器702、输入装置703和输出装置704可以通过总线或者其他方式连接,图7中以通过总线连接为例。The electronic device for the method of importing data may further include: an input device 703 and an output device 704 . The processor 701 , the memory 702 , the input device 703 and the output device 704 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 7 .

输入装置703可接收输入的数字或字符信息,以及产生与用于导入数据的电子设备的用户设置以及功能控制有关的键信号输入,例如触摸屏、小键盘、鼠标、轨迹板、触摸板、指示杆、一个或者多个鼠标按钮、轨迹球、操纵杆等输入装置。输出装置704可以包括显示设备、辅助照明装置(例如,LED)和触觉反馈装置(例如,振动电机)等。该显示设备可以包括但不限于,液晶显示器(LCD)、发光二极管(LED)显示器和等离子体显示器。在一些实施方式中,显示设备可以是触摸屏。The input device 703 can receive input numerical or character information, and generate key signal input related to user settings and function control of the electronic device for importing data, such as touch screen, keypad, mouse, trackpad, touchpad, pointing stick , one or more mouse buttons, trackballs, joysticks and other input devices. Output devices 704 may include display devices, auxiliary lighting devices (eg, LEDs), haptic feedback devices (eg, vibration motors), and the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.

此处描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、专用ASIC(专用集成电路)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described herein can be implemented in digital electronic circuitry, integrated circuit systems, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpretable on a programmable system including at least one programmable processor that The processor, which may be a special purpose or general-purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device an output device.

这些计算程序(也称作程序、软件、软件应用、或者代码)包括可编程处理器的机器指令,并且可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。如本文使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/或数据提供给可编程处理器的任何信号。These computational programs (also referred to as programs, software, software applications, or codes) include machine instructions for programmable processors, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages calculation program. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or apparatus for providing machine instructions and/or data to a programmable processor ( For example, magnetic disks, optical disks, memories, programmable logic devices (PLDs), including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on a computer having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user ); and a keyboard and pointing device (eg, a mouse or trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (eg, visual feedback, auditory feedback, or tactile feedback); and can be in any form (including acoustic input, voice input, or tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein may be implemented on a computing system that includes back-end components (eg, as a data server), or a computing system that includes middleware components (eg, an application server), or a computing system that includes front-end components (eg, a user's computer having a graphical user interface or web browser through which a user may interact with implementations of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communication network). Examples of communication networks include: Local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。A computer system can include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other.

根据本申请实施例的技术方案,能够提高数据导入的效率。According to the technical solutions of the embodiments of the present application, the efficiency of data import can be improved.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, the steps described in the present application can be performed in parallel, sequentially or in different orders, and as long as the desired results of the technical solutions disclosed in the present application can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the protection scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of this application shall be included within the protection scope of this application.

Claims (12)

1.一种用于导入数据的方法,包括:1. A method for importing data, comprising: 获取至少一个目标节点以及所述至少一个目标节点之间的有向边;obtaining at least one target node and a directed edge between the at least one target node; 获取所述至少一个目标节点的原始标识信息和内部标识信息;Obtain the original identification information and internal identification information of the at least one target node; 确定各所述有向边的目标导入顺序;determining the target import order of each of the directed edges; 根据所述有向边连接的两个目标节点的原始标识信息以及所述目标导入顺序,依次导入所述至少一个目标节点的内部标识信息。According to the original identification information of the two target nodes connected by the directed edge and the target import sequence, the internal identification information of the at least one target node is sequentially imported. 2.根据权利要求1所述的方法,其中,所述确定各所述有向边的目标导入顺序,包括:2. The method according to claim 1, wherein the determining the target import order of each of the directed edges comprises: 确定所述各目标节点连接的有向边的个数;Determine the number of directed edges connected to each target node; 根据所述各目标节点连接的有向边的个数以及各目标节点连接的有向边,确定各所述有向边的导入顺序。The import sequence of each directed edge is determined according to the number of directed edges connected to each target node and the directed edges connected to each target node. 3.根据权利要求1所述的方法,其中,所述确定各所述有向边的目标导入顺序,包括:3. The method according to claim 1, wherein the determining the target import order of each of the directed edges comprises: 对各所述有向边进行全排序,确定出候选导入顺序;Perform full sorting on each of the directed edges to determine the candidate import sequence; 确定每个所述候选导入顺序对应的内存读取代价;determining the memory read cost corresponding to each of the candidate import sequences; 根据所述内存读取代价,从所述候选导入顺序中确定出所述目标导入顺序。The target import order is determined from the candidate import orders according to the memory read cost. 4.根据权利要求3所述的方法,其中,所述确定每个所述候选导入顺序对应的内存读取代价,包括:4. The method according to claim 3, wherein the determining the memory read cost corresponding to each of the candidate import sequences comprises: 将每个所述有向边连接的两个目标节点作为该有向边对应的节点集合;Taking the two target nodes connected by each directed edge as the node set corresponding to the directed edge; 对于每个所述候选导入顺序,根据该候选导入顺序中相邻两个有向边对应的节点集合的差集,确定每个所述候选导入顺序对应的内存读取代价。For each candidate import sequence, the memory read cost corresponding to each candidate import sequence is determined according to the difference set of node sets corresponding to two adjacent directed edges in the candidate import sequence. 5.根据权利要求1所述的方法,其中,所述方法还包括:5. The method of claim 1, wherein the method further comprises: 根据各所述有向边连接的两个目标节点的实体类型,对所述至少一个目标节点以及各所述有向边进行存储。The at least one target node and each of the directed edges are stored according to the entity types of the two target nodes connected by each of the directed edges. 6.一种用于导入数据的装置,包括:6. An apparatus for importing data, comprising: 第一获取单元,被配置成获取至少一个目标节点以及所述至少一个目标节点之间的有向边;a first obtaining unit, configured to obtain at least one target node and a directed edge between the at least one target node; 第二获取单元,被配置成获取所述至少一个目标节点的原始标识信息和内部标识信息;a second acquiring unit, configured to acquire original identification information and internal identification information of the at least one target node; 确定单元,被配置成确定各所述有向边的目标导入顺序;a determination unit configured to determine the target import order of each of the directed edges; 导入单元,被配置成根据所述有向边连接的两个目标节点的原始标识信息以及所述目标导入顺序,依次导入所述至少一个目标节点的内部标识信息。The import unit is configured to sequentially import the internal identification information of the at least one target node according to the original identification information of the two target nodes connected by the directed edge and the target import sequence. 7.根据权利要求6所述的装置,其中,所述第二获取单元进一步被配置成通过以下模块确定各所述有向边的目标导入顺序:7. The apparatus according to claim 6, wherein the second obtaining unit is further configured to determine the target import order of each of the directed edges by the following modules: 第一确定模块,被配置成确定所述各目标节点连接的有向边的个数;a first determining module, configured to determine the number of directed edges connected to each target node; 第二确定模块,被配置成根据所述各目标节点连接的有向边的个数以及各目标节点连接的有向边,确定各所述有向边的导入顺序。The second determining module is configured to determine the import sequence of each directed edge according to the number of directed edges connected to each target node and the directed edges connected to each target node. 8.根据权利要求6所述的装置,其中,所述第二获取单元进一步被配置成通过以下模块确定各所述有向边的目标导入顺序:8. The apparatus according to claim 6, wherein the second obtaining unit is further configured to determine the target import order of each of the directed edges by the following modules: 第三确定模块,被配置成对各所述有向边进行全排序,确定出候选导入顺序;The third determining module is configured to fully sort each of the directed edges, and determine the candidate import sequence; 第四确定模块,被配置成确定每个所述候选导入顺序对应的内存读取代价;a fourth determining module, configured to determine a memory read cost corresponding to each of the candidate import sequences; 第五确定模块,被配置成根据所述内存读取代价,从所述候选导入顺序中确定出所述目标导入顺序。A fifth determining module is configured to determine the target import order from the candidate import orders according to the memory read cost. 9.根据权利要求8所述的装置,其中,所述第四确定模块进一步被配置成:9. The apparatus of claim 8, wherein the fourth determination module is further configured to: 将每个所述有向边连接的两个目标节点作为该有向边对应的节点集合;Taking the two target nodes connected by each directed edge as the node set corresponding to the directed edge; 对于每个所述候选导入顺序,根据该候选导入顺序中相邻两个有向边对应的节点集合的差集,确定每个所述候选导入顺序对应的内存读取代价。For each candidate import sequence, the memory read cost corresponding to each candidate import sequence is determined according to the difference set of node sets corresponding to two adjacent directed edges in the candidate import sequence. 10.根据权利要求6所述的装置,其中,所述装置还包括:10. The apparatus of claim 6, wherein the apparatus further comprises: 存储单元,被配置成根据各所述有向边连接的两个目标节点的实体类型,对所述至少一个目标节点以及各所述有向边进行存储。The storage unit is configured to store the at least one target node and each of the directed edges according to the entity types of the two target nodes connected by each of the directed edges. 11.一种电子设备,包括:11. An electronic device comprising: 至少一个处理器;以及at least one processor; and 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-5中任一项所述的方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the execution of any of claims 1-5 Methods. 12.一种存储有计算机指令的非瞬时计算机可读存储介质,其特征在于,所述计算机指令用于使所述计算机执行权利要求1-5中任一项所述的方法。12. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method of any one of claims 1-5.
CN202010325575.6A 2020-04-23 2020-04-23 Method, apparatus, device and storage medium for importing data Active CN111523000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010325575.6A CN111523000B (en) 2020-04-23 2020-04-23 Method, apparatus, device and storage medium for importing data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010325575.6A CN111523000B (en) 2020-04-23 2020-04-23 Method, apparatus, device and storage medium for importing data

Publications (2)

Publication Number Publication Date
CN111523000A true CN111523000A (en) 2020-08-11
CN111523000B CN111523000B (en) 2023-06-23

Family

ID=71903197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010325575.6A Active CN111523000B (en) 2020-04-23 2020-04-23 Method, apparatus, device and storage medium for importing data

Country Status (1)

Country Link
CN (1) CN111523000B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527870A (en) * 2020-12-03 2021-03-19 北京百度网讯科技有限公司 Electronic report generation method and device, electronic equipment and storage medium
CN114356859A (en) * 2021-12-30 2022-04-15 中国电信股份有限公司 Data import method and apparatus, device, and computer-readable storage medium
CN115794917A (en) * 2022-11-24 2023-03-14 中国银行股份有限公司 Method and device for importing resource data

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130268565A1 (en) * 2012-04-05 2013-10-10 Fujitsu Limited Traversal Based Directed Graph Compaction
US20140244687A1 (en) * 2013-02-24 2014-08-28 Technion Research & Development Foundation Limited Processing query to graph database
CN104899156A (en) * 2015-05-07 2015-09-09 中国科学院信息工程研究所 Large-scale social network service-oriented graph data storage and query method
US20170329871A1 (en) * 2016-05-13 2017-11-16 Tibco Software Inc. Using a b-tree to store graph information in a database
CN108446359A (en) * 2018-03-12 2018-08-24 百度在线网络技术(北京)有限公司 Information recommendation method and device
CN108549731A (en) * 2018-07-11 2018-09-18 中国电子科技集团公司第二十八研究所 A kind of knowledge mapping construction method based on ontology model
CN108776684A (en) * 2018-05-25 2018-11-09 华东师范大学 Optimization method, device, medium, equipment and the system of side right weight in knowledge mapping
CN109446362A (en) * 2018-09-05 2019-03-08 北京费马科技有限公司 Chart database structure, diagram data storage method, device based on external memory
CN109522428A (en) * 2018-09-17 2019-03-26 华中科技大学 A kind of external memory access method of the figure computing system based on index positioning
CN109726305A (en) * 2018-12-30 2019-05-07 中国电子科技集团公司信息科学研究院 A method for storing and retrieving complex relational data based on graph structure
CN110825743A (en) * 2019-10-31 2020-02-21 北京百度网讯科技有限公司 Data importing method and device of graph database, electronic equipment and medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130268565A1 (en) * 2012-04-05 2013-10-10 Fujitsu Limited Traversal Based Directed Graph Compaction
US20140244687A1 (en) * 2013-02-24 2014-08-28 Technion Research & Development Foundation Limited Processing query to graph database
CN104899156A (en) * 2015-05-07 2015-09-09 中国科学院信息工程研究所 Large-scale social network service-oriented graph data storage and query method
US20170329871A1 (en) * 2016-05-13 2017-11-16 Tibco Software Inc. Using a b-tree to store graph information in a database
CN108446359A (en) * 2018-03-12 2018-08-24 百度在线网络技术(北京)有限公司 Information recommendation method and device
CN108776684A (en) * 2018-05-25 2018-11-09 华东师范大学 Optimization method, device, medium, equipment and the system of side right weight in knowledge mapping
CN108549731A (en) * 2018-07-11 2018-09-18 中国电子科技集团公司第二十八研究所 A kind of knowledge mapping construction method based on ontology model
CN109446362A (en) * 2018-09-05 2019-03-08 北京费马科技有限公司 Chart database structure, diagram data storage method, device based on external memory
CN109522428A (en) * 2018-09-17 2019-03-26 华中科技大学 A kind of external memory access method of the figure computing system based on index positioning
CN109726305A (en) * 2018-12-30 2019-05-07 中国电子科技集团公司信息科学研究院 A method for storing and retrieving complex relational data based on graph structure
CN110825743A (en) * 2019-10-31 2020-02-21 北京百度网讯科技有限公司 Data importing method and device of graph database, electronic equipment and medium

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
STEFAN NOTHAAS等: ""Distributed Multithreaded Breadth-First Search on Large Graphs Using DXGraph"", 《2016 HIGH PERFORMANCE GRAPH DATA MANAGEMENT AND PROCESSING WORKSHOP (HPGDMP)》 *
STEFAN NOTHAAS等: ""Distributed Multithreaded Breadth-First Search on Large Graphs Using DXGraph"", 《2016 HIGH PERFORMANCE GRAPH DATA MANAGEMENT AND PROCESSING WORKSHOP (HPGDMP)》, 26 January 2017 (2017-01-26) *
段文静: ""基于图的RDF数据存储与查询技术研究"", 《中国优秀硕士学位论文全文数据库》 *
段文静: ""基于图的RDF数据存储与查询技术研究"", 《中国优秀硕士学位论文全文数据库》, 15 November 2019 (2019-11-15) *
郭舒: "融合多类型信息的知识图谱表示学习", 《中国博士学位论文全文数据库》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112527870A (en) * 2020-12-03 2021-03-19 北京百度网讯科技有限公司 Electronic report generation method and device, electronic equipment and storage medium
CN112527870B (en) * 2020-12-03 2023-09-12 北京百度网讯科技有限公司 Electronic report generation method, device, electronic equipment and storage medium
CN114356859A (en) * 2021-12-30 2022-04-15 中国电信股份有限公司 Data import method and apparatus, device, and computer-readable storage medium
CN114356859B (en) * 2021-12-30 2025-09-23 中国电信股份有限公司 Data import method, device, equipment, and computer-readable storage medium
CN115794917A (en) * 2022-11-24 2023-03-14 中国银行股份有限公司 Method and device for importing resource data

Also Published As

Publication number Publication date
CN111523000B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
CN111522967B (en) Knowledge graph construction method, device, equipment and storage medium
CN112015775A (en) Label data processing method, device, equipment and storage medium
CN111582453A (en) Method and apparatus for generating neural network model
CN112084366A (en) Method, apparatus, device and storage medium for retrieving image
CN111639753A (en) Method, apparatus, device and storage medium for training a hyper-network
CN111582454A (en) Method and apparatus for generating neural network model
CN110619002A (en) Data processing method, device and storage medium
CN111737399A (en) Method, apparatus, electronic device, and readable storage medium for extending a question and answer set
CN111582374A (en) Hyper-parameter searching method, device, equipment and storage medium
CN110555486B (en) Model structure delay prediction method and device and electronic equipment
CN111523001A (en) Method, device, equipment and storage medium for storing data
CN112380104A (en) User attribute identification method and device, electronic equipment and storage medium
CN111523007A (en) User interest information determination method, device, equipment and storage medium
CN111523000B (en) Method, apparatus, device and storage medium for importing data
CN111488492A (en) Method and apparatus for retrieving graph database
CN111292223A (en) Processing method, device, electronic device and storage medium for graph computing
CN111461343A (en) Model parameter update method and related equipment
CN111782147A (en) Method and device for cluster expansion and contraction
CN112115313A (en) Regular expression generation, data extraction method, apparatus, equipment and medium
WO2022152015A1 (en) Front-end code generation method and apparatus
CN115222176A (en) Risk control methods, devices, equipment and media
CN111767321A (en) Method, device, electronic device and storage medium for determining node relationship network
CN111783950A (en) Model acquisition method, device, device and storage medium based on hypernetwork
CN112329732A (en) Model generation method and device, electronic equipment and storage medium
CN114676062B (en) Method and device for testing differential data of interface, electronic device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant