Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

MQL Quickref

Dirk Roorda edited this page Oct 20, 2021 · 5 revisions

Full guide: MQL Query Guide


MQL in a minute

The general shape of a query is as follows (the line numbers are not part of the query)

 1    select all objects
 2    in {1-40}
 3    where
 4    [sentence
 5      [phrase
 6        [word sp=verb]
 7        [word sp=subs]
 8      ]
 9      ..
10      [phrase
11        [word g_cons = 'H']
12        [word focus]
13      ]
14    ]

Here is the explanation, line by line.

  1. All queries start this way.
  2. Optionally restrict results to a subset of the text, in this case: words 1-40.
  3. This is also fixed.
  4. Look for a sentence ...
  5. with a phrase inside ...
  6. which contains a word having value verb for feature sp where sps is part-of-speech, consult the feature documentation ...
  7. directly followed by a word having value subs for feature sp where subs = noun, see the feature documentation again ...
  8. and no more constraints on this phrase ...
  9. followed by any material within the same sentence ...
  10. followed by an other phrase ...
  11. which contains a word having value H for feature g_cons ...
  12. directly followed by an other word, and we say focus to require that this word will be highlighted in the results ...
  13. and no more constraints for this phrase ...
  14. and no more constraints for this sentence.

Warning

It is easy to write down queries with very many results, more than you and the system can handle. A typical pattern to watch out for is this:

select all objects where
[word]
..
[word]
..
[word]

This query has over 10,000,000,000,000,000 results. You need a million 1 TB external disks to store them all. SHEBANQ cannot deliver this. Probably it is not what you want anyway. SHEBANQ will give up when you try this. Even so, it may cost several minutes for the system to do so.

The number of results can be reduced greatly by saying

select all objects where
[sentence
    [word]
    ..
    [word]
    ..
    [word]
]

This query has roughly 1,000,000 results. A million results is perfectly doable for SHEBANQ.

Further reading

Consult the Ulrik Petersen's MQL Query Guide for really understanding the details.