Last active
October 3, 2017 23:37
-
-
Save kenwebb/91d27eda00a2a5325d2e54d3244e045a to your computer and use it in GitHub Desktop.
Bigraphs 2017 03 - Indoor Space
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 Oct 03 2017 19:37:23 GMT-0400 (EDT)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Bigraphs 2017 03 - Indoor Space | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 91d27eda00a2a5325d2e54d3244e045a | |
Keywords: | |
My Notes | |
-------- | |
October 2, 2017 | |
The paper by Walton and Worboys provides a good intuitive example of bigraphs. | |
In this workbook, I implement the bigraph as a Xholon app. | |
TODO | |
- create a behavior to make Xholon ports for all hyperedges OK | |
- AEdges are both directions between 2 places OK | |
- KEdge is single direction from key to room OK | |
- allow parallel links, such as between R101 and H1 | |
- figure out how to have the Agent open the door to R102 OK | |
- there should then be a bidirectional link between R102 and H1 OK | |
- the key controls (turns on and off) accessibility to R102 OK | |
References | |
---------- | |
(1) http://worboys.org/publications/waltonworboysgis12final.pdf | |
A Qualitative Bigraph Model for Indoor Space, by Lisa A. Walton and Michael Worboys, 2012 | |
(2) http://www.worboys.org/space/space-papers | |
Mike Worboys, Research papers | |
(3) http://www.worboys.org/publications/ISA2010.pdf | |
The informatics of indoor and outdoor space: A research agenda, by Nicholas A. Giudice, Lisa A. Walton, Michael Worboys | |
(4) http://www.worboys.org/publications/waltonworboys.pdf | |
An Algebraic Approach to Image Schemas for Geographic Space, by Lisa Walton and Michael Worboys | |
(5) http://www.worboys.org/publications/cosit2013.pdf | |
Using maptrees to characterize topological change, by Michael Worboys | |
(6) http://www.worboys.org/publications/tcs2013.pdf | |
Using bigraphs to model topological graphs embedded in orientable surfaces, by M.F. Worboys | |
(7) http://www.worboys.org/publications/GISci2012.pdf | |
The maptree: A fine-grained formal epresentation of space, by Michael Worboys | |
(8) https://www.researchgate.net/publication/276959705_Point_Set_Topological_Spatial_Relations | |
Point-Set Topological Spatial Relations, by Max J. Egenhofer and Robert D. Franzosa | |
(9) https://www.researchgate.net/profile/Michael_Worboys2/publication/221589395_Modeling_indoor_space/links/0deec51cc18a15336b000000.pdf | |
Modeling indoor space, by Michael Worboys | |
(10) http://gala.gre.ac.uk/13719/1/13719_WORBOYS_Generation_of_navigation_AAM_%282015%29.pdf | |
Generation of navigation graphs for indoor space, by Liping Yanga and Michael Worboys | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<!-- for each specific indoor environment at a minimyum the followingg bigraph node typess must be defined [1] --> | |
<AgentNode superClass="Avatar"/> <!-- a finite set of agents [1] --> | |
<PlaceNode superClass="NodeBG"/> <!-- a finite set of places an agent can be in [1] --> | |
<KeyNode superClass="NodeBG"/> <!-- a finite set of keys where kᵢ unlocks place pᵢ [1] --> | |
<AEdge superClass="HyperedgeBG"/> <!-- representing accessibility relations in the link graph [1] --> | |
<KEdge superClass="HyperedgeBG"/> <!-- representing key-lock relations in the link graph [1] --> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<Avatar><Color>rgba(255,215,0,0.8)</Color></Avatar> | |
<KeyNode><Color>rgba(215,255,0,0.8)</Color></KeyNode> | |
<AgentNode xhType="XhtypePureActiveObject"/> | |
<PlaceNode xhType="XhtypePureActiveObject"/> | |
<KeyNode xhType="XhtypePureActiveObject"/> | |
<OuterNameBG xhType="XhtypePureActiveObject"/> | |
<InnerNameBG xhType="XhtypePureActiveObject"/> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<Bigraphs> | |
<!-- First Floor Bigraph F1: ⟨{0},{x1}⟩ → ⟨{0},{y1,y2}⟩ --> | |
<Bigraph roleName="First Floor"> | |
<PlaceGraph> | |
<RootBG roleName="0"> | |
<PlaceNode roleName="F1"> <!-- floor 1 --> | |
<PlaceNode roleName="H1"/> <!-- hall --> | |
<PlaceNode roleName="R100"/> <!-- room --> | |
<PlaceNode roleName="R101"/> | |
<PlaceNode roleName="R102"> | |
<SiteBG roleName="0"/> | |
</PlaceNode> | |
<PlaceNode roleName="R103"/> | |
<PlaceNode roleName="E1"/> <!-- elevator --> | |
<PlaceNode roleName="RA"> | |
<AgentNode roleName="A"> | |
param repeat true; | |
where; | |
exit; | |
enter R102; | |
drop K102; | |
where; | |
look; | |
wait 5; | |
take K102; | |
wait 3; | |
<KeyNode roleName="K102"/> | |
</AgentNode> | |
</PlaceNode> | |
</PlaceNode> | |
</RootBG> | |
</PlaceGraph> | |
<LinkGraph> | |
<OuterNameBG roleName="y1"/> | |
<OuterNameBG roleName="y2"/> | |
<AEdge roleName="e0" nodenames="R100,H1"/> | |
<AEdge roleName="e1" nodenames="R101,H1"/> | |
<AEdge roleName="e2" nodenames="R101,H1"/> <!-- a second link between R101 and H1; it does not get set up --> | |
<AEdge roleName="e3" nodenames="y2,H1"/> | |
<AEdge roleName="e4" nodenames="E1,H1"/> | |
<AEdge roleName="e5" nodenames="R103,H1"/> | |
<AEdge roleName="e6" nodenames="y1,H1"/> | |
<AEdge roleName="e7" nodenames="RA,H1"/> | |
<AEdge roleName="e8" nodenames="x1,E1"/> | |
<KEdge roleName="e11" nodenames="K102,R102"/> | |
<InnerNameBG roleName="x1"/> | |
</LinkGraph> | |
</Bigraph> | |
<!-- Second Floor Bigraph F2: ⟨{},{}⟩ → ⟨{1},{x1}⟩ --> | |
<Bigraph roleName="Second Floor"> | |
<PlaceGraph> | |
<RootBG roleName="1"> | |
<PlaceNode roleName="F2"> | |
<PlaceNode roleName="H2"/> | |
<PlaceNode roleName="R200"/> | |
<PlaceNode roleName="R201"/> | |
<PlaceNode roleName="R202"/> | |
<PlaceNode roleName="R203"/> | |
<PlaceNode roleName="E2"/> | |
<PlaceNode roleName="B"/> | |
</PlaceNode> | |
</RootBG> | |
</PlaceGraph> | |
<LinkGraph> | |
<AEdge roleName="e0" nodenames="R200,H2"/> | |
<AEdge roleName="e1" nodenames="R201,H2"/> | |
<AEdge roleName="e2" nodenames="R201,H2"/> <!-- a second link between R101 and H1; it does not get set up --> | |
<AEdge roleName="e3" nodenames="R202,H2"/> | |
<AEdge roleName="e4" nodenames="E2,H2"/> | |
<AEdge roleName="e5" nodenames="R203,H2"/> | |
<AEdge roleName="e6" nodenames="B,H2"/> | |
<AEdge roleName="e7" nodenames="x1,E2"/> | |
<InnerNameBG roleName="x1"/> | |
</LinkGraph> | |
</Bigraph> | |
<!-- Outdoor --> | |
<Bigraph roleName="Outdoor"> | |
<PlaceGraph> | |
<RootBG roleName="0"> | |
<PlaceNode roleName="H"> | |
<PlaceNode roleName="PLA"/> | |
<PlaceNode roleName="PLB"/> | |
<PlaceNode roleName="B1"> | |
<SiteBG roleName="0"/> | |
<SiteBG roleName="1"/> | |
</PlaceNode> | |
</PlaceNode> | |
</RootBG> | |
</PlaceGraph> | |
<LinkGraph> | |
<OuterNameBG roleName="z1"/> | |
<AEdge roleName="e0" nodenames="PLA,PLB"/> | |
<InnerNameBG roleName="y1"/> | |
<InnerNameBG roleName="y2"/> | |
</LinkGraph> | |
</Bigraph> | |
</Bigraphs> | |
<!-- TODO compose the 3 bigraphs into a single bigraph --> | |
<ComposerBG roleName="F2 ∘ F1 ∘ H"/> | |
<Animate selection='#xhgraph'/> | |
</PhysicalSystem> | |
<LinkGraphbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
var pgraph = me.xpath("../PlaceGraph"); | |
var node = me.first(); | |
while (node) { | |
var nodeType = node.xhc().name(); | |
me.println(nodeType); | |
switch (nodeType) { | |
case "AEdge": | |
var nnarr = node.nodenames.split(","); | |
me.println(" " + nnarr[0] + " --> " + nnarr[1]); | |
var nodeA = pgraph.xpath("descendant::PlaceNode[@roleName='" + nnarr[0] + "']"); | |
if (!nodeA) { | |
nodeA = node.xpath("../OuterNameBG[@roleName='" + nnarr[0] + "']"); | |
} | |
if (!nodeA) { | |
nodeA = node.xpath("../InnerNameBG[@roleName='" + nnarr[0] + "']"); | |
} | |
var nodeB = pgraph.xpath("descendant::PlaceNode[@roleName='" + nnarr[1] + "']"); | |
if (nodeA && nodeB) { | |
nodeA.port(-1, nodeB); | |
nodeB.port(-1, nodeA); | |
} | |
break; | |
case "KEdge": | |
var nnarr = node.nodenames.split(","); | |
me.println(" " + nnarr[0] + " --> " + nnarr[1]); | |
var nodeA = pgraph.xpath("descendant::KeyNode[@roleName='" + nnarr[0] + "']"); | |
var nodeB = pgraph.xpath("descendant::PlaceNode[@roleName='" + nnarr[1] + "']"); | |
nodeA.port(-1, nodeB); | |
break; | |
default: break; | |
} | |
node = node.next(); | |
} | |
this.cnode.remove(); | |
} | |
} | |
]]></LinkGraphbehavior> | |
<KeyNodebehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, pgraph, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
pgraph = me.xpath("ancestor::PlaceGraph"); | |
}, | |
act: function() { | |
var pnode = me.parent(); | |
switch (pnode.xhc().name()) { | |
case "AgentNode": | |
// the Agent has the key | |
me.println("The key is held by the agent."); | |
if (pnode.parent().role() == "R102" && pnode.parent().port(0)) { | |
me.println("remove ports between room and hall."); | |
var nodeA = pnode.parent(); | |
var nodeB = pgraph.xpath("descendant::PlaceNode[@roleName='H1']"); | |
if (nodeA && nodeB) { | |
nodeA.port(0, null); | |
// find the H1 port that points to R102 | |
for (var portNum = 0; portNum < 100; portNum++) { | |
var portRef = nodeB.port(portNum); | |
if (portRef == nodeA) { | |
nodeB.port(portNum, null); | |
break; | |
} | |
} | |
} | |
} | |
break; | |
case "PlaceNode": | |
// the key has been dropped into room R102; if the door is locked, then unlock the door and make R102 accessible from the hall H1 | |
me.println("The key is in room " + pnode.name()); | |
if (!pnode.port(0)) { | |
me.println("create ports between room and hall."); | |
var nodeA = pgraph.xpath("descendant::PlaceNode[@roleName='R102']"); | |
var nodeB = pgraph.xpath("descendant::PlaceNode[@roleName='H1']"); | |
if (nodeA && nodeB) { | |
nodeA.port(-1, nodeB); | |
nodeB.port(-1, nodeA); | |
} | |
} | |
break; | |
default: break; | |
} | |
} | |
} | |
]]></KeyNodebehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Bigraphs</title> | |
<rect id="PhysicalSystem/Bigraphs" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Bigraph</title> | |
<rect id="PhysicalSystem/Bigraphs/Bigraph" 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