Semmle 1.21
Skip to end of metadata
Go to start of metadata


Each queries.xml file defines the parent directory containing query files for a specific language. This is used to resolve the import statements in associated query files and also to determine whether or not a query is compatible with the snapshot database or dashboard database that is currently being analyzed.


The queries.xml file contains a single XML element:

<queries language="datatype"/>

where datatype specifies the type of data the query libraries and queries in this directory can be used to analyze. That is:

  • For a dashboard database: odasa-dashboard
  • For a snapshot database: the name of the programming language

language attribute

The language for the query libraries or queries in this directory must be defined using the language attribute. It is not possible to mix two languages in one directory. The standard languages supported for snapshot analysis are:

  • C or C++ — language="cpp"
  • C# — language="csharp"
  • COBOL—language="cobol"
  • Java — language="java"
  • JavaScript — language="javascript"
  • Python — language="python"

The other supported option is language="odasa-dashboard" which is used to analyze dashboard databases


The file should be stored either alongside the queries it relates to, or in one or more parent directories above that location. For example, by default, the query SEMMLE_DIST/queries/semmlecode-csharp-queries/Complexity/BlockWithTooManyStatements.ql uses the following queries.xml file:



In particular, you can import a .qll file that is not in a subdirectory of your query. In this case, save the queries.xml file in the common parent directory of the .qll file and the query. For full details on resolving import statements in QL, see Name resolution in the QL language handbook.

Use of the queries.xml file

When you run a query, Semmle looks in the directory containing the query and all of its ancestors for a queries.xml file to specify the language analyzed by the query. If a queries.xml file exists then the language defined in that file is used to determine whether the query is compatible with the current analysis and also to resolve any import statements. For more information, see Module resolution in the QL language specification.