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

public class SchemaUnfolder extends LogicSchemaTransformationProcess
This class is responsible for recursively unfolding the positive derived literals of a logic schema.

For instance, if the logic schema contains: :- Der1(x), Base1(x)
Der1(x) :- Base2(x)
Der1(x) :- Der2(x)
Der2(x) :- Base3(x)

This class returns:
:- Base2(x), Base1(x)
:- Base3(x), Base1(x)
Der1(x) :- Base2(x)
Der1(x) :- Base3(x)
Der2(x) :- Base3(x)

This class, by default, applies the standard unfolding. That is, it only unfolds positive literals. However, this class can also apply, if desired, some unfoldings over negated derived literals. For instance, if the logic schema contains: :- P(x), not(Derived(x))
Derived(x) :- A(x)
The unfolding can return:
:- P(x), not(A(x))

To apply the positive and also negated literal unfoldings, please, instantiate the class with unfoldNegatedLiterals set to true.

To see the cases in which such unfolding can be performed, please,check OrdinaryLiteral class

See Also:
  • Constructor Details

    • SchemaUnfolder

      public SchemaUnfolder(MultipleConstraintIDGenerator multipleConstraintIDGenerator, boolean unfoldNegatedLiterals)
      Creates an SchemaUnfolder that will use the given multipleConstraintIDGenerator strategy for creating new constraintIDs, if necessary.
      Parameters:
      multipleConstraintIDGenerator - not null
      unfoldNegatedLiterals - , if true, the method tries to unfold negated literals too
    • SchemaUnfolder

      public SchemaUnfolder(boolean unfoldNegatedLiterals)
      Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use the unfolding specified by parameter
    • SchemaUnfolder

      public SchemaUnfolder()
      Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use the standard unfolding
  • Method Details

    • executeTransformation

      public SchemaTransformation executeTransformation(LogicSchema logicSchema)
      Parameters:
      logicSchema - not null
      Returns:
      a schema transformation where the final schema has the same (based and derived) predicates as the one given but unfolding all the positive derived literals
    • unfold

      public LogicSchema unfold(LogicSchema schema)
      Parameters:
      schema - not null
      Returns:
      a new schema with the same (based and derived) predicates as the one given but unfolding all the positive derived literals