This class is used for calculate the specializations of a given query.
public static long executionTime; public static boolean PROLOG_SELECTION; public static String prolog_encoding; public static String queryForProlog; public static String metaProlog; public static String commandQuery; public static String encodingGUI;
No constructor for this class
public static Query getQueryGeneralizations (Query query, java.util.ArrayList<TCStatement> currentTCs, Schema currentSchema, int maximal) throws Exception
Main method of this class, that given an incomplete query computes complete query specializations of that query given that currentTCs are true and schema constraints from currentSchema holds. Based on the constant PROLOG_SELECTION, Magik runs two different prolog engines.
Called by:
Parameters:
Returns:
Throws:
public static Query getQueryGeneralizationsSWI (Query query, java.util.ArrayList<TCStatement> currentTCs, Schema currentSchema, int maximal) throws Exception
Method that manage the query specializations algorithm for SWI Prolog
Parameters:
Returns:
Throws:
public static Query getQueryGeneralizationsTuProlog (Query query, java.util.ArrayList<TCStatement> currentTCs, Schema currentSchema, int maximal) throws Exception
Method that manage the query specializations algorithm for Tu Prolog
Parameters:
Returns:
Throws:
public static java.lang.String generateInput (java.util.ArrayList<TCStatement> currentTCs, Schema schema, int maxQSpecSize)
Method that encodes in Prolog currentSchema and TC-statements
Parameters:
Returns:
public static java.lang.String generateInput (java.util.ArrayList<TCStatement> currentTCs, Schema schema, int maxQSpecSize)
Method that encodes in Prolog currentSchema and TC-statements
Parameters:
Returns:
public static java.util.ArrayList<java.lang.String> generatePrologEnfFKs (java.util.ArrayList<ForeignKey> fks)
Method that encodes in Prolog Foreign Keys enforced
public static java.util.ArrayList<java.lang.String> generatePrologRels (Schema schema)
Method that encodes in Prolog relations of the schema selected
public static java.util.ArrayList<java.lang.String> generatePrologEnfTCs (java.util.ArrayList<TCStatement> tcs)
Method that encodes in Prolog TC-Statements
public static java.util.ArrayList<java.lang.String> generatePrologFDCs (java.util.ArrayList<FiniteDomainContraint> fdcs)
Method that encodes in Prolog finite domain constraints. For each FDC we call generatePrologFDC.
public static java.lang.String generatePrologFDCs (FiniteDomainContraint fdc)
Method that encodes in Prolog a finite domain constraint.
private static java.lang.String createInputFile (java.util.ArrayList<java.lang.String> prologFKsNotEnf, java.util.ArrayList<java.lang.String> prologFKsEnf, java.util.ArrayList<java.lang.String> prologRels, java.util.ArrayList<java.lang.String> prologPKs, java.util.ArrayList<java.lang.String> prologTCs, java.lang.String prologFDCs, java.lang.String prologQuery)
Method that creates the final Prolog string for the schema, query and tc-statements.
private static java.lang.String createInputGUI (java.util.ArrayList<java.lang.String> prologFKsNotEnf, java.util.ArrayList<java.lang.String> prologFKsEnf, java.util.ArrayList<java.lang.String> prologRels, java.util.ArrayList<java.lang.String> prologPKs, java.util.ArrayList<java.lang.String> prologTCs, java.lang.String prologFDCs)
Method that creates the final Prolog string for the schema and tc-statements that MAGIK will visualize in the GUI.
public static java.util.ArrayList<java.lang.String> generatePrologNotEnfFKs (java.util.ArrayList<ForeignKey> fks)
Method that reads the file with the program that runs the input generated (used in GUI)
public static java.lang.String generateQuery (Query query)
Method that generate a part of the command used for call specialization algorithm
public static java.lang.String generateCommand (java.lang.String q4p, int maximal)
Method that generate the command used for call specialization algorithm
public static java.util.ArrayList<Query> parseQuerySpecializationsTuProlog (Query query, Schema schema, SolveInfo info) throws ContextException, NoSolutionException
Method that analyses the solutions given by Prolog and returns the list of the specialization (if there are)
public static java.lang.String getProlog_enconding() public static void setProlog_enconding (java.lang.String prolog_enconding) public static java.lang.String getQueryForProlog() public static void setQueryForProlog(java.lang.String queryForProlog) public static java.lang.String getMetaProlog() public static void setMetaProlog(java.lang.String metaProlog) public static java.lang.String getCommandQuery() public static void setCommandQuery(java.lang.String commandQuery) public static long getExecutionTime() public static void setExecutionTime(long executionTime) public static java.lang.String getEncodingGUI() public static void setEncodingGUI(java.lang.String encodingGUI)