You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/language/learn-ql/writing-queries/debugging-queries.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This topic offers some simple tips on how to avoid common problems that can affe
10
10
Before reading the tips below, it is worth reiterating a few important points about CodeQL and the QL language:
11
11
12
12
- CodeQL `predicates <https://help.semmle.com/QL/ql-handbook/predicates.html>`__ and `classes <https://help.semmle.com/QL/ql-handbook/types.html#classes>`__ are evaluated to database `tables <https://en.wikipedia.org/wiki/Table_(database)>`__. Large predicates generate large tables with many rows, and are therefore expensive to compute.
13
-
- The QL language is implemented using standard database operations and `relational algebra <https://en.wikipedia.org/wiki/Relational_algebra>`__ (such as join, projection, and union). For further information about query languages and databases, see :doc:`About QL <../about-ql>`.
13
+
- The QL language is implemented using standard database operations and `relational algebra <https://en.wikipedia.org/wiki/Relational_algebra>`__ (such as join, projection, and union). For further information about query languages and databases, see `About the QL language <https://help.semmle.com/QL/learn-ql/about-ql.html>`__.
14
14
- Queries are evaluated *bottom-up*, which means that a predicate is not evaluated until *all* of the predicates that it depends on are evaluated. For more information on query evaluation, see `Evaluation of QL programs <https://help.semmle.com/QL/ql-handbook/evaluation.html>`__ in the QL handbook.
Copy file name to clipboardExpand all lines: docs/language/ql-handbook/about-the-ql-language.rst
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,15 @@
1
-
About QL
2
-
========
1
+
About the QL language
2
+
######################
3
3
4
-
This section is aimed at users with a background in general purpose programming as well as in databases. For a basic introduction and information on how to get started, see :doc:`Introduction to QL <introduction-to-ql>` and :doc:`Learning CodeQL <../index>`.
5
-
6
-
QL is a declarative, object-oriented query language that is optimized to enable efficient analysis of hierarchical data structures, in particular, databases representing software artifacts.
7
-
8
-
The queries and metrics used in LGTM are implemented using CodeQL, which uses QL to analyze code. This ensures that they can be extended or revised easily to keep up with changes in definitions of best coding practice. We continually improve existing queries as we work towards the ultimate goal of 100% precision.
9
-
10
-
You can write queries to identify security vulnerabilities, find coding errors and bugs, or find code that breaks your team's guidelines for best practice. You can also create customized versions of the default queries to accommodate a new framework.
4
+
QL is the powerful query language that underlies CodeQL, which is used to analyze code.
11
5
12
6
About query languages and databases
13
7
-----------------------------------
14
8
9
+
This section is aimed at users with a background in general purpose programming as well as in databases. For a basic introduction and information on how to get started, see `Learning CodeQL <https://help.semmle.com/QL/learn-ql/index.html>`__.
10
+
11
+
QL is a declarative, object-oriented query language that is optimized to enable efficient analysis of hierarchical data structures, in particular, databases representing software artifacts.
12
+
15
13
A database is an organized collection of data. The most commonly used database model is a relational model which stores data in tables and SQL (Structured Query Language) is the most commonly used query language for relational databases.
16
14
17
15
The purpose of a query language is to provide a programming platform where you can ask questions about information stored in a database. A database management system manages the storage and administration of data and provides the querying mechanism. A query typically refers to the relevant database entities and specifies various conditions (called predicates) that must be satisfied by the results. Query evaluation involves checking these predicates and generating the results. Some of the desirable properties of a good query language and its implementation include:
@@ -41,6 +39,11 @@ When you write this process in QL, it closely resembles the above structure. Not
41
39
result = count(getADescendant(p))
42
40
}
43
41
42
+
For more information about the important concepts and syntactic constructs of QL, see the individual reference topics such as :doc:`Expressions <expressions>` and :doc:`Recursion <recursion>`.
43
+
The explanations and examples help you understand how the language works, and how to write more advanced QL code.
44
+
45
+
For formal specifications of the QL language and QLDoc comments, see the :doc:`QL language specification <language>` and :doc:`QLDoc comment specification <qldoc>`.
46
+
44
47
QL and object orientation
45
48
-------------------------
46
49
@@ -56,12 +59,10 @@ Here are a few prominent conceptual and functional differences between general p
56
59
- QL's set-based semantics makes it very natural to process collections of values without having to worry about efficiently storing, indexing and traversing them.
57
60
- In object oriented programming languages, instantiating a class involves creating an object by allocating physical memory to hold the state of that instance of the class. In QL, classes are just logical properties describing sets of already existing values.
58
61
59
-
These topics are discussed in detail in the `QL language handbook <https://help.semmle.com/QL/ql-handbook/index.html>`__.
60
-
61
-
References
62
-
----------
62
+
Further reading
63
+
---------------
63
64
64
-
Academic references available from the `Semmle website<https://help.semmle.com/publications.html>`__ also provide an overview of QL and its semantics. Other useful references on database query languages and Datalog:
65
+
`Academic references <https://help.semmle.com/publications.html>`__ also provide an overview of QL and its semantics. Other useful references on database query languages and Datalog:
65
66
66
67
- `Database theory: Query languages <http://www.lsv.ens-cachan.fr/~segoufin/Papers/Mypapers/DB-chapter.pdf>`__
67
68
- `Logic Programming and Databases book - Amazon page <http://www.amazon.co.uk/Programming-Databases-Surveys-Computer-Science/dp/3642839541>`__
Copy file name to clipboardExpand all lines: docs/language/ql-handbook/language.rst
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,10 @@ QL language specification
3
3
4
4
This is a formal specification for the QL language. It provides a comprehensive reference for terminology, syntax, and other technical details about QL.
5
5
6
+
.. This ``highlight`` directive prevents code blocks in this file being highlighted as QL (the default language for this Sphinx project).
For a formal specification of the QL language, including a description of syntax, terminology, and other technical details, please consult the QL language specification.
8
-
9
-
For information on the terminology and syntax used in QLDoc comments, please consult the QLDoc comment specification.
10
-
11
-
.. toctree::
12
-
:maxdepth:2
13
-
14
-
language
15
-
16
-
qldoc
17
-
18
-
19
-
Search
20
-
******
21
-
22
-
.. * :ref:`genindex`
23
-
24
-
* :ref:`search`
4
+
The specifications have moved to ``ql/docs/language/ql-handbook``.
5
+
See https://github.com/github/semmle-docs/issues/21 for details of the restructuring.
Copy file name to clipboardExpand all lines: docs/language/ql-training/slide-snippets/intro-ql-general.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ QL is:
124
124
125
125
.. note::
126
126
127
-
QL is the high-level, object-oriented logic language that underpins all CodeQL libraries and analyses. You can learn lots more about QL by visiting `Introduction to the QL language <https://help.semmle.com/QL/learn-ql/ql/introduction-to-ql.html>`__ and `About QL <https://help.semmle.com/QL/learn-ql/ql/about-ql.html>`__.
127
+
QL is the high-level, object-oriented logic language that underpins all CodeQL libraries and analyses. You can learn lots more about QL by visiting the `QL language reference <https://help.semmle.com/QL/ql-handbook>`__.
128
128
The key features of QL are:
129
129
130
130
- All common logic connectives are available, including quantifiers like ``exist``, which can also introduce new variables.
0 commit comments