Thursday, 04 July 2013
Home arrow ContractLog  
Main Menu
User Menu
Other Menu
Reaction RuleML
Rule Responder
ContractLog: Knowledge Representation for Contracts, Policies and SLAs
Written by Adrian Paschke   
Thursday, 23 November 2006

The ContractLog KR

ContractLog KR 0.2 and Examples

The ContractLog KR is the formal logical core of the RBSLA approach. It combines several adequate logical formalisms and rule types needed for the representation and automated execution of SLAs respectively policies, e.g., event-based ECA rules, temporal and modal logics, logical updates for dynamically evolving the knowledge base as well as concepts from Semantic Web description logics, active databases and defeasible reasoning to describe event based SLA rules, rights and obligations, domain specific contract vocabularies, contract modules with rule precedences, exceptions and default rules.

ContractLog is implemented on top of the backward-reasoning rule engine Prova, an open source java-based rule engine for backward reasoning derivation rules (serial horn rules). Since the Prova 2.0 version it is integrated into the Prova distribution. It uses the Prova lanugage extension which provides a LP scripting language related to the ISO Prolog syntax. ContractLog implements a novel configurable inference service which extends the Prova SLDNF resolution with different selectable semantics such as variants of standard SLDNF with Java and Semantic Web typed rules and novel linear resolutions supporting configurable linear goal memoization, loop prevention, sequential operators, for well-founded semantics of generalized and extended LPs. The engine provides several extensions to Prova to run active, multi-threaded reaction rules which can be homogeneously represented and combined with derivation rules and other rule types such as deonic rules, integrity rules or defeasible rules in the same representation language (more info). It is fully configurable and allows selection of different semantics to execute a Prova/ContractLog LP. In addition, the ContractLog KR provides a rich library of script files (modules) which contain the different implementations of the (non-monotonic) logical formalisms written as LP meta programs such as defeasible reasoning, integrity reasoning, interval-based event/action algebra, temporal event/action reasoning, declarative transactional ID-based updates, deontic reasoning, scoped reasoning on distributed orderedLPs (OLPs) etc. The external modules can be load via expressive ID-based update functions on a "per-need" basis to the knowledge base and hence faciliate distributed management, scoped module based reasoning and dynamic adpation / changes of the rules and allow coping with the well-known tradeoff between expressiveness and computational performance. In a nutshell the main features of the ContractLog KR are,

  • A novel configurable inference service provided as a stand-alone application or web serivce with selectable semantics variants reaching from standard SLDNF resolution and different variants to well-founded semantics for generalized and extended LPs basd on efficient and complete linear resolution variants with (sub-)goal memoization, loop-prevention and highly efficient memory structures with extended key indexing for faster access on complex literals (e.g. defeasible(p(X))) and recursion optimization via tail call elimination and outer iterations in trampoline style
  • Test suites with collections of LP based test cases with regression, performance, function/inference and meta tests to verify and validate the ContractLog inference engine with its different selectable semantics and logic formalisms and to test correctness of execution of possible intechanged rule bases. The test-driven apprach provides support for JUnit and Ant to develop and test LPs in IDEs such as eclipse.
  • A typed logic with a typed unification supporting Semantic Web ontology languages such as RDFS or OWL and Java (coming with the  Prova engine)
  • An active ECA processor which combines reactive rules and derivation rules and supports parallel execution of extended ECA rules, (transactional) ID-based updates and active rules, sensing and triggering of external functions/systems via procedural attachments and complex interval-based event processing via an event calculus based event/action algebra.
  • A novel interval-based Event Calculus variant with support for temporal reasoning about transient and non-transient events and their effects on the (dynamic) knowledge systems
  • A temporal deontic logic for deriving role-based, temporal norms such as permissions, prohibitions, obligations with exceptions and (contrary-to-duty) violations and (defeasible) conflict resolution
  • Support for integrity constraints and ID-based knowledge updates which enables partial/scoped reasoning, transactional updates with validation against the constraints and ID based (bulk) updates of new knowledge, (external) modules, i.e. revision/updating and modularity of ID based rule sets and in general evolving of rules and facts in the KB.
  • Support for test-driven development based on test cases for logic programs including support for JUnit and test coverage measurement.
  • Support for rule interchange via attached test cases, meta test suits for V&V of inference engines and expressive integrity constraints
  • Defeasible reasoning on ordered logic programs (OLPs) in combination with integrity constraints to handle un-known and conflicting knowledge and define default, exceptional, priority relations between rules and complete rule sets (modules) in order to overcome rule conflicts.
  • A meta-data annotated labelled logic to annotate rules with meta data such as rule names, module names, Dublin Core annotations and bundle rules and facts to modules (rule / clause sets) which are managed by their module IDs  and which can be used to explicitly close open environments such as the Semantic Web for scoped reasoning on parts of the distributed knowledge of an ordered LP (OLP).
  • A rich library of use-full predicates for mathematical, date, time and interval based functions and operators.
    ContractLog is mainly written in Prova syntax as a collection of scripts implementing the respective formalisms and meta programs, which can be imported on a per-need basis.

The following table gives a high-level overview on the selected and implemented formalisms in the ContractLog KR:




Extended Logic Programs

Derivation Rules and extended LPs

Deductive reasoning on SLA rules extended with negation-as-finite-failure and explicit negation.

Typed and Meta-Data annotated Labelled Logic



Object-oriented Typed Logic and Procedural Attachments + Meta-Data Labels such as IDs or Dublin Core Annotations

Typed terms restrict the search space and enable object-oriented software engineering principles. Procedural attachments integrate object oriented programming into declarative rules. Labelled rule sets (modules) can be used for scoped reasoning on explicitly closed parts of the knowledge in open environments such as the Sematnic Web with distributed ordered LPs (OLPs).

--> integration of external systems and meta annotation
--> scoped reasoning on explicitly "closed" distributed modules (rule bases) 

Description Logic



Hybrid Description Logic Types and Semantic Web Ontology Languages

Semantic domain descriptions (e.g., contract ontologies) in order to describe rules domain-independent. 
--> external contract/domain vocabularies

(Re)active Logic

Extended Event-Condition-Action Rules (ECA) with ID-based Updates, Rollbacks, Complex Events/Actions, Active Rules

Active event detection/event processing and event-triggered actions. 

--> reactive rules.

Temporal Logic

Event Calculus

Temporal reasoning about dynamic systems, e.g. interval-based complex event definitions (event algebra) or effects of events on the contract state;  contract state tracking; reasoning about events/actions and their effects

Deontic Logic


Deontic Logic with norm violations and exceptions

Rights and obligations formalized as deontic contract norms with norm violations (contrary-to-duty obligations) and exceptions (conditional. defeasible obligations)
-->normative deontic rules.

Integrity Preserving, Preferenced, Defeasible Logic


Defeasible Logic and Integrity Constraints

Default rules and priority relations of rules. Facilitates conflict detection and resolution as well as revision/updating and modularity of rules with preferences or rules and modules in ordered LPs (OLPs). 

--> default rules and rule priorities

Test Logic

Test-driven Verification and Validation for Rule Bases

Validation and Verification of SLA specifications against predefined SLA requirements

--> safeguards the engineering, dynamic adaption and interchange process of SLAs


ContractLog KR 0.2

ContractLog v. 0.2 and examples


Sourceforge RBSLA / ContractLog v. 0.2

For more information on ContractLog see the publications

Last Updated ( Wednesday, 13 December 2006 )
2013 rbsla
Copyright Adrian Paschke - Some rights reserved