An Intermediate Representation-based Approach for Query Translation using a Syntax-Directed Method

Hassana NASSIRI, Mustapha MACHKOUR, Mohamed HACHIMI
2020 International Journal of Advanced Computer Science and Applications  
We aspire to make one query reasonably sufficient to extract data regardless of the data model used in our research. In such a way, users can freely use any query language they master to interrogate the heterogeneous database, not necessarily the query language associated with the model. Thus, overcoming the needing to deal with multiple query languages, which is, usually, an unwelcome matter for non-expert users and even for the expert ones. To do so, we proposed a new translation approach,
more » ... ying on an intermediate query language to convert the user query into a suitable query language, according to the nature of data interrogated. Which is more beneficial rather than repeat the whole process for each new query submission. On the other hand, this empowers the system to be modular and divided into multiple, more flexible, and less complicated components. Therefore, it increases possibilities to make independent transformations and to switch between several query languages efficiently. By using our system, querying each data model with the corresponding query language is no longer bothersome. As a start, we are covering the eXtensible Markup Language (XML) and relational data models, whether native or hybrid. Users can retrieve data sources over these models using just one query, expressed with either the XML Path Language (XPath) or the Structured Query Language (SQL). ] [23] . After extracting the AST, all we need is to unify the ASTs and finally use the mapping rules to map every part of the unified AST and easily generates the UQL. A. Parse Tree A parse tree or derivation tree is a data structure that matches the syntactic structure of the input. For example, the SQL select query: "select first_name, last_name from Employee where id = 1;" has the following parse tree (Fig.9) , presented in tree form in Fig. 10 . B. Abstract Syntax Tree An AST is a variant of parse tree where we eliminate extra information and discard irrelevant details. Fig. 11 shows the AST for the query. This example illustrates the output from a console, but we developed an interface ([5]) to present the analysis better. LocationPath ::= RelativeLocationPath | AbsoluteLocationPath AbsoluteLocationPath ::=
doi:10.14569/ijacsa.2020.0110870 fatcat:ebq7ix62jfd67cpbzjrdfmzxeq