Cross-graph transitions for graph database queries
Techniques are disclosed for enabling cross-graph querying in graph databases using a transition operator within a traversal context. In some embodiments, a computing system receives a query containing a transition operator that facilitates transitioning from a first graph to a second graph. The system processes a traversal operation within the first graph, retrieves intermediary data, and transitions to the second graph to perform subsequent traversal operations. The query engine can utilize confidence scores associated with edges in the graphs to filter or prioritize results, ensuring the reliability of returned data. Additionally, data validation techniques using a mirror graph are disclosed, where new data is validated before integration into a production graph. These techniques streamline cross-graph data analysis, improve query efficiency, and maintain graph database integrity while supporting applications such as fraud detection, recommendation systems, and account linking.
1 . A non-transitory computer-readable medium having program instructions stored thereon that cause a computer system to perform operations comprising:
receiving a query for a graph database, wherein the query comprises a transition operator that causes a query engine to transition from a first graph to a second graph;
initiating, by the query engine, a first portion of a traversal context from a first node of the first graph based on a set of criteria specified in the query;
in response to the transition operator, performing, by the query engine, a second portion of the traversal context from a second node in the second graph, wherein the second node is identified based on intermediary data retrieved from the first portion of the traversal context; and
returning, for the query, a result that includes result data retrieved from the second portion of the traversal context.
2 . The non-transitory computer-readable medium of claim 1 , wherein the second graph comprises a set of edges, wherein a first edge of the set of edges has a first confidence score indicative of a relationship between two first nodes within the second graph, and wherein a second edge of the set of edges has a second confidence score indicative of a relationship between two second nodes within the second graph; and
wherein performing the second portion of the traversal context is based on the first and second confidence scores.
3 . The non-transitory computer-readable medium of claim 1 , wherein the operations further comprise:
retrieving, via the query engine, a set of confidence scores associated with edges in the second graph; and
determining, via the query engine, that a particular confidence score within the set of confidence scores satisfies a pre-determined threshold, wherein the result data includes data identified based on the determining.
4 . The non-transitory computer-readable medium of claim 1 , wherein the operations further comprise:
receiving a request to add a set of data to the second graph;
prior to inserting the set of data to the second graph, validating the set of data including:
generating a mirror graph comprising a structure associated with the second graph;
inserting the set of data into the mirror graph; and
determining a validity of the set of data based on a second query that comprises a second transition operator that causes the query engine to transition between the mirror graph and the second graph.
5 . The non-transitory computer-readable medium of claim 4 , wherein the operations further comprise:
based on the validity of the set of data, inserting the mirror graph into the second graph.
6 . The non-transitory computer-readable medium of claim 5 , wherein the returned result comprises the inserted set of data.
7 . The non-transitory computer-readable medium of claim 1 , wherein performing the second portion of the traversal context comprises:
traversing from the second node to a third node and from the second node to a fourth node, wherein the result data includes data from the third node and the fourth node.
8 . The non-transitory computer-readable medium of claim 1 , wherein the operations further comprise:
parsing the query, wherein the parsing includes identifying a second transition operator associated with a third graph; and
after performing the second portion of the traversal context, performing a third portion of the traversal context from a third node in the third graph based on the second transition operator.
9 . The non-transitory computer-readable medium of claim 1 , wherein the operations further comprise:
in response to the transition operator:
retrieving the intermediary data from a destination node in the first graph based on the first portion of the traversal context;
identifying the second node based on the second node including the intermediary data; and
transitioning from the destination node in the first graph to the second node in the second graph.
10 . A computer-implemented method, comprising:
receiving a query for a graph database, wherein the query comprises a transition operator that causes a query engine to transition from a first graph to a second graph;
initiating, by the query engine, a first portion of a traversal operation from a first node of the first graph to a second node of the first graph based on a set of criteria specified in the query;
in response to the transition operator, transitioning from the second node to a third node of the second graph;
performing, by the query engine, a second portion of the traversal operation from the third node in the second graph to a fourth node in the second graph, wherein the third node is identified based on intermediary data retrieved from the second node; and
returning, for the query, a result that includes result data retrieved from the second portion of the traversal operation.
11 . The computer-implemented method of claim 10 , wherein the first portion of the traversal operation includes traversals through one or more intermediary nodes between the first node and the second node.
12 . The computer-implemented method of claim 10 , wherein the second graph comprises a set of edges; and
wherein performing the second portion of the traversal operation is based on confidence scores associated with one or more of the set of edges.
13 . The computer-implemented method of claim 10 , further comprising:
retrieving, via the query engine, a set of confidence scores associated with edges in the second graph; and
determining, via the query engine, the result data based on one or more of the set of confidence scores.
14 . The computer-implemented method of claim 10 , further comprising:
receiving a request to add a set of data to the second graph;
prior to inserting the set of data to the second graph, validating the set of data including:
generating a mirror graph comprising a structure associated with the second graph;
inserting the set of data into the mirror graph; and
determining a validity of the set of data based on the inserting.
15 . The computer-implemented method of claim 14 , further comprising:
based on the validity of the set of data, inserting the set of data into the second graph.
16 . A computing system, comprising:
one or more processors;
memory having program instructions stored thereon that are executable by the one or more processors to cause the computing system to perform operations comprising:
receiving a graph database query that comprises a transition operator that causes a database query engine to transition from a first graph to a second graph;
initiating a first portion of a traversal operation from a first node of the first graph based on a set of criteria specified in the query;
in response to the transition operator:
retrieving intermediary data from a destination node in the first graph;
identifying a second node in the second graph associated with the intermediary data;
performing a second portion of the traversal operation from the second node in the second graph; and
returning, for the graph database query, a result that includes result data retrieved from the second portion of the traversal operation.
17 . The computing system of claim 16 , wherein the first portion of the traversal operation includes traversals through one or more intermediary nodes between the first node and the destination node.
18 . The computing system of claim 16 , wherein performing the second portion of the traversal operation is based on one or more confidence scores assigned to edges in the first graph or the second graph.
19 . The computing system of claim 16 , wherein the operations further comprise:
retrieving, via the database query engine, a set of confidence scores associated with edges in the first graph or the second graph; and
identifying the result data based on a particular confidence score within the set of confidence scores satisfying a pre-determined threshold.
20 . The computing system of claim 16 , wherein the operations further comprise:
receiving a request to add a set of data to the second graph;
prior to inserting the set of data to the second graph, validating the set of data including:
inserting the set of data into a mirror graph comprising a structure associated with the second graph; and
processing a query that comprises a transition operator that causes the database query engine to transition between the mirror graph and the second graph.