CPC G06F 16/9032 (2019.01) [G06F 16/9027 (2019.01)] | 12 Claims |
1. A method for query conversion performed by a computer system employing a processor, the method comprising:
obtaining, by the computer system, a first query in a first graph query language for a first graph database;
generating, by the computer system, a syntax tree by:
obtaining an ontology file associated with the first graph database;
obtaining a data structure corresponding to the first graph database through parsing the ontology file, and
generating the syntax tree through parsing the first query using the data structure;
creating, by the computer system, a query graph based on the syntax tree, wherein the creating the query graph comprises:
extracting a set of nodes and a set of edges from the syntax tree;
determining a node type of each node in the set of nodes from the syntax tree;
determining an edge type of each edge in the set of edges from the syntax tree;
determining a query path based on the set of nodes and corresponding node types and the set of edges and corresponding edge types; and
combining the set of nodes and the set of edges into the query graph according to the query path;
converting, by the computer system, the query graph into a second query for a second graph database, the second query being formatted according to a second graph query language different from the first graph query language, thereby improving interoperability between different graph database systems utilizing different graph query languages; and
applying the second query to the second graph database to retrieve information from the second graph database.
|