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

4.11.1 Printing from libraries
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Printing messages
          • Printing from libraries
            • Referring to predicates from a message
              • predicate_reference//1
              • predicate_reference//2
              • predicate_definition//2
              • predicate_kind/2
    • Packages

4.11.1.1 Referring to predicates from a message

Many messages refer to a predicate. Rather than formatting the predicate indicator yourself, use the grammar rules below. They are defined in the system module $messages and are declared public, i.e., they must be called with an explicit module qualification. Using them makes the reference consistent with the messages of the system: the predicate indicator is written using the code style class and, if the source location of the predicate is known, it becomes a hyperlink to its definition on terminals that support this (see section 2.5 and the Prolog flag hyperlink_term). This works for predicates defined in C as well, provided the system can resolve the address of the implementing function.

prolog:message(no_such_predicate(PI)) -->
        [ 'There is no ' ],
        '$messages':predicate_reference(PI).
predicate_reference(+Spec)//
predicate_reference(+Spec, +Options)//
Emit a reference to a predicate. Spec is a (possibly module qualified) head or predicate indicator. Non-terminals are printed using the // notation. Options:
module(Which)
One of auto (default), hide or show. Using auto, the module qualification is removed if it is user, system or a system internal module.
link(Bool)
If false, do not create a hyperlink. Default is true.
style(Class)
Style class for the reference. Default is code.
tag(Bool)
If true, add a tag that indicates the kind of the predicate. Default is false. This is intended for messages that list candidate predicates, one per line.
predicate_definition(+Spec, +Message)//
Emit “Message at File:Line” on a new line if the location of Spec is known and nothing at all if it is not.
[semidet]predicate_kind(+Spec, -Kind)
Classify a predicate as iso, built_in, foreign, library(Name), module(Module), user or undefined. This is the classification used by the tag(true) option above. Fails if Spec does not denote a predicate.

ClioPatria (version V3.1.1-59-g7b9a7a3)