// TODO: Ontology stuff public static void rebindFrames(KnowledgeAdapter data, KnowledgeControl control) { // LEVEL #I - FILE LEVEL TreeNode root = KnowledgeTreeView.makeNode("Frame", 0, null, null); // LEVEL #II - CATEFORY OF FRAME LEVEL TreeNode classes = KnowledgeTreeView.makeNode("Class frames", 1, null, root); TreeNode instances = KnowledgeTreeView.makeNode("Instance frames", 1, null, root); TreeNode rules = KnowledgeTreeView.makeNode("Ruleset frames", 1, null, root); // LEVEL #III - CONCRETE FRAME LEVEL TreeNode node; log.Debug(" data.getFrames.Count=" + data.getFrames().Values.Count); foreach (object obj in data.getFrames().Values) { string name = KnowledgeAdapter.getFrameName(obj); log.Debug(" frame - " + name); if (KnowledgeAdapter.isClassFrame(obj)) { node = KnowledgeTreeView.makeNode(name, 2, obj, classes); } else if (KnowledgeAdapter.isInstanceFrame(obj)) { node = KnowledgeTreeView.makeNode(name, 2, obj, instances); } else { log.Debug(" warning - the frame is nobody's"); continue; } KnowledgeTreeView.rebindSlots(obj, node); } // TODO: include this cycle into previous somehow log.Debug(" data.getRules.Count=" + data.getRules().Values.Count); foreach (object obj in data.getRules().Values) { string name = KnowledgeAdapter.getFrameName(obj); log.Debug(" frame - " + name); if (KnowledgeAdapter.isRuleFrame(obj)) { node = KnowledgeTreeView.makeNode(name, 2, obj, rules); } else { log.Debug(" warning - the frame is nobody's"); } // TODO: need to implement // buildSlotsForFrame(frame, curNode); } // ooh! control.rebindFrames(root); }
private void treeView4_DoubleClick(object sender, EventArgs e) { if (treeView4.SelectedNode == null) { MessageBox.Show("Please, select an item of the tree view"); return; } log.Debug(" double click on treeview to navigate"); KnowledgeController instance = KnowledgeController.instance(); if (instance == null) { log.Debug(" controller is null "); return; } if (treeView4.SelectedNode.Tag == null) { log.Debug(" tag is null "); return; } string filepath = KnowledgeAdapter.getCurrentFilepath(); log.Debug(" filepath = " + filepath); TextEditorHelper.navigate(instance, treeView4.SelectedNode.Tag, filepath); }
private static string getRegExpr(Object tag) { string pattern; string spaces = "\\s+"; if (KnowledgeAdapter.isClassFrame(tag)) { string name = KnowledgeAdapter.getFrameName(tag); pattern = "frame" + spaces + "class" + spaces + name; } else if (KnowledgeAdapter.isInstanceFrame(tag)) { string name = KnowledgeAdapter.getFrameName(tag); pattern = "frame" + spaces + "instance" + spaces + name; } else if (KnowledgeAdapter.isRuleFrame(tag)) { string name = KnowledgeAdapter.getFrameName(tag); pattern = "frame" + spaces + "ruleset" + spaces + name; } else { pattern = null; } // TODO: slots log.Debug(" regular expression = " + pattern); return(pattern); }
public static void rebindSlots(object tag, TreeNode parent) { // LEVEL #IIII - CATEGORY OF SLOT LEVEL TreeNode owns = KnowledgeTreeView.makeNode("Own slots", 1, tag, parent); TreeNode instances = KnowledgeTreeView.makeNode("Instance slots", 1, tag, parent); // LEVEL #IIIII - CONCRETE SLOT LEVEL TreeNode node; foreach (Object obj in KnowledgeAdapter.getOwnSlots(tag).Values) { string name = KnowledgeAdapter.getSlotName(obj); log.Debug(" slot - " + name); node = KnowledgeTreeView.makeNode(name, 3, obj, owns); } foreach (Object obj in KnowledgeAdapter.getInstanceSlots(tag).Values) { string name = KnowledgeAdapter.getSlotName(obj); log.Debug(" slot - " + name); node = KnowledgeTreeView.makeNode(name, 3, obj, instances); } }
private void convertButton_Click(object sender, EventArgs e) { ConvForm convForm = new ConvForm(KnowledgeAdapter.getCurrentFilepath(), KnowledgeController.instance().environment.ApplicationObject);//TODO: convForm.ShowDialog(); }