Table of Contents

Program Generator

public class ProgramGenerator

This class generates EDB (Extensional Database) and translate the schema constraints into a DLV program

Class Attributes

No attributes for this class

Class Constructor

No constructor for this class

Class Methods

For better comprehension of the class, the figure underlying illustrates the dependencies between methods.


generateProgram

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:




makeEDB

private static java.lang.String makeEDB (Query relQ, 
                                         boolean isUnfolding)

An internal auxiliary function, needed for conversion of query to prototypical EDB.

Parameters:

Returns:


makeP_TC

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:


makeQ_a

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:


makeFDC_Rules

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:


createValFunctionalityContraint

private static java.lang.String createValFunctionalityContraint ()

Returns:


generatePredicateOriginal

public static java.lang.String generatePredicateOriginal (Query query)

This method generates the lines of program for the original predicate.

Parameter:

Returns:




makeEDB_Atom

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


TCToString

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


makeBodyAtom

static Atom makeBodyAtom (Atom atom, 
                          boolean semantics, 
                          boolean isUnfolding, 
                          java.util.ArrayList<Term> distinguished)

Parameters:

Return


make_a(Atom)

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


make_Q_a_vals

static java.lang.String make_Q_a_vals (Atom atom, 
                                       Atom unfoldedAtom, 
                                       boolean semantics, 
                                       boolean isUnfolding, 
                                       java.util.ArrayList<Term> distinguished)

Parameters:

Return


makeSkolemRule

public static java.util.ArrayList<java.lang.String> makeSkolemRule (ForeignKey fk, 
                                                                    boolean isUnfolding)

Apply Skolem rule to foreign key

Parameters:

Return


makeAuxRule

public static java.lang.String makeAuxRule (ForeignKey fk, 
                                            boolean isUnfolding)

Create aux rule from a foreign key

Parameters:

Return


makeEDB_Atom

public static java.lang.String makeCopyRule (ForeignKey fk, 
                                             boolean isUnfolding)

Make the copy rule for a given foreign key

Parameters:

Return




unfoldTC_Atom

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


make_a (String)

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


makeDoubleVal

static java.lang.String makeDoubleVal (Term a, 
                                       Term b)

Parameters:

Return


makeVal

static java.lang.String makeVal (Term a, 
                                 Term b)

Create the val line of code for two terms

Parameters:

Return


createMaybe_V_vector_Y

private static java.lang.StringBuilder createMaybe_V_vector_Y (boolean isUnfolding, 
                                                               int keyTarget)

Parameters:

Return


create_vector_Y

private static StringBuilder create_vector_Y (int keyTarget)

Parameters:

Return

Back to Top | Back to Home Page