CN111104560B - Resource retrieval method and computer-readable storage medium - Google Patents
Resource retrieval method and computer-readable storage medium Download PDFInfo
- Publication number
- CN111104560B CN111104560B CN201811176796.0A CN201811176796A CN111104560B CN 111104560 B CN111104560 B CN 111104560B CN 201811176796 A CN201811176796 A CN 201811176796A CN 111104560 B CN111104560 B CN 111104560B
- Authority
- CN
- China
- Prior art keywords
- graph
- number set
- graph node
- engine
- resource
- 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.)
- Active
Links
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The invention discloses a resource retrieval method and a computer readable storage medium, wherein the method comprises the following steps: performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set; respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set; converting the second resource retrieval condition into an ES retrieval condition; searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set; respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set; and acquiring a resource list in a Titan graph engine according to the second graph node number set. The invention can solve the problem that the real-time response cannot be realized when the query result is larger.
Description
Technical Field
The present invention relates to the field of data retrieval technologies, and in particular, to a resource retrieval method and a computer-readable storage medium.
Background
The search algorithm of the graph topological relation is applied to many scenes, and the following schemes are available in the current relatively common search:
1. directly employing full-text search engine
Common engines comprise an elastic search (hereinafter abbreviated as ES), a solr and a lucence, which can support full-text retrieval, but can not effectively process graph relationships among resources, need an additional construction system to support the filtering of the relationships, and can not support the retrieval in a complex graph traversal scene;
2. using primitive graph engines
Although the conventional graph engines mainly have open-source frameworks such as Titan and Neo4j, and the like, the engines may effectively process graph relationships and meet full-text retrieval scenes of specific conditions (the bottom layer of the engine also depends on full-text retrieval engine technologies: ES and solr), the requirements of the engine can only traverse local graphs (issued by one or a plurality of points and accessed to a small set of points), and the engine cannot completely meet the resource retrieval requirements in the education field: the real-time response, and the hit result set would contain a larger amount of resources.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: a resource retrieval method and a computer-readable storage medium are provided to solve the problem that real-time response cannot be achieved when a query result is large.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows: a resource retrieval method, comprising:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
The invention also relates to a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
The invention has the beneficial effects that: the method comprises the steps of firstly carrying out graph traversal in a Titan graph according to a first resource retrieval condition to obtain a local graph in the Titan graph, and then carrying out retrieval in the ES engine according to a second retrieval condition, so that the problem that real-time response cannot be carried out when a query result is large is solved. According to the invention, the Titan index and the ES index are combined, so that the Titan graph engine can support real-time full-text retrieval, the application scene range of the Titan graph engine is expanded, meanwhile, the ES engine can support graph traversal, and the application scene range of the ES engine full-text retrieval is expanded.
Drawings
Fig. 1 is a flowchart of a resource retrieval method according to a first embodiment of the present invention.
Detailed Description
In order to explain technical contents, objects and effects of the present invention in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
The most key concept of the invention is as follows: on the basis of the Titan index, the ES index is used in the process of graph traversal.
Referring to fig. 1, a resource retrieval method includes:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
From the above description, the beneficial effects of the present invention are:
further, the step of converting each graph node number in the first graph node number set into an ES number in an ES engine respectively to obtain a first ES number set specifically includes:
and respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine according to the mapping relation between the graph node numbers and the ES numbers to obtain a first ES number set.
Further, the step of converting each ES number in the second ES number set into a graph node number in a Titan graph engine respectively to obtain a second graph node number set specifically includes:
and respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine according to the mapping relation between the graph node number and the ES number to obtain a second graph node number set.
As can be seen from the above description, the mutual conversion between the graph node id and the ES id is realized according to the one-to-one mapping relationship between the two.
Further, the ES engine stores attribute information of resources in a Titan graph engine;
the converting the second resource retrieval condition into the ES retrieval condition specifically includes:
and converting the second resource retrieval condition into a filter condition of the attribute information of the corresponding resource in the ES engine.
As can be seen from the above description, the second resource retrieval condition is converted into a corresponding ES retrieval condition so that retrieval can be performed in the ES engine.
The invention also proposes a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
Further, the step of converting each graph node number in the first graph node number set into an ES number in an ES engine respectively to obtain a first ES number set specifically includes:
and respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine according to the mapping relation between the graph node numbers and the ES numbers to obtain a first ES number set.
Further, the step of converting each ES number in the second ES number set into a graph node number in a Titan graph engine respectively to obtain a second graph node number set specifically includes:
and respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine according to the mapping relation between the graph node number and the ES number to obtain a second graph node number set.
Further, the ES engine stores attribute information of resources in a Titan graph engine;
the converting the second resource retrieval condition into the ES retrieval condition specifically includes:
and converting the second resource retrieval condition into a filter condition of the attribute information of the corresponding resource in the ES engine.
Example one
Referring to fig. 1, a first embodiment of the present invention is: a resource retrieval method is based on a Titan graph engine, can be applied to full-text search scenes based on graph topological relations, such as educational resource retrieval, and is suitable for full-text search of resource lists including courseware, exercises and the like of certain keywords under a certain knowledge point, friend search and the like under social scenes.
The method comprises the following steps:
s1: and carrying out graph traversal in a Titan graph engine according to the first resource retrieval condition to obtain a first graph node number set. In a Titan graph, each node may represent a different resource, while edges may represent resource relationships, i.e., associations between resources. The first resource retrieval condition can be a resource or a resource relation, traversing is carried out in the Titan graph according to the first resource retrieval condition, an intermediate result is screened out, and a graph node id set meeting the first resource retrieval condition is obtained from the Titan graph.
S2: and respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set. Specifically, in a default scenario, the graph node numbers and the ES numbers are in one-to-one correspondence, but the numbers are not consistent in form, the number format in the Titan graph engine is a long integer, the number format in the ES engine is a character string, and a mapping relationship is generated by the existing encoding technology. In the step, according to the mapping relation between the graph node id and the ES id, the graph node id is converted into the ES id by using a tool carried in a Titan graph engine.
S3: converting the second resource retrieval condition into an ES retrieval condition; the second resource retrieval condition may be a keyword corresponding to some resource. The ES engine also maintains the attribute information of the resource, and the step converts the second resource retrieval condition into the filtering condition of the ES attribute information.
S4: searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set; after the first resource retrieval condition and the second resource retrieval condition are converted into the ES retrieval condition, the final ES retrieval condition is formed, retrieval is carried out in an ES engine, and the id list of the resource nodes is obtained.
S5: respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set; that is, the ES id is converted into the graph node id according to the mapping relationship of step S2.
S6: acquiring a resource list in a Titan graph engine according to the second graph node number set; namely, the query result is obtained according to the graph node id retrieval, namely, the extra information of the resources except the id is obtained, and the extra information comprises paging data.
The embodiment provides a method for explicitly using (manually changing an index strategy, and forcibly using) an ES index in a graph traversal process on the basis of a Titan global index (graph index) and a local index (vertex central index), so as to solve the problem that real-time response cannot be performed when a query result is large, and achieve a customized index retrieval capability of Titan.
In a specific application scenario, for example, in the K12 education field, resources are generally categorized by education stages, applicable objects, subjects, versions, etc., and are attached to corresponding teaching materials and chapters, and a general teacher needs to prepare lessons and search resources such as required materials and courseware in full text in chapters corresponding to knowledge points.
Firstly, a teacher can log in a 101PPT client, and the system automatically configures corresponding teaching materials according to user information. Then, the teacher chooses to make courseware under a certain chapter and inputs certain keywords in the search box; the background searches out related materials and courseware lists according to the classification, teaching materials, chapters and keywords by the method.
Example two
The present embodiment is a computer-readable storage medium corresponding to the above-mentioned embodiments, on which a computer program is stored, which when executed by a processor implements the steps of:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
Further, the step of converting each graph node number in the first graph node number set into an ES number in an ES engine respectively to obtain a first ES number set specifically includes:
and respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine according to the mapping relation between the graph node numbers and the ES numbers to obtain a first ES number set.
Further, the step of converting each ES number in the second ES number set into a graph node number in a Titan graph engine respectively to obtain a second graph node number set specifically includes:
and respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine according to the mapping relation between the graph node number and the ES number to obtain a second graph node number set.
Further, the ES engine stores attribute information of resources in a Titan graph engine;
the converting the second resource retrieval condition into the ES retrieval condition specifically includes:
and converting the second resource retrieval condition into a filter condition of the attribute information of the corresponding resource in the ES engine.
In summary, according to the resource retrieval method and the computer-readable storage medium provided by the present invention, a graph traversal is performed in a Titan graph according to a first resource retrieval condition to obtain a local graph in the Titan graph, and then a retrieval is performed in the ES engine according to a second retrieval condition, so as to solve a problem that a real-time response cannot be performed when a query result is large. According to the invention, the Titan index and the ES index are combined, so that the Titan graph engine can support real-time full-text retrieval, the application scene range of the Titan graph engine is expanded, meanwhile, the ES engine can support graph traversal, and the application scene range of the ES engine full-text retrieval is expanded.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.
Claims (4)
1. A method for resource retrieval, comprising:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine according to the mapping relation between the graph node numbers and the ES numbers to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine according to the mapping relation between the graph node number and the ES number to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
2. The resource retrieval method according to claim 1, wherein attribute information of a resource in a Titan graph engine is stored in the ES engine;
the converting the second resource retrieval condition into the ES retrieval condition specifically includes:
and converting the second resource retrieval condition into a filter condition of the attribute information of the corresponding resource in the ES engine.
3. A computer-readable storage medium, on which a computer program is stored, which program, when executed by a processor, performs the steps of:
performing graph traversal in a Titan graph engine according to a first resource retrieval condition to obtain a first graph node number set;
respectively converting the graph node numbers in the first graph node number set into ES numbers in an ES engine according to the mapping relation between the graph node numbers and the ES numbers to obtain a first ES number set;
converting the second resource retrieval condition into an ES retrieval condition;
searching in an ES engine according to the first ES number set and the ES searching condition to obtain a second ES number set;
respectively converting each ES number in the second ES number set into a graph node number in a Titan graph engine according to the mapping relation between the graph node number and the ES number to obtain a second graph node number set;
and acquiring a resource list in a Titan graph engine according to the second graph node number set.
4. The computer-readable storage medium according to claim 3, wherein the ES engine stores therein attribute information of resources in a Titan graph engine;
the converting the second resource retrieval condition into the ES retrieval condition specifically includes:
and converting the second resource retrieval condition into a filter condition of the attribute information of the corresponding resource in the ES engine.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811176796.0A CN111104560B (en) | 2018-10-10 | 2018-10-10 | Resource retrieval method and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811176796.0A CN111104560B (en) | 2018-10-10 | 2018-10-10 | Resource retrieval method and computer-readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111104560A CN111104560A (en) | 2020-05-05 |
CN111104560B true CN111104560B (en) | 2022-06-07 |
Family
ID=70417835
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811176796.0A Active CN111104560B (en) | 2018-10-10 | 2018-10-10 | Resource retrieval method and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111104560B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104504003A (en) * | 2014-12-09 | 2015-04-08 | 北京航空航天大学 | Graph data searching method and device |
CN105740335A (en) * | 2016-01-22 | 2016-07-06 | 山东合天智汇信息技术有限公司 | Titan-based enterprise information analysis platform and construction method thereof |
US10037368B1 (en) * | 2014-12-23 | 2018-07-31 | VCE IP Holding Company LLC | Methods, systems, and computer readable mediums for performing a free-form query |
-
2018
- 2018-10-10 CN CN201811176796.0A patent/CN111104560B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104504003A (en) * | 2014-12-09 | 2015-04-08 | 北京航空航天大学 | Graph data searching method and device |
US10037368B1 (en) * | 2014-12-23 | 2018-07-31 | VCE IP Holding Company LLC | Methods, systems, and computer readable mediums for performing a free-form query |
CN105740335A (en) * | 2016-01-22 | 2016-07-06 | 山东合天智汇信息技术有限公司 | Titan-based enterprise information analysis platform and construction method thereof |
Non-Patent Citations (1)
Title |
---|
知识图谱数据管理系统的设计与实现;王丽娟;《数据库技术》;20170111;第200-202页 * |
Also Published As
Publication number | Publication date |
---|---|
CN111104560A (en) | 2020-05-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20120158791A1 (en) | Feature vector construction | |
CN106155522B (en) | Session data processing, knowledge base foundation, optimization, exchange method and device | |
CN104239513A (en) | Semantic retrieval method oriented to field data | |
CN103116657B (en) | A kind of individuation search method of network teaching resource | |
US20110202533A1 (en) | Dynamic Search Interaction | |
US9753960B1 (en) | System, method, and computer program for dynamically generating a visual representation of a subset of a graph for display, based on search criteria | |
CN101566988A (en) | Method, system and device for searching fuzzy semantics | |
Taheriyan et al. | A graph-based approach to learn semantic descriptions of data sources | |
CN109960722B (en) | Information processing method and device | |
Lu et al. | Analysis of film data based on Neo4j | |
CN104462429A (en) | Method and device for generating database query sentences | |
CN104765767B (en) | For the knowledge store system and its knowledge searching method of intelligence learning | |
CN110737779A (en) | Knowledge graph construction method and device, storage medium and electronic equipment | |
US20190171756A1 (en) | Cognitive decision system for security and log analysis using associative memory mapping in graph database | |
Kolas et al. | Spatially-augmented knowledgebase | |
US8965910B2 (en) | Apparatus and method of searching for instance path based on ontology schema | |
CN111104560B (en) | Resource retrieval method and computer-readable storage medium | |
CN108595588B (en) | Scientific data storage association method | |
KR101068676B1 (en) | Ontology modeling apparatus and method for connecting person to resource | |
CN104598613A (en) | Conceptual relation construction method and device for vertical field | |
EP4040306A1 (en) | Intelligent data enrichment using knowledge graph | |
Zhang et al. | Semantic web and geospatial unique features based geospatial data integration | |
Qingjie et al. | Research on domain knowledge graph based on the large scale online knowledge fragment | |
Liu et al. | Study on tag, trust and probability matrix factorization Based Social network recommendation | |
US20240005094A1 (en) | Hierarchical ontology matching with self-supervision |
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 |