This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
magik-demo:developer:class:core:programgenerator [2013/07/25 15:14] alex [generateProgram] |
magik-demo:developer:class:core:programgenerator [2017/07/06 15:24] (current) |
||
---|---|---|---|
Line 171: | Line 171: | ||
---- | ---- | ||
- | ==== makeEDB_Atom ==== | + | ==== TCToString ==== |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | private static java.lang.String TCToString (TCStatement tc, |
- | boolean isUnfolding) | + | boolean isUnfolding) |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | 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:** | **Parameters:** | ||
Line 186: | Line 185: | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * String with the TC-statement convert into line of code |
---- | ---- | ||
- | + | ==== makeBodyAtom ==== | |
- | ==== makeEDB_Atom ==== | + | |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static Atom makeBodyAtom (Atom atom, |
- | boolean isUnfolding) | + | boolean semantics, |
+ | boolean isUnfolding, | ||
+ | java.util.ArrayList<Term> distinguished) | ||
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | |
**Parameters:** | **Parameters:** | ||
- | + | * atom - atom | |
- | * atom - atom that we want to convert | + | * semantics - //TRUE// if distinct-set semantics, //FALSE// if none-multiset semantics |
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
+ | * distiguished - list of the terms distinguished | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * Atom with the distinguished terms |
---- | ---- | ||
- | + | ==== make_a(Atom) ==== | |
- | ==== makeEDB_Atom ==== | + | |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static Atom make_a (Atom atom) |
- | boolean isUnfolding) | + | |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | This function takes an atom and return the same one but with _a prefix to the name |
**Parameters:** | **Parameters:** | ||
* atom - atom that we want to convert | * atom - atom that we want to convert | ||
- | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * atom with _a prefix to the name |
---- | ---- | ||
- | + | ==== make_Q_a_vals ==== | |
- | ==== makeEDB_Atom ==== | + | |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static java.lang.String make_Q_a_vals (Atom atom, |
- | boolean isUnfolding) | + | Atom unfoldedAtom, |
+ | boolean semantics, | ||
+ | boolean isUnfolding, | ||
+ | java.util.ArrayList<Term> distinguished) | ||
</code> | </code> | ||
- | |||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | ||
**Parameters:** | **Parameters:** | ||
* atom - atom that we want to convert | * atom - atom that we want to convert | ||
+ | * unfoldedAtom - atom unfolded | ||
+ | * semantics - //TRUE// if distinct-set semantics, //FALSE// if none-multiset semantics | ||
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
+ | * distiguished - list of terms distinguished | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * String with val in query Q_a |
---- | ---- | ||
- | ==== makeEDB_Atom ==== | + | ==== makeSkolemRule ==== |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | public static java.util.ArrayList<java.lang.String> makeSkolemRule (ForeignKey fk, |
- | boolean isUnfolding) | + | boolean isUnfolding) |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | Apply Skolem rule to foreign key |
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | + | * fk - foreign key |
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * list of ... |
---- | ---- | ||
- | + | ==== makeAuxRule ==== | |
- | ==== makeEDB_Atom ==== | + | |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | public static java.lang.String makeAuxRule (ForeignKey fk, |
- | boolean isUnfolding) | + | boolean isUnfolding) |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | Create aux rule from a foreign key |
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | + | * fk - foreign key to convert |
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * Line of code for aux rule for foreign key |
---- | ---- | ||
- | |||
==== makeEDB_Atom ==== | ==== makeEDB_Atom ==== | ||
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | public static java.lang.String makeCopyRule (ForeignKey fk, |
- | boolean isUnfolding) | + | boolean isUnfolding) |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | Make the copy rule for a given foreign key |
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | + | * fk - foreign key that needs the copy rule |
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * Line of code for copy rule related to the foreign key |
+ | ---- | ||
+ | ---- | ||
---- | ---- | ||
- | ==== makeEDB_Atom ==== | + | ==== unfoldTC_Atom ==== |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static java.lang.String unfoldTC_Atom (Atom atom, |
- | boolean isUnfolding) | + | boolean isUnfolding) |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | Creates the line of code related to unfolded atom of the TC-statement |
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | + | * atom - atom that we want to unfold |
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * Line of code generated for the unfolded atom |
---- | ---- | ||
- | ==== makeEDB_Atom ==== | + | ==== make_a (String) ==== |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static java.lang.String make_a (java.lang.String atom){ |
- | boolean isUnfolding) | + | |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | This function takes an atom (in String format) and return the same one but with _a prefix to the name |
**Parameters:** | **Parameters:** | ||
* atom - atom that we want to convert | * atom - atom that we want to convert | ||
- | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * String of the atom with the _a prefix |
---- | ---- | ||
- | + | ==== makeDoubleVal ==== | |
- | ==== makeEDB_Atom ==== | + | |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static java.lang.String makeDoubleVal (Term a, |
- | boolean isUnfolding) | + | Term b) |
</code> | </code> | ||
- | |||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | ||
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | + | * a - term |
- | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | + | * b - term |
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * String |
---- | ---- | ||
- | ==== makeEDB_Atom ==== | + | ==== makeVal ==== |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | static java.lang.String makeVal (Term a, |
- | boolean isUnfolding) | + | Term b) |
</code> | </code> | ||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | + | Create the val line of code for two terms |
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | + | * a - term |
- | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | + | * b - associated term to assign to term a |
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * Val rule for the term a assigned the value of the term b |
---- | ---- | ||
- | ==== makeEDB_Atom ==== | + | ==== createMaybe_V_vector_Y ==== |
<code java> | <code java> | ||
- | static java.lang.String makeEDB_Atom (Atom atom, | + | private static java.lang.StringBuilder createMaybe_V_vector_Y (boolean isUnfolding, |
- | boolean isUnfolding) | + | int keyTarget) |
</code> | </code> | ||
- | |||
- | An internal auxiliary function, needed for conversion of atoms of the query to prototypical EDB. | ||
**Parameters:** | **Parameters:** | ||
- | * atom - atom that we want to convert | ||
* isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | * isUnfolding - //TRUE// if unfolding needed, //FALSE// no unfolding | ||
+ | * keyTarget - key taget | ||
**Return** | **Return** | ||
- | * String with the extensional database definition of the atom | + | * String Builder |
---- | ---- | ||
+ | ==== create_vector_Y ==== | ||
+ | |||
+ | <code java> | ||
+ | private static StringBuilder create_vector_Y (int keyTarget) | ||
+ | </code> | ||
+ | |||
+ | **Parameters:** | ||
+ | |||
+ | * keyTarget - index of the key target | ||
+ | |||
+ | **Return** | ||
+ | * String Builder | ||
+ | [[magik-demo:developer:class:core:programgenerator|Back to Top]] | [[magik-demo:start|Back to Home Page]] |