Skip to content

Instantly share code, notes, and snippets.

@kenwebb

kenwebb/xholonWorkbook.xml

Last active May 29, 2020
Embed
What would you like to do?
Conceptual Model Formalism - Skateboard
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Fri May 29 2020 12:04:23 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Conceptual Model Formalism - Skateboard
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 939a0a84cee453e4786c4077e5aee942
Keywords:
My Notes
--------
May 29, 2020
Jen has introduced the idea of formal conceptual models.
In this workbook, I will interpret her ideas, and use her Skateboard example.
I will produce a tentative Xholon implementation of Jen's initial formal conceptual model.
Start with Jen's concept of Objects:
Objects
Object Types (and Subtypes and Supertypes)
Object States
Object Attributes
Object Actions
Object Instances
And here is the Objects part of her Skateboard example:
Objects
Object Type: Skateboard
Object States: movement-state: rolling/not-rolling, operational-state: working/not-working
Object Attributes: location, size, weight, style, colour
Object Actions: Rolling
Object Instances: The skateboard that usually sits on Jen's porch
These models also have Actions and Relationships.
To run this model
-----------------
http://127.0.0.1:8080/war/Xholon.html?app=Conceptual+Model+Formalism+-+Skateboard&src=lstr&gui=clsc
https://www.primordion.com/Xholon/gwt/Xholon.html?app=939a0a84cee453e4786c4077e5aee942&src=gist&gui=clsc
To view or edit this model
--------------------------
https://gist.github.com/kenwebb/939a0a84cee453e4786c4077e5aee942
http://127.0.0.1:8080/war/wb/editwb.html?app=Conceptual+Model+Formalism+-+Skateboard&src=lstr
https://www.primordion.com/Xholon/gwt/wb/editwb.html?app=939a0a84cee453e4786c4077e5aee942&src=gist
References
----------
() our Slack channel
Examples of use of DefaultContent:
() https://gist.github.com/kenwebb/8912f51caadd8dc391eacffb1efaffd1
Composing Micro-Behaviors
DefaultContent for behavior (script) nodes
() https://gist.github.com/kenwebb/915111ff5ecefae96a5699d3e09002c2
Two avatars and a stick in a 1d gridcell cycle
DefaultContent for behavior (script) nodes
() https://gist.github.com/kenwebb/ada78df446ce73c0a0e403b6e1079eac
Programming with Categories (DRAFT) - 1.1 Programming: the art of composition
DefaultContent for behavior (script) nodes
() https://gist.github.com/kenwebb/fe78744a1ea3d33c743fbed2a195deb5
Island Colorings
this workbook has examples of a script node inside the DefaultContent
<GreenTree><DefaultContent>
<_-.treedc>
<script>this.parent().mass = 9999;</script>
<Fruit maxClones="10" energy="10"/>
<JuicyBerry maxClones="10" energy="10"/>
<Stick maxClones="10" energy="0"/>
</_-.treedc>
</DefaultContent></GreenTree>
<Fruit><DefaultContent><_-.immovabledc><script>this.parent().mass = 1;</script></_-.immovabledc></DefaultContent></Fruit>
Examples of StateMachine:
() https://gist.github.com/kenwebb/a034f087943ee3c8fe4fbcf3daf617b7
RoomModel DefaultContent 01
<StateMachine>
<State roleName="Top">
<PseudostateInitial>
<TransitionExternal roleName="init">
<Activity roleName="1">
</Activity>
<Target roleName="ready"/>
</TransitionExternal>
</PseudostateInitial>
<State roleName="ready">
</State>
</State>
</StateMachine>
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<!-- Object Types (in Xholon, these can be Xholon Classes that are part of the Inheritance Hierarchy) -->
<Vehicle>
<Skateboard/> <!-- Skateboard is a Subtype of Vehicle -->
</Vehicle>
<MotorizedSkateboard superClass="Skateboard"/> <!-- Skateboard is a Supertype of MotorizedSkateboard -->
<GreenTree/>
<Fruit/>
</_-.XholonClass>
<xholonClassDetails>
<GreenTree><DefaultContent><![CDATA[
<_-.treedc>
<script>this.parent().mass = 9999;</script>
<Fruit maxClones="10" energy="10"/>
<JuicyBerry maxClones="10" energy="10"/>
<Stick maxClones="10" energy="0"/>
</_-.treedc>
]]></DefaultContent></GreenTree>
<Fruit><DefaultContent><![CDATA[<_-.immovabledc><script>this.parent().mass = 1;</script></_-.immovabledc>]]></DefaultContent></Fruit>
<!-- TODO declare the Object States, Object Attributes, and Object Actions that Object Instances are allowed to have, and provide default values for all Skateboard instances -->
<Skateboard><DefaultContent><![CDATA[
<_-.skbddc>
<script>
const skbd = this.parent();
this.println("Skateboard TESTING dc " + skbd.name());
// declare and initialize Object Attributes
skbd.location = "LOCATION";
skbd.size = -1;
skbd.weight = -1;
skbd.style = "STYLE";
skbd.colour = "COLOUR";
</script>
<!-- Object States -->
<StateMachine>
<State roleName="Top">
<PseudostateInitial>
<TransitionExternal roleName="init">
<Activity roleName="1Rolling">
</Activity>
<Target roleName="movement"/>
</TransitionExternal>
</PseudostateInitial>
<State roleName="movement">
<State roleName="rolling"/>
<State roleName="not-rolling"/>
</State>
<State roleName="operational">
<State roleName="working"/>
<State roleName="not-working"/>
</State>
</State>
</StateMachine>
</_-.skbddc>
]]></DefaultContent></Skateboard>
<!-- State Machine -->
<State xhType="XhtypeStateMachineEntityActive" implName="org.primordion.xholon.base.ObservableStateMachineEntity"/>
<PseudostateInitial xhType="XhtypeStateMachineEntityActive" implName="org.primordion.xholon.base.StateMachineEntity"/>
<PseudostateChoice xhType="XhtypeStateMachineEntityActive" implName="org.primordion.xholon.base.StateMachineEntity"/>
<Transition xhType="XhtypeStateMachineEntityActive" implName="org.primordion.xholon.base.StateMachineEntity"/>
<StateMachineEntity xhType="XhtypeStateMachineEntity" implName="org.primordion.xholon.base.StateMachineEntity"/>
</xholonClassDetails>
<PhysicalSystem>
<!-- see Xml2Xholon - DefaultContent only works if I include RoomModel somewhere before I need to use DefaultContent -->
<RoomModel/>
<!-- Object Instances
how do I replace the default location, size, etc. ?
-->
<Skateboard roleName="The skateboard that usually sits on Jen's porch" location="Ottawa" size="22"/>
<Skateboard roleName="The other pink polka-dotted skateboard" size="33"/>
<!-- this results in
<GreenTree mass="9999">
<Fruit maxClones="10" energy="10" mass="1"></Fruit>
<JuicyBerry maxClones="10" energy="10"></JuicyBerry>
<Stick maxClones="10" energy="0"></Stick>
</GreenTree>
-->
<GreenTree/>
</PhysicalSystem>
<Skateboardbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var topActor;
var beh = {
postConfigure: function() {
topActor = this.cnode.parent();
},
processReceivedMessage: function(msg) {
if (topActor.first()) {
topActor.first().call(msg.signal, msg.data, msg.sender);
}
},
performActivity: function(activityId, msg) {
// perhaps these are Jen's Object Actions?
switch (activityId) {
case 1: // TODO put name of source state here
topActor.println("topActor is performing activity " + activityId + ", in response to msg " + msg);
break;
default:
break;
}
}
}
//# sourceURL=Skateboardbehavior.js
]]></Skateboardbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Skateboard</title>
<rect id="PhysicalSystem/Skateboard" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Skateboard2</title>
<rect id="PhysicalSystem/Skateboard[2]" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</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
You can’t perform that action at this time.