Getting start

Our cnl specification consists of two main blocks. In the first block, you have to define all the concepts of the problem, where in our context a concept is a thing, a place, a person or an object that is used to model entities of the application domain of the CNL (see Concepts definition). The second block, on the other hand, constitutes the rules of the problem, i.e. the assignments and constraints.

Each block is made of a series of propositions, each one ending with a “.” (dot).

How to read the documentation

Each section explains a feature of the CNL with examples and the corresponding ASP translation. Some sections include parts of the CNL grammar. In such case, the following syntax is used:

STATEMENT_NAME -> "terminal symbol" VARIABLE? STAR_QUANTIFIER* PLUS+ | SOMETHING_ELSE

where STATEMENT_NAME is the name given to the statement, terminal symbols are between “” (quotation marks), and VARIABLE is a reference to other STATEMENT_NAME. Finally, the ? (question mark) means that the previous element is optional, the * (asterisk) means that the preceding element can match zero or more times, the + (plus) must match at least once, and the | (vertical bar) is the or symbol, thus the statement can support the previous or the following element.

Installation and usage

Cnl2asp is available on pip:

pip install cnl2asp

Source files can be found at https://github.com/dodaro/cnl2asp . The basic usage is:

cnl2asp input_file [output_file]

where input_file is a text file containing the CNL specification, while output_file is the file in which the output will be save. In case the output file is not provided, the output is printed in stdout.

Flags:

  • -c or --check-syntax, when provided the tool gives in output a meaningful message specifying if the input is recognised by CNL2ASP grammar,

  • -p or --print-with-functions, whenever an attribute of an atom is declared to be an entity, the tool prints that attribute as a function with the entity name as function name,

  • --symbols, return the list of all the defined entities with their corresponding attributes.

  • -o or --optimize, after the CNL is converted into ASP, the tool will call ngo and optimize the output.

  • --solve=[clingo|telingo] the tool calls the corresponding solver and print a cnl-translated output

Dependencies:

  • lark

  • inflect