Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active June 14, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/ca580feffa637a4050fc2d5ed35c81df to your computer and use it in GitHub Desktop.
Save kenwebb/ca580feffa637a4050fc2d5ed35c81df to your computer and use it in GitHub Desktop.
Categorical Data IDE - AQL - Test01
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Wed Jun 14 2017 09:06:09 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Categorical Data IDE - AQL - Test01
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: ca580feffa637a4050fc2d5ed35c81df
Keywords:
My Notes
--------
June 11, 2017
Comprehensive test of AQL syntax and features.
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
Mon Jun 12 08:25:43 GMT-400 2017 1497270343810
model: Categorical Data IDE - AQL - Test01
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
(64, 8, 1382);
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
(55, 21, 'cc1', 1, 'Tom', 'Tom Client');
INSERT INTO client (ID, xhcID, roleName, client_id, client_name, client_description) VALUES
(57, 21, 'cc2', 2, 'Dick', 'Dick Client');
INSERT INTO client (ID, xhcID, roleName, client_id, client_name, client_description) VALUES
(59, 21, 'cc3', 3, 'Harry', 'Harry Client');
INSERT INTO client (ID, xhcID, roleName, client_id, client_name, client_description, abc) VALUES
(61, 21, 'cc4', 4, 'Ken', 'Ken Client', 57);
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, 'Float', 0),
(10, 'Floats', 0),
(11, 'Integer', 0),
(12, 'Integers', 0),
(13, 'String', 0),
(14, 'Strings', 0),
(15, 'Double', 0),
(16, 'Doubles', 0),
(17, 'Boolean', 0),
(18, 'Booleans', 0),
(19, 'Date', 0),
(20, 'Dates', 0),
(21, 'client', 0),
(22, 'clients', 0);
]]></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="s" schemaRoleNameNoSuffix="true" pointToSchema="true" exportGraphviz="true" exportSql="true" exportXml="true" exportYaml="true"><![CDATA[
typeside Ty = literal {
types
Float
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 Client = literal : Ty {
entities
client
foreign_keys
abc : client -> client
attributes
client_id : client -> Integer
client_name : client -> String
client_description : client -> String
}
instance ClientInstance = literal : Client {
generators
cc1 cc2 cc3 cc4 : client
equations
cc4.client_id = 4
cc4.abc = cc2
client_name(cc4) = "Ken"
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", cc4 "Ken Client"}
}
]]></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="455pt" height="339pt"
viewBox="0.00 0.00 455.00 338.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 334.8)">
<title>47</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-334.8 451,-334.8 451,4 -4,4"/>
<text text-anchor="middle" x="223.5" y="-8.2" font-family="Times,serif" font-size="14.00">CattSystem</text>
<!-- 48 -->
<g id="CattSystem/CatTheorySchema/Floats" class="node"><title>48</title>
<ellipse fill="#f0f8ff" stroke="black" cx="40" cy="-312.8" rx="34.4636" ry="18"/>
<text text-anchor="middle" x="40" y="-308.6" font-family="Times,serif" font-size="14.00">Float</text>
</g>
<!-- 49 -->
<g id="CattSystem/CatTheorySchema/Integers" class="node"><title>49</title>
<ellipse fill="#f0f8ff" stroke="black" cx="48" cy="-42.8" rx="42.2038" ry="18"/>
<text text-anchor="middle" x="48" y="-38.6" font-family="Times,serif" font-size="14.00">Integer</text>
</g>
<!-- 50 -->
<g id="CattSystem/CatTheorySchema/Strings" class="node"><title>50</title>
<ellipse fill="#f0f8ff" stroke="black" cx="179" cy="-42.8" rx="38.1" ry="18"/>
<text text-anchor="middle" x="179" y="-38.6" font-family="Times,serif" font-size="14.00">String</text>
</g>
<!-- 51 -->
<g id="CattSystem/CatTheorySchema/Doubles" class="node"><title>51</title>
<ellipse fill="#f0f8ff" stroke="black" cx="208" cy="-312.8" rx="43.3294" ry="18"/>
<text text-anchor="middle" x="208" y="-308.6" font-family="Times,serif" font-size="14.00">Double</text>
</g>
<!-- 52 -->
<g id="CattSystem/CatTheorySchema/Booleans" class="node"><title>52</title>
<ellipse fill="#f0f8ff" stroke="black" cx="316" cy="-312.8" rx="46.4625" ry="18"/>
<text text-anchor="middle" x="316" y="-308.6" font-family="Times,serif" font-size="14.00">Boolean</text>
</g>
<!-- 53 -->
<g id="CattSystem/CatTheorySchema/Dates" class="node"><title>53</title>
<ellipse fill="#f0f8ff" stroke="black" cx="414" cy="-312.8" rx="33.0308" ry="18"/>
<text text-anchor="middle" x="414" y="-308.6" font-family="Times,serif" font-size="14.00">Date</text>
</g>
<!-- 54 -->
<g id="CattSystem/CatTheorySchema/clients" class="node"><title>54</title>
<ellipse fill="#f0f8ff" stroke="black" cx="120" cy="-132.8" rx="36.3683" ry="18"/>
<text text-anchor="middle" x="120" y="-128.6" font-family="Times,serif" font-size="14.00">client</text>
</g>
<!-- 54&#45;&gt;49 -->
<g id="CattSystem_edge2" class="edge"><title>54&#45;&gt;49</title>
<path fill="none" stroke="black" d="M92.7953,-120.888C81.7782,-115.213 69.836,-107.246 62.0084,-96.8 56.4295,-89.3551 53.0687,-79.8684 51.0454,-70.9845"/>
<polygon fill="black" stroke="black" points="49.2319,-60.991 55.4452,-70.0268 50.1247,-65.9107 51.0175,-70.8303 51.0175,-70.8303 51.0175,-70.8303 50.1247,-65.9107 46.5898,-71.6338 49.2319,-60.991 49.2319,-60.991"/>
<text text-anchor="middle" x="87.4958" y="-83.6" font-family="Times,serif" font-size="14.00">client_id</text>
</g>
<!-- 54&#45;&gt;50 -->
<g id="CattSystem_edge3" class="edge"><title>54&#45;&gt;50</title>
<path fill="none" stroke="black" d="M116.088,-114.449C114.571,-103.515 114.442,-89.4947 120.579,-78.8 125.247,-70.6667 132.63,-64.2135 140.597,-59.1801"/>
<polygon fill="black" stroke="black" points="149.372,-54.2633 142.848,-63.0774 145.01,-56.7075 140.648,-59.1517 140.648,-59.1517 140.648,-59.1517 145.01,-56.7075 138.448,-55.226 149.372,-54.2633 149.372,-54.2633"/>
<text text-anchor="middle" x="154.21" y="-83.6" font-family="Times,serif" font-size="14.00">client_name</text>
</g>
<!-- 54&#45;&gt;50 -->
<g id="CattSystem_edge4" class="edge"><title>54&#45;&gt;50</title>
<path fill="none" stroke="black" d="M151.663,-123.894C165.657,-118.654 180.776,-110.192 189,-96.8 193.842,-88.9153 193.456,-79.2211 191.157,-70.2891"/>
<polygon fill="black" stroke="black" points="187.924,-60.6654 195.374,-68.7123 189.516,-65.4052 191.108,-70.145 191.108,-70.145 191.108,-70.145 189.516,-65.4052 186.842,-71.5778 187.924,-60.6654 187.924,-60.6654"/>
<text text-anchor="middle" x="242.154" y="-83.6" font-family="Times,serif" font-size="14.00">client_description</text>
</g>
<!-- 54&#45;&gt;54 -->
<g id="CattSystem_edge1" class="edge"><title>54&#45;&gt;54</title>
<path fill="none" stroke="black" d="M152.154,-141.032C164.136,-141.302 174,-138.558 174,-132.8 174,-128.842 169.338,-126.308 162.53,-125.198"/>
<polygon fill="black" stroke="black" points="152.154,-124.568 162.408,-120.682 157.145,-124.871 162.135,-125.174 162.135,-125.174 162.135,-125.174 157.145,-124.871 161.863,-129.666 152.154,-124.568 152.154,-124.568"/>
<text text-anchor="middle" x="183.715" y="-128.6" font-family="Times,serif" font-size="14.00">abc</text>
</g>
<!-- 55 -->
<g id="CattSystem/CatTheoryInstance/client[@roleName=&#39;cc1&#39;]" class="node"><title>55</title>
<ellipse fill="#f0f8ff" stroke="black" cx="27" cy="-222.8" rx="27" ry="18"/>
<text text-anchor="middle" x="27" y="-218.6" font-family="Times,serif" font-size="14.00">cc1</text>
</g>
<!-- 55&#45;&gt;54 -->
<g id="CattSystem_edge6" class="edge"><title>55&#45;&gt;54</title>
<path fill="none" stroke="black" d="M25.0935,-204.365C24.8028,-193.122 26.3019,-178.788 34.021,-168.8 44.3858,-155.389 60.7458,-147.089 76.4256,-141.966"/>
<polygon fill="black" stroke="black" points="86.041,-139.168 77.6961,-146.283 81.24,-140.565 76.439,-141.962 76.439,-141.962 76.439,-141.962 81.24,-140.565 75.182,-137.641 86.041,-139.168 86.041,-139.168"/>
<text text-anchor="middle" x="55.9895" y="-173.6" font-family="Times,serif" font-size="14.00">schema</text>
</g>
<!-- 57 -->
<g id="CattSystem/CatTheoryInstance/client[@roleName=&#39;cc2&#39;]" class="node"><title>57</title>
<ellipse fill="#f0f8ff" stroke="black" cx="177" cy="-222.8" rx="27" ry="18"/>
<text text-anchor="middle" x="177" y="-218.6" font-family="Times,serif" font-size="14.00">cc2</text>
</g>
<!-- 57&#45;&gt;54 -->
<g id="CattSystem_edge7" class="edge"><title>57&#45;&gt;54</title>
<path fill="none" stroke="black" d="M166.81,-206.067C158.297,-192.926 146.006,-173.949 136.154,-158.74"/>
<polygon fill="black" stroke="black" points="130.683,-150.292 139.896,-156.239 133.401,-154.489 136.119,-158.686 136.119,-158.686 136.119,-158.686 133.401,-154.489 132.342,-161.132 130.683,-150.292 130.683,-150.292"/>
<text text-anchor="middle" x="173.989" y="-173.6" font-family="Times,serif" font-size="14.00">schema</text>
</g>
<!-- 59 -->
<g id="CattSystem/CatTheoryInstance/client[@roleName=&#39;cc3&#39;]" class="node"><title>59</title>
<ellipse fill="#f0f8ff" stroke="black" cx="249" cy="-222.8" rx="27" ry="18"/>
<text text-anchor="middle" x="249" y="-218.6" font-family="Times,serif" font-size="14.00">cc3</text>
</g>
<!-- 59&#45;&gt;54 -->
<g id="CattSystem_edge8" class="edge"><title>59&#45;&gt;54</title>
<path fill="none" stroke="black" d="M236.891,-206.319C227.295,-194.829 213.038,-179.382 198,-168.8 185.888,-160.277 171.368,-153.081 158.157,-147.472"/>
<polygon fill="black" stroke="black" points="148.822,-143.672 159.781,-143.274 153.453,-145.557 158.084,-147.442 158.084,-147.442 158.084,-147.442 153.453,-145.557 156.388,-151.61 148.822,-143.672 148.822,-143.672"/>
<text text-anchor="middle" x="237.989" y="-173.6" font-family="Times,serif" font-size="14.00">schema</text>
</g>
<!-- 61 -->
<g id="CattSystem/CatTheoryInstance/client[@roleName=&#39;cc4&#39;]" class="node"><title>61</title>
<ellipse fill="#f0f8ff" stroke="black" cx="120" cy="-312.8" rx="27" ry="18"/>
<text text-anchor="middle" x="120" y="-308.6" font-family="Times,serif" font-size="14.00">cc4</text>
</g>
<!-- 61&#45;&gt;54 -->
<g id="CattSystem_edge9" class="edge"><title>61&#45;&gt;54</title>
<path fill="none" stroke="black" d="M113.608,-295.177C108.509,-280.978 101.781,-259.881 99.021,-240.8 96.7305,-224.965 96.7305,-220.635 99.021,-204.8 101.184,-189.844 105.785,-173.65 110.129,-160.51"/>
<polygon fill="black" stroke="black" points="113.506,-150.708 114.503,-161.629 111.877,-155.436 110.248,-160.163 110.248,-160.163 110.248,-160.163 111.877,-155.436 105.994,-158.697 113.506,-150.708 113.506,-150.708"/>
<text text-anchor="middle" x="120.989" y="-218.6" font-family="Times,serif" font-size="14.00">schema</text>
</g>
<!-- 61&#45;&gt;57 -->
<g id="CattSystem_edge5" class="edge"><title>61&#45;&gt;57</title>
<path fill="none" stroke="black" d="M130.19,-296.067C138.81,-282.76 151.304,-263.471 161.216,-248.168"/>
<polygon fill="black" stroke="black" points="166.706,-239.693 165.046,-250.533 163.987,-243.89 161.269,-248.086 161.269,-248.086 161.269,-248.086 163.987,-243.89 157.492,-245.64 166.706,-239.693 166.706,-239.693"/>
<text text-anchor="middle" x="162.715" y="-263.6" font-family="Times,serif" font-size="14.00">abc</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