.QL
Encyclopedia
.QL is an object-oriented query language used to retrieve data from relational database management system
Database management system
A database management system is a software package with computer programs that control the creation, maintenance, and use of a database. It allows organizations to conveniently develop databases for various applications by database administrators and other specialists. A database is an integrated...

s. It is reminiscent of the standard query language SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 and the object-oriented programming language Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

. .QL is an object-oriented variant of a logic programming language known in the databases community as Datalog
Datalog
Datalog is a query and rule language for deductive databases that syntactically is a subset of Prolog. Its origins date back to the beginning of logic programming, but it became prominent as a separate area around 1977 when Hervé Gallaire and Jack Minker organized a workshop on logic and databases...

. Hierarchical data can therefore be naturally queried in .QL in a recursive manner.

Queries written in .QL are optimised, compiled into SQL and can then be executed on any major relational database management system. .QL query language is being used in SemmleCode
SemmleCode
SemmleCode is a tool for improving the quality of computer software. It can be used to find programming bug patterns, to compute software metrics, and to enforce coding conventions. All these tasks can be formulated as queries in an object-oriented query language named .QL.- Academic :SemmleCode...

 to query a relational representation of Java programs.

.QL is developed at Semmle Limited and is based on the company's proprietary technology.

Language Features

.QL has several language features to make queries concise, intuitive and reusable:
  • Extensible type hierarchy
  • Methods and predicates
  • Definition before use

Example query

The sample query below illustrates use of .QL to query a Java program. This is how one would select all classes that contain more than ten public methods:
from Class c, int numofm
where numofm = count(Method m| m.getDeclaringType=c
and m.hasModifier("public"))
and numofm > 10
select c.getPackage, c, numofm
In fact, this query selects not only all classes with more than ten public methods, but also their corresponding packages and the number of methods each class has.

See also

  • SQL
    SQL
    SQL is a programming language designed for managing data in relational database management systems ....

     - Structured Query Language
  • OQL - Object Query Language
  • Datalog
    Datalog
    Datalog is a query and rule language for deductive databases that syntactically is a subset of Prolog. Its origins date back to the beginning of logic programming, but it became prominent as a separate area around 1977 when Hervé Gallaire and Jack Minker organized a workshop on logic and databases...

     - logic programming language
  • SemmleCode
    SemmleCode
    SemmleCode is a tool for improving the quality of computer software. It can be used to find programming bug patterns, to compute software metrics, and to enforce coding conventions. All these tasks can be formulated as queries in an object-oriented query language named .QL.- Academic :SemmleCode...

     - Software testing
    Software testing
    Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software...

    tool that uses .QL language

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK