Last active
June 20, 2017 14:06
-
-
Save kenwebb/d78505ad6e4e6028ca4ed0c187485321 to your computer and use it in GitHub Desktop.
Categorical Data IDE - AQL - Finance Colim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue Jun 20 2017 10:06:10 GMT-0400 (EDT)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Categorical Data IDE - AQL - Finance Colim | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: d78505ad6e4e6028ca4ed0c187485321 | |
Keywords: | |
My Notes | |
-------- | |
June 11, 2017 | |
Use this template to create your own AQL-based workbook and app. | |
SQL | |
--- | |
/* | |
To view this file, download an open-source relational database product such as mysql or postgresql. | |
Automatically generated by Xholon version 0.9.1, using Xholon2Sql.java | |
Sun Jun 11 10:02:58 GMT-400 2017 1497189778740 | |
model: Categorical Data IDE - AQL - Finance Colim | |
www.primordion.com/Xholon | |
In MySQL, you will need to temporarily disable foreign keys while loading in this file: | |
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS; | |
SET FOREIGN_KEY_CHECKS=0; | |
source thenameofthisfile.sql; | |
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; | |
*/ | |
DROP TABLE IF EXISTS CatTheoryInstance; | |
CREATE TABLE IF NOT EXISTS CatTheoryInstance ( | |
ID int NOT NULL, | |
xhcID int NOT NULL, | |
$H int, | |
PRIMARY KEY (ID), | |
FOREIGN KEY (xhcID) REFERENCES XholonClass(ID)); | |
INSERT INTO CatTheoryInstance (ID, xhcID, $H) VALUES | |
(61, 8, 1346); | |
DROP TABLE IF EXISTS client; | |
CREATE TABLE IF NOT EXISTS client ( | |
ID int NOT NULL, | |
xhcID int NOT NULL, | |
roleName varchar(80) NOT NULL default '', | |
client_id int, | |
client_name varchar(80) NOT NULL default '', | |
client_description varchar(80) NOT NULL default '', | |
PRIMARY KEY (ID), | |
FOREIGN KEY (xhcID) REFERENCES XholonClass(ID)); | |
INSERT INTO client (ID, xhcID, roleName, client_id, client_name, client_description) VALUES | |
(54, 14, 'cc1', 1, 'Tom', 'Tom Client'); | |
INSERT INTO client (ID, xhcID, roleName, client_id, client_name, client_description) VALUES | |
(56, 14, 'cc2', 2, 'Dick', 'Dick Client'); | |
INSERT INTO client (ID, xhcID, roleName, client_id, client_name, client_description) VALUES | |
(58, 14, 'cc3', 3, 'Harry', 'Harry Client'); | |
DROP TABLE IF EXISTS XholonClass; | |
CREATE TABLE IF NOT EXISTS XholonClass ( | |
ID int NOT NULL, | |
xhcName varchar(80), | |
parentID int, | |
PRIMARY KEY (ID), | |
FOREIGN KEY (parentID) REFERENCES XholonClass(ID)); | |
INSERT INTO XholonClass (ID, xhcName, parentID) VALUES | |
(0, 'XholonClass', 0), | |
(1, 'Chameleon', 0), | |
(2, 'Quantity', 0), | |
(5, 'PhysicalSystem', 0), | |
(6, 'CattSystem', 0), | |
(7, 'CatTheorySchema', 0), | |
(8, 'CatTheoryInstance', 0), | |
(9, 'Integer', 0), | |
(10, 'String', 0), | |
(11, 'Double', 0), | |
(12, 'Boolean', 0), | |
(13, 'Date', 0), | |
(14, 'client', 0); | |
Graphviz | |
-------- | |
/* | |
Automatically generated by Xholon version 0.8.1, using org.primordion.ef.Xholon2Graphviz.java | |
Sun Jun 11 10:09:18 GMT-400 2017 1497190158854 | |
model: Categorical Data IDE - AQL - Finance Colim | |
www.primordion.com/Xholon | |
To view this file, use Graphviz dot|fdp|neato|twopi|circo|sfdp from http://www.graphviz.org/ | |
For example, to generate an SVG file: | |
dot -Tsvg -O CattSystem_47_1497190158854.gv | |
Alternatively try one of these: | |
dot -Tsvg -O CattSystem_47_1497190158854.gv | |
dot -Tsvg -O -Grankdir=LR CattSystem_47_1497190158854.gv | |
fdp -Tsvg -O CattSystem_47_1497190158854.gv | |
neato -Tsvg -O CattSystem_47_1497190158854.gv | |
circo -Tsvg -O CattSystem_47_1497190158854.gv | |
Or use one of: -Tgif -Tjpg -Tpdf -Tpng -Txdot -Txlib | |
See also: http://hughesbennett.net/Graphviz | |
See also: http://graphviz-dev.appspot.com/ | |
See also: http://www.webgraphviz.com/ | |
See also: http://rise4fun.com/agl/ | |
To repeat this Xholon export: | |
$wnd.xh.xport("Graphviz", $wnd.xh.root().parent().xpath("Chameleon/CattSystem"), '{"gvFileExt":".gv","gvGraph":"digraph","layout":"dot","edgeOp":"->","gvCluster":"","shouldShowStateMachineEntities":false,"filter":"--Behavior,Script","nameTemplateNodeId":"^^^^i^","nameTemplateNodeLabel":"R^^^^^","shouldQuoteLabels":true,"shouldShowLinks":true,"shouldShowLinkLabels":true,"shouldSpecifyLayout":false,"maxLabelLen":-1,"shouldColor":true,"defaultColor":"#f0f8ff","shouldSpecifyShape":true,"shape":"ellipse","shouldSpecifySize":false,"size":"6","shouldSpecifyFontname":false,"fontname":"\"Courier New\"","shouldSpecifyArrowhead":true,"arrowhead":"vee","shouldSpecifyStylesheet":true,"stylesheet":"Xholon.css","shouldSpecifyRankdir":false,"rankdir":"LR","shouldDisplayGraph":true,"outputFormat":"svg"}'); | |
*/ | |
digraph 47 { | |
graph [label="CattSystem",id="CattSystem",stylesheet="Xholon.css"] | |
node [style=filled,fillcolor="#f0f8ff",shape=ellipse] | |
edge [arrowhead=vee] | |
subgraph 60 { label="CatTheorySchema" id="CattSystem/CatTheorySchema" | |
48 [label="Integer" id="CattSystem/CatTheorySchema/Integer"] | |
49 [label="String" id="CattSystem/CatTheorySchema/String"] | |
50 [label="Double" id="CattSystem/CatTheorySchema/Double"] | |
51 [label="Boolean" id="CattSystem/CatTheorySchema/Boolean"] | |
52 [label="Date" id="CattSystem/CatTheorySchema/Date"] | |
53 [label="client" id="CattSystem/CatTheorySchema/client"] | |
53 -> 48 [label="client_id"]; | |
53 -> 49 [label="client_name"]; | |
53 -> 49 [label="client_description"]; | |
} | |
subgraph 61 { label="CatTheoryInstance" id="CattSystem/CatTheoryInstance" | |
54 [label="cc1" id="CattSystem/CatTheoryInstance/client[@roleName='cc1']"] | |
56 [label="cc2" id="CattSystem/CatTheoryInstance/client[@roleName='cc2']"] | |
58 [label="cc3" id="CattSystem/CatTheoryInstance/client[@roleName='cc3']"] | |
} | |
54 -> 53 [label="schema"]; 56 -> 53 [label="schema"]; 58 -> 53 [label="schema"]; | |
} | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<!-- | |
Put each statement on its own line, where possible. | |
Add a space before ":" if there is none | |
--> | |
<CatAql instances="true" schemas="true" separateSchemaInstance="true" xhcName_System="CattSystem" schemaNodeSuffix="" schemaRoleNameNoSuffix="true" pointToSchema="true" exportGraphviz="true" exportSql="true" exportXml="true" exportYaml="true"><![CDATA[ | |
//Example courtesy of Jee Chung | |
typeside Ty = literal { | |
java_types | |
Integer = "java.lang.Integer" | |
String = "java.lang.String" | |
Double = "java.lang.Double" | |
Boolean = "java.lang.String" | |
Date = "java.lang.String" | |
// Date = "java.util.Date" alternative type for dates | |
java_constants | |
Integer = "return java.lang.Integer.parseInt(input[0]);" | |
String = "return input[0]" | |
Double = "return java.lang.Double.parseDouble(input[0])" | |
Boolean = "return input[0]" | |
Date = "return input[0]" | |
// Date = "return (new java.text.SimpleDateFormat(\"m/d/yyyy\").parse(input[0]));" | |
java_functions | |
keygen : Integer,Integer,Integer -> Integer = "return (2^input[0] * 3^input[1] * 5^input[2])" | |
} | |
//////////////////////////////////////////////////////////////////////// | |
//Input schemas and instances separately | |
//////////////////////////////////////////////////////////////////////// | |
//compile time input | |
schema Client = literal : Ty { | |
entities | |
client | |
attributes | |
client_id : client -> Integer | |
client_name : client -> String | |
client_description : client -> String | |
} | |
//runtime input | |
instance ClientInstance = literal : Client { | |
generators | |
cc1 cc2 cc3 : client | |
multi_equations //alternative, less verbose syntax | |
client_id -> {cc1 "1", cc2 "2", cc3 "3"} | |
client_name -> {cc1 Tom, cc2 Dick, cc3 Harry} | |
client_description -> {cc1 "Tom Client", cc2 "Dick Client", cc3 "Harry Client"} | |
} | |
]]></CatAql> | |
<!-- a second CatAql subtree --> | |
<CatAql instances="true" schemas="true" separateSchemaInstance="true" xhcName_System="CattSystem" schemaNodeSuffix="s" schemaRoleNameNoSuffix="true" pointToSchema="true" exportGraphviz="true" exportSql="true" exportXml="true" exportYaml="true"><![CDATA[ | |
typeside Ty = literal { | |
java_types | |
Integer = "java.lang.Integer" | |
String = "java.lang.String" | |
Double = "java.lang.Double" | |
Boolean = "java.lang.String" | |
Date = "java.lang.String" | |
java_constants | |
Integer = "return java.lang.Integer.parseInt(input[0]);" | |
String = "return input[0]" | |
Double = "return java.lang.Double.parseDouble(input[0])" | |
Boolean = "return input[0]" | |
Date = "return input[0]" | |
java_functions | |
keygen : Integer,Integer,Integer -> Integer = "return (2^input[0] * 3^input[1] * 5^input[2])" | |
} | |
schema Portfolio = literal : Ty { | |
entities | |
strategy | |
portfolio | |
foreign_keys | |
portfolio_strategy : portfolio -> strategy | |
portfolio_parent_portfolio : portfolio -> portfolio | |
path_equations | |
portfolio_parent_portfolio.portfolio_parent_portfolio = portfolio_parent_portfolio | |
attributes | |
strategy_id : strategy -> Integer | |
strategy_name : strategy -> String | |
strategy_description : strategy -> String | |
portfolio_id : portfolio -> Integer | |
portfolio_name : portfolio -> String | |
portfolio_description : portfolio -> String | |
portfolio_client_id : portfolio -> Integer | |
portfolio_strategy_id : portfolio -> Integer | |
portfolio_parent_portfolio_id : portfolio -> Integer | |
observation_equations | |
forall p. p.portfolio_strategy.strategy_id = p.portfolio_strategy_id | |
forall p. p.portfolio_parent_portfolio.portfolio_id = p.portfolio_parent_portfolio_id | |
} | |
instance PortfolioInstance = literal : Portfolio { | |
generators | |
ps1 ps2 ps3 : strategy | |
pp1 pp2 pp3 : portfolio | |
equations | |
pp1.portfolio_parent_portfolio_id = "1" | |
pp1.portfolio_parent_portfolio = pp1 | |
pp2.portfolio_parent_portfolio_id = "2" | |
pp2.portfolio_parent_portfolio = pp2 | |
pp3.portfolio_parent_portfolio_id = "2" | |
pp3.portfolio_parent_portfolio = pp2 | |
ps1.strategy_id = "1" | |
ps1.strategy_name = Strat1 | |
ps1.strategy_description = Strategy1 | |
ps2.strategy_id = "2" | |
ps2.strategy_name = Strat2 | |
ps2.strategy_description = Strategy2 | |
ps3.strategy_id = "3" | |
ps3.strategy_name = Strat3 | |
ps3.strategy_description = Strategy3 | |
pp1.portfolio_id = "1" | |
pp1.portfolio_name = Port1 | |
pp1.portfolio_description = Portfolio1 | |
pp1.portfolio_client_id = "1" | |
pp1.portfolio_strategy_id = "2" | |
pp1.portfolio_strategy = ps2 | |
pp2.portfolio_id = "2" | |
pp2.portfolio_name = Port2 | |
pp2.portfolio_description = Portfolio2 | |
pp2.portfolio_client_id = "2" | |
pp2.portfolio_strategy_id = "2" | |
pp2.portfolio_strategy = ps2 | |
pp3.portfolio_id = "3" | |
pp3.portfolio_name = Port3 | |
pp3.portfolio_description = Portfolio3 | |
pp3.portfolio_client_id = "2" | |
pp3.portfolio_strategy_id = "1" | |
pp3.portfolio_strategy = ps1 | |
} | |
]]></CatAql> | |
</PhysicalSystem> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<?xml-stylesheet href="Xholon.css" type="text/css"?> | |
<!-- Generated by graphviz version 2.28.0 (20140111.2315) | |
--> | |
<!-- Title: 47 Pages: 1 --> | |
<svg width="494pt" height="249pt" | |
viewBox="0.00 0.00 494.00 248.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<g id="CattSystem" class="graph" transform="scale(1 1) rotate(0) translate(4 244.8)"> | |
<title>47</title> | |
<polygon fill="white" stroke="none" points="-4,4 -4,-244.8 490,-244.8 490,4 -4,4"/> | |
<text text-anchor="middle" x="243" y="-8.2" font-family="Times,serif" font-size="14.00">CattSystem</text> | |
<!-- 48 --> | |
<g id="CattSystem/CatTheorySchema/Integer" class="node"><title>48</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="38" cy="-42.8" rx="38.0712" ry="18"/> | |
<text text-anchor="middle" x="38" y="-38.6" font-family="Times,serif" font-size="14.00">Integer</text> | |
</g> | |
<!-- 49 --> | |
<g id="CattSystem/CatTheorySchema/String" class="node"><title>49</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="165" cy="-42.8" rx="34.4651" ry="18"/> | |
<text text-anchor="middle" x="165" y="-38.6" font-family="Times,serif" font-size="14.00">String</text> | |
</g> | |
<!-- 50 --> | |
<g id="CattSystem/CatTheorySchema/Double" class="node"><title>50</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="266" cy="-222.8" rx="39.1957" ry="18"/> | |
<text text-anchor="middle" x="266" y="-218.6" font-family="Times,serif" font-size="14.00">Double</text> | |
</g> | |
<!-- 51 --> | |
<g id="CattSystem/CatTheorySchema/Boolean" class="node"><title>51</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="367" cy="-222.8" rx="43.3294" ry="18"/> | |
<text text-anchor="middle" x="367" y="-218.6" font-family="Times,serif" font-size="14.00">Boolean</text> | |
</g> | |
<!-- 52 --> | |
<g id="CattSystem/CatTheorySchema/Date" class="node"><title>52</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="457" cy="-222.8" rx="28.9004" ry="18"/> | |
<text text-anchor="middle" x="457" y="-218.6" font-family="Times,serif" font-size="14.00">Date</text> | |
</g> | |
<!-- 53 --> | |
<g id="CattSystem/CatTheorySchema/client" class="node"><title>53</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="110" cy="-132.8" rx="32.2342" ry="18"/> | |
<text text-anchor="middle" x="110" y="-128.6" font-family="Times,serif" font-size="14.00">client</text> | |
</g> | |
<!-- 53->48 --> | |
<g id="CattSystem_edge1" class="edge"><title>53->48</title> | |
<path fill="none" stroke="black" d="M84.803,-121.481C73.6021,-115.732 61.1383,-107.539 53.0084,-96.8 47.366,-89.3469 43.8443,-79.8582 41.6465,-70.9751"/> | |
<polygon fill="black" stroke="black" points="39.6268,-60.9835 46.019,-69.8936 40.6175,-65.8844 41.6082,-70.7852 41.6082,-70.7852 41.6082,-70.7852 40.6175,-65.8844 37.1974,-71.6769 39.6268,-60.9835 39.6268,-60.9835"/> | |
<text text-anchor="middle" x="78.4958" y="-83.6" font-family="Times,serif" font-size="14.00">client_id</text> | |
</g> | |
<!-- 53->49 --> | |
<g id="CattSystem_edge2" class="edge"><title>53->49</title> | |
<path fill="none" stroke="black" d="M106.204,-114.514C104.734,-103.606 104.613,-89.5909 110.579,-78.8 114.916,-70.957 121.835,-64.6032 129.306,-59.5721"/> | |
<polygon fill="black" stroke="black" points="138.208,-54.2636 131.924,-63.2504 133.913,-56.8245 129.619,-59.3854 129.619,-59.3854 129.619,-59.3854 133.913,-56.8245 127.314,-55.5205 138.208,-54.2636 138.208,-54.2636"/> | |
<text text-anchor="middle" x="145.21" y="-83.6" font-family="Times,serif" font-size="14.00">client_name</text> | |
</g> | |
<!-- 53->49 --> | |
<g id="CattSystem_edge3" class="edge"><title>53->49</title> | |
<path fill="none" stroke="black" d="M139.165,-124.801C153.823,-119.649 170.284,-110.994 179,-96.8 184.047,-88.581 182.904,-78.5634 179.681,-69.4593"/> | |
<polygon fill="black" stroke="black" points="175.562,-60.0672 183.699,-67.4177 177.57,-64.6462 179.578,-69.2252 179.578,-69.2252 179.578,-69.2252 177.57,-64.6462 175.457,-71.0326 175.562,-60.0672 175.562,-60.0672"/> | |
<text text-anchor="middle" x="232.154" y="-83.6" font-family="Times,serif" font-size="14.00">client_description</text> | |
</g> | |
<!-- 54 --> | |
<g id="CattSystem/CatTheoryInstance/client[@roleName='cc1']" class="node"><title>54</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="38" cy="-222.8" rx="27" ry="18"/> | |
<text text-anchor="middle" x="38" y="-218.6" font-family="Times,serif" font-size="14.00">cc1</text> | |
</g> | |
<!-- 54->53 --> | |
<g id="CattSystem_edge4" class="edge"><title>54->53</title> | |
<path fill="none" stroke="black" d="M43.9552,-204.879C48.3754,-193.852 55.1658,-179.567 64.021,-168.8 68.8401,-162.94 74.8245,-157.488 80.8651,-152.715"/> | |
<polygon fill="black" stroke="black" points="89.0329,-146.651 83.6863,-156.225 85.0184,-149.631 81.0038,-152.612 81.0038,-152.612 81.0038,-152.612 85.0184,-149.631 78.3213,-148.999 89.0329,-146.651 89.0329,-146.651"/> | |
<text text-anchor="middle" x="85.9895" y="-173.6" font-family="Times,serif" font-size="14.00">schema</text> | |
</g> | |
<!-- 56 --> | |
<g id="CattSystem/CatTheoryInstance/client[@roleName='cc2']" class="node"><title>56</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="110" cy="-222.8" rx="27" ry="18"/> | |
<text text-anchor="middle" x="110" y="-218.6" font-family="Times,serif" font-size="14.00">cc2</text> | |
</g> | |
<!-- 56->53 --> | |
<g id="CattSystem_edge5" class="edge"><title>56->53</title> | |
<path fill="none" stroke="black" d="M110,-204.414C110,-192.04 110,-175.169 110,-161.02"/> | |
<polygon fill="black" stroke="black" points="110,-150.85 114.5,-160.85 110,-155.85 110,-160.85 110,-160.85 110,-160.85 110,-155.85 105.5,-160.85 110,-150.85 110,-150.85"/> | |
<text text-anchor="middle" x="130.989" y="-173.6" font-family="Times,serif" font-size="14.00">schema</text> | |
</g> | |
<!-- 58 --> | |
<g id="CattSystem/CatTheoryInstance/client[@roleName='cc3']" class="node"><title>58</title> | |
<ellipse fill="#f0f8ff" stroke="black" cx="182" cy="-222.8" rx="27" ry="18"/> | |
<text text-anchor="middle" x="182" y="-218.6" font-family="Times,serif" font-size="14.00">cc3</text> | |
</g> | |
<!-- 58->53 --> | |
<g id="CattSystem_edge6" class="edge"><title>58->53</title> | |
<path fill="none" stroke="black" d="M175.66,-204.918C171.006,-193.909 163.945,-179.627 155,-168.8 150.233,-163.03 144.355,-157.614 138.439,-152.847"/> | |
<polygon fill="black" stroke="black" points="130.449,-146.777 141.134,-149.243 134.43,-149.802 138.412,-152.826 138.412,-152.826 138.412,-152.826 134.43,-149.802 135.69,-156.41 130.449,-146.777 130.449,-146.777"/> | |
<text text-anchor="middle" x="187.989" y="-173.6" font-family="Times,serif" font-size="14.00">schema</text> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment