• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

8.3.2 Constraint declaration
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • CHR: Constraint Handling Rules
        • CHR in SWI-Prolog Programs
          • Constraint declaration
            • chr_constraint/1
            • chr_type/1
    • Packages
:- chr_constraint(+Specifier)
Every constraint used in CHR rules has to be declared with a chr_constraint/1 declaration by the constraint specifier. For convenience multiple constraints may be declared at once with the same chr_constraint/1 declaration followed by a comma-separated list of constraint specifiers.

A constraint specifier is, in its compact form, F/A where F and A are respectively the functor name and arity of the constraint, e.g.:

:- chr_constraint foo/1.
:- chr_constraint bar/2, baz/3.

In its extended form, a constraint specifier is c(A_1, ... ,A_n) where c is the constraint's functor, n its arity and the A_i are argument specifiers. An argument specifier is a mode, optionally followed by a type. Example:

:- chr_constraint get_value(+,?).
:- chr_constraint domain(?int, +list(int)),
                  alldifferent(?list(int)).

ClioPatria (version V3.1.1-51-ga0b30a5)