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 Summary

    Constructors
    Constructor
    Description
    Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use the standard unfolding
    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(boolean unfoldNegatedLiterals, Set<String> excludePredicateNames)
    Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use the unfolding specified and exclude predicates to unfold by parameter
    SchemaUnfolder(MultipleConstraintIDGenerator multipleConstraintIDGenerator, boolean unfoldNegatedLiterals, Set<String> excludeDerivedPredicateNames)
    Creates an SchemaUnfolder that will use the given multipleConstraintIDGenerator strategy for creating new constraintIDs, if necessary.
    SchemaUnfolder(Set<String> excludePredicateNames)
    Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use exclude predicates to unfold by parameter
  • Method Summary

    Modifier and Type
    Method
    Description
     
     

    Methods inherited from class edu.upc.fib.inlab.imp.kse.logics.logicschema.services.processes.LogicSchemaTransformationProcess

    checkLogicSchema, execute

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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
    • SchemaUnfolder

      public SchemaUnfolder(Set<String> excludePredicateNames)
      Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use exclude predicates to unfold by parameter
    • 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(boolean unfoldNegatedLiterals, Set<String> excludePredicateNames)
      Creates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use the unfolding specified and exclude predicates to unfold by parameter
    • SchemaUnfolder

      public SchemaUnfolder(MultipleConstraintIDGenerator multipleConstraintIDGenerator, boolean unfoldNegatedLiterals, Set<String> excludeDerivedPredicateNames)
      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
      excludeDerivedPredicateNames - set of derived predicates names that should not be unfolded during the process
  • 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