Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active October 31, 2017 01:17
Show Gist options
  • Save kenwebb/5c8342806385b9fb964ff158cbf1f1bf to your computer and use it in GitHub Desktop.
Save kenwebb/5c8342806385b9fb964ff158cbf1f1bf to your computer and use it in GitHub Desktop.
Xholon IPort/Port ports
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Mon Oct 30 2017 21:17:33 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Xholon IPort/Port ports
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 5c8342806385b9fb964ff158cbf1f1bf
Keywords:
My Notes
--------
October 29, 2017
To move the system Avatar from node One to node Two:
go 0
go 0
next
exit
exit
References
----------
(1) paper
THE OPERAD OF WIRING DIAGRAMS: FORMALIZING A GRAPHICAL LANGUAGE FOR DATABASES, RECURSION, AND PLUG-AND-PLAY CIRCUITS, by DAVID i. SPIVAK, 2013
Abstract. Wiring diagrams, as seen in digital circuits, can be nested hierarchically
and thus have an aspect of self-similarity. We show that wiring diagrams
form the morphisms of an operad T , capturing this self-similarity. We discuss the
algebra Rel of mathematical relations on T , and in so doing use wiring diagrams
as a graphical language with which to structure queries on relational databases.
We give the example of circuit diagrams as a special case. We move on to show
how plug-and-play devices and also recursion can be formulated in the operadic
framework as well. Throughout we include many examples and figures.
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<OneTwo/>
<One/>
<Two/>
<Figure6/>
<Y/>
<X1/>
<X2/>
<X3/>
<Cable/>
<Cables/>
</_-.XholonClass>
<xholonClassDetails>
<!-- I need to include the "#xpointer(...)"; see XholonWithPorts.java line 518 -->
<One xhType="XhtypePureActiveObject">
<port name="port" index="0" multiplicity="1" isConjugated="true" providedInterface="100" requiredInterface="200,201">
<portReplication name="replication" index="0" connector="#xpointer(ancestor::OneTwo/Two/attribute::port[1]/attribute::replication[1..*])"/>
</port>
</One>
<Two xhType="XhtypePureActiveObject">
<port name="port" index="0" multiplicity="2" isConjugated="false" providedInterface="" requiredInterface="">
<portReplication name="replication" index="0" connector="#xpointer(ancestor::OneTwo/One/attribute::port[1]/attribute::replication[1..*])"/>
<portReplication name="replication" index="1" connector="#xpointer(ancestor::OneTwo/One/attribute::port[1]/attribute::replication[1..*])"/>
</port>
</Two>
<!-- see FIGURE 6 in ref[1]
Figure 6. Here is a picture of φ: (X1, X2, X3) -> Y . The codomain
of φ is the outer star Y = {a, b, c, d, e} and the n = 3 domain objects
are the inner stars X1 = {r, s, t}, X2 = {u, v}, and X3 = {w, x, y, z}.
The morphism φ has cables C = {1, 2, 3, 4, 5, 6}, and our picture
shows, for example, that f1(s) = f3(w) = g(a) = 1, i.e. that wires
s, w, and a are soldered onto cable 1.
-->
<!-- Y = {a,b,c,d,e} -->
<Y xhType="XhtypePureActiveObject">
<port name="a" multiplicity="1" isConjugated="false"/>
<port name="b" multiplicity="1" isConjugated="false"/>
<port name="c" multiplicity="1" isConjugated="false"/>
<port name="d" multiplicity="1" isConjugated="false"/>
<port name="e" multiplicity="1" isConjugated="false"/>
</Y>
<!-- X1 = {r,s,t} -->
<X1 xhType="XhtypePureActiveObject">
<port name="r" multiplicity="1" isConjugated="false"/>
<port name="s" multiplicity="1" isConjugated="false"/>
<port name="t" multiplicity="1" isConjugated="false"/>
</X1>
<!-- X2 = {u,v} -->
<X2 xhType="XhtypePureActiveObject">
<port name="u" multiplicity="1" isConjugated="false"/>
<port name="v" multiplicity="1" isConjugated="false"/>
</X2>
<!-- X3 = {w,x,y,z} -->
<X3 xhType="XhtypePureActiveObject">
<port name="w" multiplicity="1" isConjugated="false"/>
<port name="x" multiplicity="1" isConjugated="false"/>
<port name="y" multiplicity="1" isConjugated="false"/>
<!-- multiplicity is the number of replications of portReplication that will be generated -->
<port name="z" multiplicity="5" isConjugated="false"/>
</X3>
<Cable xhType="XhtypePureActiveObject">
<port name="cbl" multiplicity="3" isConjugated="true"/>
</Cable>
<Avatar><Color>rgba(220,20,60,1.0)</Color></Avatar>
</xholonClassDetails>
<PhysicalSystem>
<OneTwo>
<One/>
<Two/>
</OneTwo>
<Figure6>
<Y/>
<X1/>
<X2/>
<X3/>
<!-- C = {1, 2, 3, 4, 5, 6} -->
<Cables>
<Cable roleName="1"/>
<Cable roleName="2"/>
<Cable roleName="3"/>
<Cable roleName="4"/>
<Cable roleName="5"/>
<Cable roleName="6"/>
</Cables>
</Figure6>
</PhysicalSystem>
<PhysicalSystembehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var root = $wnd.xh.root();
var one = root.xpath("descendant::One");
root.println(one.name());
var two = one.port(0).links()[2].reffedNode.next().parent().parent();
// one has an IPort link to two
root.println(two.name());
// two has an IPort link to one
//root.println(two.port(0).links()[2].reffedNode.next().parent().parent().name());
root.println(two.port(0).links(false,true)[0].reffedNode.next().parent().parent().name());
$wnd.console.log(two.port(0).links(false,true)[0]);
$wnd.console.log(two.port(0).links(false,true)[1]);
var y = root.xpath("descendant::Y");
$wnd.console.log(y);
$wnd.console.log(y.a);
$wnd.console.log(y.next());
$wnd.console.log(y.next().next());
$wnd.console.log(y.next().next().next());
var cable = root.xpath("descendant::Cables/Cable");
while (cable) {
$wnd.console.log(cable);
cable = cable.next();
}
]]></PhysicalSystembehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
height="765"
width="990"
version="1.1"
id="svg1509384093046">
<metadata
id="metadata4238">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Xholon IPort/Port ports</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4236" />
<style
id="style4208">
svg#svg1509384093046 rect {
fill: white;
stroke: #a121f1;
stroke-width: 1px;
}
svg#svg1509384093046 rect.rectalt {
fill: #efffdf;
}
svg#svg1509384093046 rect:active {
stroke-width: 2px;
}
svg#svg1509384093046 text {
font-family: &quot;Courier New&quot;,courier,monospace;
font-size: 8px;
fill: black;
pointer-events: none;
}
svg#svg1509384093046 rect[id*=&quot;.port[&quot;] {
fill: #0000ff;
stroke: #e0e0f8;
stroke-width: 1px;
}
svg#svg1509384093046 rect[id*=&quot;.conjport[&quot;], svg#svg1509384093046 polygon[id*=&quot;.conjport[&quot;] {
fill: #e0e0f8;
stroke: #0000ff;
stroke-width: 1px;
}
</style>
<title
id="title4210">Xholon IPort/Port ports</title>
<rect
style="fill:#efffdf;stroke:#a121f1;stroke-width:1.76548433px"
class="rectalt"
height="90.023422"
width="169.65561"
y="10.382742"
x="10.382742"
id="PhysicalSystem" />
<text
style="font-size:8px;font-family:'Courier New', courier, monospace;fill:#000000"
y="20"
x="15"
id="text2">PhysicalSystem</text>
<g
transform="translate(14.403728,27.226265)"
id="g3">
<title
id="title4219">one_46 [ port:_46_48]</title>
<rect
id="PhysicalSystem/OneTwo/One"
x="20"
y="30"
width="40"
height="20"
style="fill:#ffffff;stroke:#a121f1;stroke-width:1px" />
<text
id="text4"
x="25"
y="40"
style="font-size:8px;font-family:'Courier New', courier, monospace;fill:#000000">One</text>
<!--replication[0]:one_46 ancestor::PhysicalSystem/Two/attribute::port[1]/attribute::replication[1..*]-->
<rect
id="one_46.replication[0]"
x="57.025784"
y="41.357681"
ry="2.5"
width="6"
height="6"
style="fill:#ffffff;stroke:#a121f1;stroke-width:1px" />
<polygon
id="one_46.conjport[0]"
points="0,0 0,6 6,3 "
transform="translate(56.731476,32.522018)"
width="6"
height="6" />
</g>
<g
transform="translate(96.56148,26.637649)"
id="g5">
<title
id="title4226">two_47 [ port:_47_49]</title>
<rect
id="PhysicalSystem/OneTwo/Two"
x="22"
y="30"
width="40"
height="20"
style="fill:#ffffff;stroke:#a121f1;stroke-width:1px" />
<text
id="text6"
x="27"
y="40"
style="font-size:8px;font-family:'Courier New', courier, monospace;fill:#000000">Two</text>
<!--replication[0]:two_47 ancestor::PhysicalSystem/One/attribute::port[1]/attribute::replication[1..*]-->
<rect
id="two_47.replication[0]"
x="19"
y="34"
ry="2.5"
width="6"
height="6"
style="fill:#ffffff;stroke:#a121f1;stroke-width:1px" />
<!--replication[1]:two_47 ancestor::PhysicalSystem/One/attribute::port[1]/attribute::replication[1..*]-->
<rect
id="two_47.replication[1]"
x="19"
y="34"
ry="2.5"
width="6"
height="6"
style="fill:#ffffff;stroke:#a121f1;stroke-width:1px" />
<polygon
id="two_47.conjport[0]"
points="0,6 6,3 0,0 "
transform="translate(19,44)"
width="6"
height="6" />
<polygon
id="two_47.conjport[1]"
points="0,6 6,3 0,0 "
transform="translate(19,44)"
width="6"
height="6" />
</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