.QL (pronounced "dot-cue-el") is an object-oriented query language used to retrieve data from relational
database management system
In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and an ...
s. It is reminiscent of the standard query language
SQL
Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel")
is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
and the object-oriented programming language
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
. .QL is an object-oriented variant of a logical query language called
Datalog
Datalog is a declarative logic programming language. While it is syntactically a subset of Prolog, Datalog generally uses a bottom-up rather than top-down evaluation model. This difference yields significantly different behavior and properties ...
. 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 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 numOfMethods
where numOfMethods = count(Method m, m.getDeclaringType()=c
and m.hasModifier("public"))
and numOfMethods > 10
select c.getPackage(), c, numOfMethods
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
Structured Query Language (SQL) (pronounced ''S-Q-L''; or alternatively as "sequel")
is a domain-specific language used to manage data, especially in a relational database management system (RDBMS). It is particularly useful in handling s ...
- Structured Query Language
*
OQL - Object Query Language
*
Datalog
Datalog is a declarative logic programming language. While it is syntactically a subset of Prolog, Datalog generally uses a bottom-up rather than top-down evaluation model. This difference yields significantly different behavior and properties ...
- logic programming language
*
SemmleCode -
Software testing
Software testing is the act of checking whether software satisfies expectations.
Software testing can provide objective, independent information about the Quality (business), quality of software and the risk of its failure to a User (computin ...
tool that uses .QL language
References
* Hervé Gallaire and Jack Minker. Logic and Databases. Plenum Press, New York,1978.
* Serge Abiteboul and Paris C. Kanellakis. Object identity as a query language primitive. In SIGMOD Rec, pages 159–173, ACM Press, 1989.
* Oege de Moor, Elnar Hajiyev and Mathieu Verbaere. Object-oriented queries over software systems. In Proceedings of the 2007 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM), page 91, ACM Press, 2007.
External links
Semmle Limited creators of .QL
{{DEFAULTSORT:Ql
Declarative programming languages
Logic programming languages
Query languages
Data modeling languages