public class ProgramGenerator
This class generates EDB (Extensional Database) and translate the schema constraints into a DLV program
No attributes for this class
No constructor for this class
For better comprehension of the class, the figure underlying illustrates the dependencies between methods.
public static java.util.ArrayList<java.lang.String> generateProgram (Query relQ, java.util.ArrayList <TCStatement> tcs, boolean semantics, Schema schema, boolean isThereComparisons ) throws CycleException, PrimaryKeyViolationException
This method managing all the process of generation of the DLV program.
Parameters:
Returns:
Exceptions:
private static java.lang.String makeEDB (Query relQ, boolean isUnfolding)
An internal auxiliary function, needed for conversion of query to prototypical EDB.
Parameters:
Returns:
private static java.util.ArrayList<java.lang.String> makeP_TC (java.util.ArrayList <TCStatement> tcs, boolean isUnfolding)
Creates the line of the program related to a list of rules out of a set of TC statements
Parameters:
Returns:
private static java.lang.String makeQ_a (Query Q, boolean semantics, boolean isUnfolding)
This method generates line of program for a given query
Parameters:
Returns:
private static java.util.ArrayList<java.lang.String> makeFDC_Rules ( java.util.ArrayList<FiniteDomainConstraint> fdcs)
This method generates the lines of program for all the finite domain constraints selected.
Parameter:
Returns:
private static java.lang.String createValFunctionalityContraint ()
Returns:
public static java.lang.String generatePredicateOriginal (Query query)
This method generates the lines of program for the original predicate.
Parameter:
Returns:
static java.lang.String makeEDB_Atom (Atom atom, boolean isUnfolding)
An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB.
Parameters:
Return
private static java.lang.String TCToString (TCStatement tc, boolean isUnfolding)
An internal auxiliary function converts TCStatement into a string readable by DLV as a rule TC = (R(s),G) is converted into R_a(s) :- R(s), G; Parameters:
Return
static Atom makeBodyAtom (Atom atom, boolean semantics, boolean isUnfolding, java.util.ArrayList<Term> distinguished)
Parameters:
Return
static Atom make_a (Atom atom)
This function takes an atom and return the same one but with _a prefix to the name
Parameters:
Return
static java.lang.String make_Q_a_vals (Atom atom, Atom unfoldedAtom, boolean semantics, boolean isUnfolding, java.util.ArrayList<Term> distinguished)
Parameters:
Return
public static java.util.ArrayList<java.lang.String> makeSkolemRule (ForeignKey fk, boolean isUnfolding)
Apply Skolem rule to foreign key
Parameters:
Return
public static java.lang.String makeAuxRule (ForeignKey fk, boolean isUnfolding)
Create aux rule from a foreign key
Parameters:
Return
public static java.lang.String makeCopyRule (ForeignKey fk, boolean isUnfolding)
Make the copy rule for a given foreign key
Parameters:
Return
static java.lang.String unfoldTC_Atom (Atom atom, boolean isUnfolding)
Creates the line of code related to unfolded atom of the TC-statement
Parameters:
Return
static java.lang.String make_a (java.lang.String atom){
This function takes an atom (in String format) and return the same one but with _a prefix to the name
Parameters:
Return
static java.lang.String makeVal (Term a, Term b)
Create the val line of code for two terms
Parameters:
Return
private static java.lang.StringBuilder createMaybe_V_vector_Y (boolean isUnfolding, int keyTarget)
Parameters:
Return
private static StringBuilder create_vector_Y (int keyTarget)
Parameters:
Return