Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Xholon Metamind - some concepts
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue Jul 06 2021 08:33:24 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Xholon Metamind - some concepts
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: c7cef70f2349e8db5a8fa721ecb8d9e6
Keywords:
My Notes
--------
July 4, 2021
TODO:
- maybe write a Xholon Ecore parser using XML Processing Instruction that invokes a JavaScript module
- build Simple Island Game Agents (SIGA)
see also: Chads_Ecore_to_XholonIH.txt
see also: notes in my written notebook - July 4, 5
Parse and Use Chad .ecore Model
Ken Webb
July 4, 2021
Chads_Ecore_to_XholonIH.txt
see also Xholon Workbook: Xholon Metamind - some concepts
(1) Drag .ecore into Xholon Chameleon node
(2) Run this JavaScript code in browser Dev Tools
var root = temp0;
console.log('&lt;_-.' + root.name + '>');
var node = root.first();
while (node) {
console.log(' &lt;' + node.name,
node.eSuperTypes
? 'superClass="' + node.eSuperTypes.substring(3) + '"/>'
: '/>');
node = node.next();
}
console.log('&lt;/_-.' + root.name + '>');
GraphViz
--------
/*
Automatically generated by Xholon version 0.9.1, using org.primordion.ef.Xholon2Graphviz.java
Sun Jul 04 22:35:43 GMT-400 2021 1625452543047
model: Xholon Metamind - some concepts
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 Model_46_1625452543047.gv
Alternatively try one of these:
dot -Tsvg -O Model_46_1625452543047.gv
dot -Tsvg -O -Grankdir=LR Model_46_1625452543047.gv
fdp -Tsvg -O Model_46_1625452543047.gv
neato -Tsvg -O Model_46_1625452543047.gv
circo -Tsvg -O Model_46_1625452543047.gv
Or use one of: -Tgif -Tjpg -Tpdf -Tpng -Txdot -Txlib
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/PhysicalSystem/Model"), '{"gvFileExt":".gv","gvGraph":"digraph","layout":"dot","edgeOp":"->","gvCluster":"cluster","shouldShowStateMachineEntities":false,"filter":"--Behavior,Script","nameTemplateNodeId":"^^^^i^","nameTemplateNodeLabel":"R^^^^^","shouldQuoteLabels":true,"shouldShowLinks":true,"shouldShowLinkLabels":false,"shouldSpecifyLayout":false,"maxLabelLen":-1,"shouldColor":true,"defaultNodeColor":"#f0f8ff","bgGraphColor":"white","shouldSpecifyShape":true,"shape":"box","shouldSpecifySize":true,"size":"22","shouldSpecifyFontname":false,"fontname":"\"Courier New\"","shouldSpecifyArrowhead":true,"arrowhead":"vee","shouldSpecifyStylesheet":true,"stylesheet":"Xholon.css","shouldSpecifyRankdir":false,"rankdir":"LR","shouldDisplayGraph":true,"outputFormat":"svg"}');
*/
digraph 46 {
graph [label="Model",id="Model",stylesheet="Xholon.css",size=22,compound=true,bgcolor=white]
node [style=filled,fillcolor="#f0f8ff",shape=box]
edge [arrowhead=vee]
48 [label="Environment" id="Model/Environment"]
49 [label="Visual" id="Model/Visual"]
[fillcolor="yellow"]
subgraph cluster50 { label="DeclarativeMemory" id="Model/DeclarativeMemory"
subgraph cluster51 { label="Chunk" id="Model/DeclarativeMemory/Chunk"
52 [label="Slot" id="Model/DeclarativeMemory/Chunk/Slot"]
}
}
subgraph cluster53 { label="WorkingMemory" id="Model/WorkingMemory"
subgraph cluster54 { label="Chunk" id="Model/WorkingMemory/Chunk"
55 [label="Slot" id="Model/WorkingMemory/Chunk/Slot"]
}
}
subgraph cluster56 { label="ProceduralMemory" id="Model/ProceduralMemory"
subgraph cluster57 { label="Rule" id="Model/ProceduralMemory/Rule"
subgraph cluster59 { label="Condition" id="Model/ProceduralMemory/Rule/Condition"
subgraph cluster60 { label="Buffer" id="Model/ProceduralMemory/Rule/Condition/Buffer"
subgraph cluster61 { label="Chunk" id="Model/ProceduralMemory/Rule/Condition/Buffer/Chunk"
62 [label="Slot" id="Model/ProceduralMemory/Rule/Condition/Buffer/Chunk/Slot"]
}
}
}
subgraph cluster63 { label="Action" id="Model/ProceduralMemory/Rule/Action"
subgraph cluster64 { label="Buffer" id="Model/ProceduralMemory/Rule/Action/Buffer"
subgraph cluster65 { label="Chunk" id="Model/ProceduralMemory/Rule/Action/Buffer/Chunk"
66 [label="Slot" id="Model/ProceduralMemory/Rule/Action/Buffer/Chunk/Slot"]
}
}
}
}
}
67 [label="Motor" id="Model/Motor"]
[fillcolor="green"]
}
References
----------
() https://www.eclipse.org/modeling/
() https://www.eclipse.org/modeling/emf/
Eclipse Modeling Framework (EMF)
() http://download.eclipse.org/modeling/emf/emf/javadoc/2.9.0/org/eclipse/emf/ecore/package-summary.html#details
() https://eclipsesource.com/blogs/tutorials/emf-tutorial/
() https://www.vogella.com/tutorials/EclipseEMF/article.html
Eclipse Modeling Framework (EMF) - Tutorial
Lars Vogel (c) 2007 - 2020 vogella GmbHVersion 4.0,25.10.2019
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<!-- (3) The above JavaScript code generates this XML: -->
<_-.metamind>
<Model />
<Module />
<Buffer />
<DeclarativeMemory superClass="Module"/>
<ProceduralMemory superClass="Module"/>
<Motor superClass="Module"/>
<Visual superClass="Module"/>
<Rule />
<Chunk />
<Condition />
<Environment />
<Action />
<WorkingMemory superClass="Module"/>
<Slot />
</_-.metamind>
<Ecore/>
</_-.XholonClass>
<xholonClassDetails>
<!--<Block>
<port name="height" connector="Height"/>
</Block>-->
<WorkingMemory><Color>brown</Color></WorkingMemory>
<DeclarativeMemory><Color>red</Color></DeclarativeMemory>
<ProceduralMemory><Color>blue</Color></ProceduralMemory>
<Visual><Color>yellow</Color></Visual>
<Motor><Color>green</Color></Motor>
<Model><Color>white</Color></Model>
<Model><DefaultContent><![CDATA[
<_-.modelq>
<script>this.parent().println("modelq");</script>
<Environment nameq="myenv"/>
<Visual nameq="myvis"/>
<DeclarativeMemory nameq="mydmm"/>
<WorkingMemory nameq="mywmm"/>
<ProceduralMemory nameq="mypmm"/>
<Motor nameq="mymot"/>
</_-.modelq>
]]></DefaultContent></Model>
<DeclarativeMemory><DefaultContent><![CDATA[
<Chunk multiplicity="1" nameq="mychk"/>
]]></DefaultContent></DeclarativeMemory>
<WorkingMemory><DefaultContent><![CDATA[
<Chunk multiplicity="1" nameq="mychk"/>
]]></DefaultContent></WorkingMemory>
<ProceduralMemory><DefaultContent><![CDATA[
<Rule multiplicity="1" nameq="myrul"/>
]]></DefaultContent></ProceduralMemory>
<Rule><DefaultContent><![CDATA[
<_-.ruleq>
<script>this.parent().println("rule");</script>
<Condition nameq="mycnd"/>
<Action nameq="myact"/>
</_-.ruleq>
]]></DefaultContent></Rule>
<Condition><DefaultContent><![CDATA[
<Buffer multiplicity="1" nameq="mybuf"/>
]]></DefaultContent></Condition>
<Action><DefaultContent><![CDATA[
<Buffer multiplicity="1" nameq="mybuf"/>
]]></DefaultContent></Action>
<Buffer><DefaultContent><![CDATA[
<Chunk multiplicity="1" nameq="mychk"/>
]]></DefaultContent></Buffer>
<Chunk><DefaultContent><![CDATA[
<Slot multiplicity="1" nameq="myslt"/>
]]></DefaultContent></Chunk>
</xholonClassDetails>
<PhysicalSystem>
<!-- see Xml2Xholon - DefaultContent only works if I include RoomModel somewhere before I need to use DefaultContent -->
<RoomModel/>
<Model nameq="mymod"/>
<Ecore>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="metamind" nsURI="http://www.chadpeters.net/metamind" nsPrefix="metamind">
<eClassifiers xsi:type="ecore:EClass" name="Model">
<eStructuralFeatures xsi:type="ecore:EReference" name="modules" lowerBound="1" upperBound="-1" eType="#//Module" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="environment" lowerBound="1" eType="#//Environment" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Module" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="buffer" eType="#//Buffer" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Buffer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="bufferchunk" eType="#//Chunk" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DeclarativeMemory" abstract="true" interface="true" eSuperTypes="#//Module">
<eOperations name="addDM"> <eParameters name="chunks"/> </eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="dmchunks" upperBound="-1" eType="#//Chunk" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ProceduralMemory" abstract="true" interface="true" eSuperTypes="#//Module">
<eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" eType="#//Rule" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Motor" eSuperTypes="#//Module"/>
<eClassifiers xsi:type="ecore:EClass" name="Visual" eSuperTypes="#//Module"/>
<eClassifiers xsi:type="ecore:EClass" name="Rule">
<eStructuralFeatures xsi:type="ecore:EReference" name="conditions" lowerBound="1" eType="#//Condition" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="actions" lowerBound="1" eType="#//Action" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Chunk">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="slot" lowerBound="1" upperBound="-1" eType="#//Slot" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Condition">
<eStructuralFeatures xsi:type="ecore:EReference" name="LHSbuffers" lowerBound="1" upperBound="-1" eType="#//Buffer" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Environment">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Action">
<eStructuralFeatures xsi:type="ecore:EReference" name="RHSbuffers" lowerBound="1" upperBound="-1" eType="#//Buffer" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WorkingMemory" abstract="true" interface="true" eSuperTypes="#//Module">
<eStructuralFeatures xsi:type="ecore:EReference" name="wmchunks" upperBound="-1" eType="#//Chunk" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Slot">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>
<script><![CDATA[
var root = this.parent().first();
this.println('<_-.' + root.name + '>');
var node = root.first();
while (node) {
this.println(' <' + node.name + (node.eSuperTypes ? ' superClass="' + node.eSuperTypes.substring(3) + '"/>' : '/>'));
node = node.next();
}
this.println('</_-.' + root.name + '>');
]]></script>
</Ecore>
</PhysicalSystem>
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var a = 123;
var b = 456;
var c = a * b;
if (console) {
console.log(c);
}
//# sourceURL=Blockbehavior.js
]]></Blockbehavior>
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myHeight, testing;
var beh = {
postConfigure: function() {
testing = Math.floor(Math.random() * 10);
myHeight = this.cnode.parent();
},
act: function() {
myHeight.println(this.toString());
},
toString: function() {
return "testing:" + testing;
}
}
//# sourceURL=Heightbehavior.js
]]></Heightbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
$wnd.xh.Brickbehavior = function Brickbehavior() {}
$wnd.xh.Brickbehavior.prototype.postConfigure = function() {
this.brick = this.cnode.parent();
this.iam = " red brick";
};
$wnd.xh.Brickbehavior.prototype.act = function() {
this.brick.println("I am a" + this.iam);
};
//# sourceURL=Brickbehavior.js
]]></Brickbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
console.log("I'm another brick behavior");
]]></Brickbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Model</title>
<rect id="PhysicalSystem/Model" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Motor</title>
<rect id="PhysicalSystem/Model/Motor" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
<svg width="740pt" height="285pt"
viewBox="0.00 0.00 740.00 284.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Model" class="graph" transform="scale(1 1) rotate(0) translate(4 280.8)">
<title>46</title>
<polygon fill="white" stroke="none" points="-4,4 -4,-280.8 736,-280.8 736,4 -4,4"/>
<text text-anchor="middle" x="366" y="-8.2" font-family="Times,serif" font-size="14.00">Model</text>
<g id="Model/DeclarativeMemory" class="cluster"><title>cluster50</title>
<polygon fill="white" stroke="black" points="169,-56.8 169,-172.8 297,-172.8 297,-56.8 169,-56.8"/>
<text text-anchor="middle" x="233" y="-156.2" font-family="Times,serif" font-size="14.00">DeclarativeMemory</text>
</g>
<g id="Model/DeclarativeMemory/Chunk" class="cluster"><title>cluster51</title>
<polygon fill="white" stroke="black" points="198,-64.8 198,-140.8 268,-140.8 268,-64.8 198,-64.8"/>
<text text-anchor="middle" x="233" y="-124.2" font-family="Times,serif" font-size="14.00">Chunk</text>
</g>
<g id="Model/WorkingMemory" class="cluster"><title>cluster53</title>
<polygon fill="white" stroke="black" points="305,-56.8 305,-172.8 418,-172.8 418,-56.8 305,-56.8"/>
<text text-anchor="middle" x="361.5" y="-156.2" font-family="Times,serif" font-size="14.00">WorkingMemory</text>
</g>
<g id="Model/WorkingMemory/Chunk" class="cluster"><title>cluster54</title>
<polygon fill="white" stroke="black" points="326,-64.8 326,-140.8 396,-140.8 396,-64.8 326,-64.8"/>
<text text-anchor="middle" x="361" y="-124.2" font-family="Times,serif" font-size="14.00">Chunk</text>
</g>
<g id="Model/ProceduralMemory" class="cluster"><title>cluster56</title>
<polygon fill="white" stroke="black" points="426,-32.8 426,-268.8 670,-268.8 670,-32.8 426,-32.8"/>
<text text-anchor="middle" x="548" y="-252.2" font-family="Times,serif" font-size="14.00">ProceduralMemory</text>
</g>
<g id="Model/ProceduralMemory/Rule" class="cluster"><title>cluster57</title>
<polygon fill="white" stroke="black" points="434,-40.8 434,-236.8 662,-236.8 662,-40.8 434,-40.8"/>
<text text-anchor="middle" x="548" y="-220.2" font-family="Times,serif" font-size="14.00">Rule</text>
</g>
<g id="Model/ProceduralMemory/Rule/Condition" class="cluster"><title>cluster59</title>
<polygon fill="white" stroke="black" points="552,-48.8 552,-204.8 654,-204.8 654,-48.8 552,-48.8"/>
<text text-anchor="middle" x="603" y="-188.2" font-family="Times,serif" font-size="14.00">Condition</text>
</g>
<g id="Model/ProceduralMemory/Rule/Condition/Buffer" class="cluster"><title>cluster60</title>
<polygon fill="white" stroke="black" points="560,-56.8 560,-172.8 646,-172.8 646,-56.8 560,-56.8"/>
<text text-anchor="middle" x="603" y="-156.2" font-family="Times,serif" font-size="14.00">Buffer</text>
</g>
<g id="Model/ProceduralMemory/Rule/Condition/Buffer/Chunk" class="cluster"><title>cluster61</title>
<polygon fill="white" stroke="black" points="568,-64.8 568,-140.8 638,-140.8 638,-64.8 568,-64.8"/>
<text text-anchor="middle" x="603" y="-124.2" font-family="Times,serif" font-size="14.00">Chunk</text>
</g>
<g id="Model/ProceduralMemory/Rule/Action" class="cluster"><title>cluster63</title>
<polygon fill="white" stroke="black" points="442,-48.8 442,-204.8 544,-204.8 544,-48.8 442,-48.8"/>
<text text-anchor="middle" x="493" y="-188.2" font-family="Times,serif" font-size="14.00">Action</text>
</g>
<g id="Model/ProceduralMemory/Rule/Action/Buffer" class="cluster"><title>cluster64</title>
<polygon fill="white" stroke="black" points="450,-56.8 450,-172.8 536,-172.8 536,-56.8 450,-56.8"/>
<text text-anchor="middle" x="493" y="-156.2" font-family="Times,serif" font-size="14.00">Buffer</text>
</g>
<g id="Model/ProceduralMemory/Rule/Action/Buffer/Chunk" class="cluster"><title>cluster65</title>
<polygon fill="white" stroke="black" points="458,-64.8 458,-140.8 528,-140.8 528,-64.8 458,-64.8"/>
<text text-anchor="middle" x="493" y="-124.2" font-family="Times,serif" font-size="14.00">Chunk</text>
</g>
<!-- 48 -->
<g id="Model/Environment" class="node"><title>48</title>
<polygon fill="#f0f8ff" stroke="black" points="88.3244,-108.8 -0.324448,-108.8 -0.324448,-72.8 88.3244,-72.8 88.3244,-108.8"/>
<text text-anchor="middle" x="44" y="-86.6" font-family="Times,serif" font-size="14.00">Environment</text>
</g>
<!-- 49 -->
<g id="Model/Visual" class="node"><title>49</title>
<polygon fill="yellow" stroke="black" points="161,-108.8 107,-108.8 107,-72.8 161,-72.8 161,-108.8"/>
<text text-anchor="middle" x="134" y="-86.6" font-family="Times,serif" font-size="14.00">Visual</text>
</g>
<!-- 52 -->
<g id="Model/DeclarativeMemory/Chunk/Slot" class="node"><title>52</title>
<polygon fill="#f0f8ff" stroke="black" points="260,-108.8 206,-108.8 206,-72.8 260,-72.8 260,-108.8"/>
<text text-anchor="middle" x="233" y="-86.6" font-family="Times,serif" font-size="14.00">Slot</text>
</g>
<!-- 55 -->
<g id="Model/WorkingMemory/Chunk/Slot" class="node"><title>55</title>
<polygon fill="#f0f8ff" stroke="black" points="388,-108.8 334,-108.8 334,-72.8 388,-72.8 388,-108.8"/>
<text text-anchor="middle" x="361" y="-86.6" font-family="Times,serif" font-size="14.00">Slot</text>
</g>
<!-- 62 -->
<g id="Model/ProceduralMemory/Rule/Condition/Buffer/Chunk/Slot" class="node"><title>62</title>
<polygon fill="#f0f8ff" stroke="black" points="630,-108.8 576,-108.8 576,-72.8 630,-72.8 630,-108.8"/>
<text text-anchor="middle" x="603" y="-86.6" font-family="Times,serif" font-size="14.00">Slot</text>
</g>
<!-- 66 -->
<g id="Model/ProceduralMemory/Rule/Action/Buffer/Chunk/Slot" class="node"><title>66</title>
<polygon fill="#f0f8ff" stroke="black" points="520,-108.8 466,-108.8 466,-72.8 520,-72.8 520,-108.8"/>
<text text-anchor="middle" x="493" y="-86.6" font-family="Times,serif" font-size="14.00">Slot</text>
</g>
<!-- 67 -->
<g id="Model/Motor" class="node"><title>67</title>
<polygon fill="green" stroke="black" points="732,-108.8 678,-108.8 678,-72.8 732,-72.8 732,-108.8"/>
<text text-anchor="middle" x="705" y="-86.6" font-family="Times,serif" font-size="14.00">Motor</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