Skip to content

Commit 48a09ce

Browse files
authored
Merge pull request github#3178 from shati-patel/21-ql-language
[Migration prep] Docs: "QL language reference" category
2 parents e5ad708 + a514cec commit 48a09ce

File tree

10 files changed

+36
-71
lines changed

10 files changed

+36
-71
lines changed

docs/language/learn-ql/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ CodeQL is based on a powerful query language called QL. The following topics hel
1919
:maxdepth: 1
2020

2121
introduction-to-ql
22-
about-ql
2322
beginner/ql-tutorials
2423
writing-queries/writing-queries
2524
cpp/ql-for-cpp

docs/language/learn-ql/introduction-to-ql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ Learning CodeQL
165165

166166
- To find out more about how to write your own queries, try working through the :doc:`QL tutorials <beginner/ql-tutorials>`.
167167
- For an overview of the other available resources, see :doc:`Learning CodeQL <../index>`.
168-
- For a more technical description of the underlying language, see :doc:`About QL <about-ql>`.
168+
- For a more technical description of the underlying language, see the `QL language reference <https://help.semmle.com/QL/ql-handbook>`__

docs/language/learn-ql/writing-queries/debugging-queries.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This topic offers some simple tips on how to avoid common problems that can affe
1010
Before reading the tips below, it is worth reiterating a few important points about CodeQL and the QL language:
1111

1212
- 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>`__.
1414
- 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.
1515

1616
Performance tips

docs/language/learn-ql/about-ql.rst renamed to docs/language/ql-handbook/about-the-ql-language.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
About QL
2-
========
1+
About the QL language
2+
######################
33

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.
115

126
About query languages and databases
137
-----------------------------------
148

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+
1513
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.
1614

1715
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
4139
result = count(getADescendant(p))
4240
}
4341
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+
4447
QL and object orientation
4548
-------------------------
4649

@@ -56,12 +59,10 @@ Here are a few prominent conceptual and functional differences between general p
5659
- 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.
5760
- 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.
5861

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+
---------------
6364

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:
6566

6667
- `Database theory: Query languages <http://www.lsv.ens-cachan.fr/~segoufin/Papers/Mypapers/DB-chapter.pdf>`__
6768
- `Logic Programming and Databases book - Amazon page <http://www.amazon.co.uk/Programming-Databases-Surveys-Computer-Science/dp/3642839541>`__

docs/language/ql-handbook/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
master_doc = 'index'
4242

4343
# Project-specific information.
44-
project = u'QL language handbook'
44+
project = u'QL language reference'
4545

4646
# The version info for this project, if different from version and release in main conf.py file.
4747
# The short X.Y version.
@@ -53,10 +53,10 @@
5353

5454
# The name for this set of Sphinx documents. If None, it defaults to
5555
# "<project> v<release> documentation".
56-
html_title = 'QL language handbook'
56+
html_title = 'QL language reference'
5757

5858
# Output file base name for HTML help builder.
59-
htmlhelp_basename = 'QL language handbook'
59+
htmlhelp_basename = 'QL language reference'
6060

6161
# -- Currently unused, but potentially useful, configs--------------------------------------
6262

docs/language/ql-handbook/index.rst

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
1-
QL language handbook
2-
####################
1+
QL language reference
2+
#####################
33

4-
Welcome to the QL language handbook!
5-
6-
This document describes the main features of the QL language. The explanations and examples
7-
help you understand how the language works, and how to write more advanced QL code.
8-
9-
Each section describes an important concept or syntactic construct of QL. For an overview, see
10-
the table of contents below.
11-
12-
If you are just getting started with QL, see `Learning CodeQL <https://help.semmle.com/QL/learn-ql/>`_
13-
for a list of the available resources.
14-
15-
.. index:: specification
16-
17-
For a formal specification of the QL language, see the `QL language specification
18-
<https://help.semmle.com/QL/ql-spec/language.html>`_.
19-
20-
Table of contents
21-
*****************
4+
Learn all about QL, the powerful query language that underlies the code scanning tool CodeQL.
225

236
.. toctree::
24-
:maxdepth: 3
7+
:maxdepth: 1
258

9+
about-the-ql-language
2610
predicates
2711
queries
2812
types
@@ -36,9 +20,5 @@ Table of contents
3620
lexical-syntax
3721
name-resolution
3822
evaluation
39-
40-
Index and search
41-
****************
42-
43-
* :ref:`genindex`
44-
* :ref:`search`
23+
language
24+
qldoc

docs/language/ql-spec/language.rst renamed to docs/language/ql-handbook/language.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ QL language specification
33

44
This is a formal specification for the QL language. It provides a comprehensive reference for terminology, syntax, and other technical details about QL.
55

6+
.. This ``highlight`` directive prevents code blocks in this file being highlighted as QL (the default language for this Sphinx project).
7+
8+
.. highlight:: none
9+
610
Introduction
711
------------
812

File renamed without changes.

docs/language/ql-spec/index.rst

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
1-
QL specifications
2-
#################
1+
README
2+
######
33

4-
.. index:: specification
5-
6-
7-
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.

docs/language/ql-training/slide-snippets/intro-ql-general.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ QL is:
124124

125125
.. note::
126126

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>`__.
128128
The key features of QL are:
129129

130130
- All common logic connectives are available, including quantifiers like ``exist``, which can also introduce new variables.

0 commit comments

Comments
 (0)