.QL
Object-oriented query language
title: ".QL" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["declarative-programming-languages", "logic-programming-languages", "query-languages", "data-modeling-languages"] description: "Object-oriented query language" topic_path: "technology/programming-languages" source: "https://en.wikipedia.org/wiki/.QL" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Object-oriented query language ::
::data[format=table title="Infobox programming language"]
| Field | Value |
|---|---|
| logo | File:dotql.png |
| name | .QL |
| paradigm | multi-paradigm, logic-paradigm, object-oriented-paradigm |
| year | 2007 |
| developer | Semmle |
| typing | static, strong |
| implementations | SemmleCode |
| influenced_by | Datalog |
| :: |
| logo = File:dotql.png | name = .QL | paradigm = multi-paradigm, logic-paradigm, object-oriented-paradigm | year = 2007 | developer = Semmle | typing = static, strong | implementations = SemmleCode | influenced_by = Datalog
.QL (pronounced "dot-cue-el") is an object-oriented query language used to retrieve data from relational database management systems. It is reminiscent of the standard query language SQL and the object-oriented programming language Java. .QL is an object-oriented variant of a logical query language called Datalog. 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: ::code[lang=ql] 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.
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.
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::