Download Jar. Uses 3874K of libraries. Click here for Pure Java version (15089L/108K).
!7 sS inputDiagrams = [[ CirclesAndLines(circles=[Circle(text="A [Anything]", x=d("0.26"), y=d("0.2")), Circle(text="B [Anything]", x=d("0.52"), y=d("0.49")), Circle(text="C [Anything]", x=d("0.75"), y=d("0.19"))], lines=[Arrow(a=t5, b=t26, text="likes"), Arrow(a=t26, b=t47, text="likes"), Arrow(a=t47, b=t5, text="Then: likes")], title="Transitivity of liking") CirclesAndLines(circles=[Circle(text="John", traits=[], x=d("0.28"), y=d("0.23")), Circle(text="Mary", traits=[], x=d("0.77"), y=d("0.23")), Circle(text="Peter", traits=[], x=d("0.52"), y=d("0.52"))], lines=[Arrow(a=t5, b=t31, text="likes", traits=[]), Arrow(a=t31, b=t57, text="likes", traits=[])], title="John") ]]; static L<Web> webs; static Web inputWeb, resultWeb; static JTabbedPane tabs; p-subst { cal_lineLength(50); webs = websFromCALStructures_vis(inputDiagrams); inputWeb = last(webs); think(); final CirclesAndLines cal = webToCAL_live_vis(inputWeb, voidfunc(Web w) { inputWeb = w; think() }); setFrameWidth(700, tabs = showTabbedWebs( "Instruction", calAutoLayout2(webToCAL_live_vis(first(webs), voidfunc(Web w) { webs.set(0, w); think() })), "Input", /*inputWeb,*/ calAutoLayout2(cal), "Result", resultWeb != null ? resultWeb : jlabel("Sorry"))); think(); } svoid think { loading { print("Thinking."); Web web = first(webs); // Instruction Web patternWeb, Map<WebNode> patternMap = unpair cloneWebWithMap(web); web_dropRelationsStartingWith(patternWeb, "Then:"); Web thenWeb, Map<WebNode> thenMap = unpair cloneWebWithReverseMap(web); web_unpackRelationsStartingWith(thenWeb, "Then:"); Map<WebNode> match = web_matchAllPerms(patternWeb, inputWeb); // Clone inputWeb to get resultWeb Web resultWeb, Map<WebNode> resultMap = unpair cloneWebWithMap(inputWeb); main.resultWeb = resultWeb; if (match != null) { // Then add relations from thenWeb for (WebRelation rel : web_relationObjects(thenWeb)) { WebNode a = mapGet(resultMap, mapGet(match, mapGet(patternMap, mapGet(thenMap, rel.a))); WebNode b = mapGet(resultMap, mapGet(match, mapGet(patternMap, mapGet(thenMap, rel.b))); if (a != null && b != null) { print("Adding labels " + rel.labels + " to: " + a + " - " + b); WebRelation rel2 = resultWeb.getRelation(a, b); web_addLabelsFromNodeToNode(rel, rel2); } } } if (tabs != null) { printWeb(resultWeb); CirclesAndLines cal = webToCAL(resultWeb); printBeautify(cal_structure(cal)); replaceTab(tabs, "Result", webToCALWithAutoLayout(resultWeb)); } }}
Began life as a copy of #1010298
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010365 |
Snippet name: | If - Then with 3 nodes [OK] |
Eternal ID of this version: | #1010365/4 |
Text MD5: | b7c717cfc05a50b129f78720b78871c2 |
Transpilation MD5: | bf23ffc8fde361ca88ad4bc0899b19b9 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-18 02:15:32 |
Source code size: | 2673 bytes / 67 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 505 / 1122 |
Version history: | 3 change(s) |
Referenced in: | -