Class SchemaUnfolder
- All Implemented Interfaces:
LogicProcess
,SchemaTransformationProcess
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
-
Constructor Summary
ConstructorDescriptionCreates an SchemaUnfolder that will use the SuffixMultipleConstraintIDGenerator as a strategy for creating new constraintIDs, if necessary; and use the standard unfoldingSchemaUnfolder
(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 parameterSchemaUnfolder
(MultipleConstraintIDGenerator multipleConstraintIDGenerator, boolean unfoldNegatedLiterals) Creates an SchemaUnfolder that will use the given multipleConstraintIDGenerator strategy for creating new constraintIDs, if necessary. -
Method Summary
Modifier and TypeMethodDescriptionexecuteTransformation
(LogicSchema logicSchema) unfold
(LogicSchema schema) Methods inherited from class edu.upc.fib.inlab.imp.kse.logics.logicschema.services.processes.LogicSchemaTransformationProcess
checkLogicSchema, execute
-
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 nullunfoldNegatedLiterals
- , 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
- 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
- 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
-