Class SingleDerivationRuleTransformer

java.lang.Object
edu.upc.fib.inlab.imp.kse.logics.logicschema.services.processes.LogicSchemaTransformationProcess
edu.upc.fib.inlab.imp.kse.logics.logicschema.services.processes.SingleDerivationRuleTransformer
All Implemented Interfaces:
LogicProcess, SchemaTransformationProcess

public class SingleDerivationRuleTransformer extends LogicSchemaTransformationProcess

This class is in charge of transforming one logic schema into an equivalent logic schema where every derived predicate is defined, only, through one derivation rule.

To achieve so, this class replaces the derivation rule's head to avoid repeated predicates. E.g.:

P :- A, B
P :- C, D

is replaced by:
P_1 :- A, B
P_2 :- C, D

Consequently, any apparition of predicates which have been transformed (such as the predicate P in the previous example), is replaced by its new transformed predicates. E.g.:

:- P, R
:- S, not(P)

is transformed to:
:- P_1, R
:- P_2, R
:- S, not(P_1), not(P_2)

  • Constructor Details

    • SingleDerivationRuleTransformer

      public SingleDerivationRuleTransformer()
      Creates an SingleDerivationRuleTransformer that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary.
    • SingleDerivationRuleTransformer

      public SingleDerivationRuleTransformer(MultipleConstraintIDGenerator generatorId)
      Creates an SingleDerivationRuleTransformer that will use the given generatorId strategy for creating new constraintIDs, if necessary.
      Parameters:
      generatorId - not null
  • Method Details

    • executeTransformation

      public SchemaTransformation executeTransformation(LogicSchema logicSchema)
      Parameters:
      logicSchema - not-null
      Returns:
      a transformation where the final logicSchema is a new equivalent logic schema where every derived predicate is defined through only one derivation rule
    • transform

      public LogicSchema transform(LogicSchema logicSchema)
      Parameters:
      logicSchema - a not null logic schema
      Returns:
      a new equivalent logic schema where every derived predicate is defined through only one derivation rule