• 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.14.1 Managing (dynamic) predicates
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Database
          • Managing (dynamic) predicates
            • abolish/1
            • abolish/2
            • copy_predicate_clauses/2
            • redefine_system_predicate/1
            • retract/1
            • retractall/1
            • asserta/1
            • assertz/1
            • assert/1
            • asserta/2
            • assertz/2
            • assert/2
            • Transactions
            • Impact of transactions
    • Packages
Availability:built-in
[ISO]asserta(+Term)
[ISO]assertz(+Term)
[deprecated]assert(+Term)
Assert a clause (fact or rule) into the database. The predicate asserta/1 asserts the clause as first clause of the predicate while assertz/1 assert the clause as last clause. The deprecated assert/1 is equivalent to assertz/1. If the program space for the target module is limited (see set_module/1), asserta/1 can raise a resource_error(program_space) exception. The example below adds two facts and a rule. Note the double parentheses around the rule.
?- assertz(parent('Bob', 'Jane')).
?- assertz(female('Jane')).
?- assertz((mother(Child, Mother) :-
                parent(Child, Mother),
                female(Mother))).
ClioPatria (version V3.1.1-51-ga0b30a5)